File: | dm/impls/plex/plex.c |
Warning: | line 2135, column 16 Array access (from variable 'tmpO') results in a null pointer dereference |
[?] 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 */ | |||
11 | PetscLogEvent 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_Preallocate, DMPLEX_ResidualFEM, DMPLEX_JacobianFEM, DMPLEX_InterpolatorFEM, DMPLEX_InjectorFEM, DMPLEX_IntegralFEM, DMPLEX_CreateGmsh; | |||
12 | ||||
13 | PETSC_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 | @*/ | |||
33 | PetscErrorCode 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 | ||||
102 | PetscErrorCode 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 | ||||
138 | static 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 | ||||
277 | static 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, §ion);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 | ||||
299 | PetscErrorCode 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 | ||||
360 | PetscErrorCode 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 | ||||
400 | PetscErrorCode 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 | ||||
456 | PetscErrorCode 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 | ||||
485 | PetscErrorCode 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 | ||||
507 | PetscErrorCode 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 | ||||
546 | PETSC_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 | ||||
601 | static 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 | PetscReal scale = 2.0; | |||
675 | PetscReal tikzscale = 1.0; | |||
676 | PetscBool useNumbers = PETSC_TRUE, useLabels, useColors; | |||
677 | double tcoords[3]; | |||
678 | PetscScalar *coords; | |||
679 | PetscInt numLabels, l, numColors, numLColors, dim, depth, cStart, cEnd, c, vStart, vEnd, v, eStart = 0, eEnd = 0, e, p; | |||
680 | PetscMPIInt rank, size; | |||
681 | char **names, **colors, **lcolors; | |||
682 | PetscBool plotEdges, flg; | |||
683 | ||||
684 | ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),684,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
685 | ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),685,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
686 | ierr = DMGetNumLabels(dm, &numLabels);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),686,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
687 | numLabels = PetscMax(numLabels, 10)(((numLabels)<(10)) ? (10) : (numLabels)); | |||
688 | numColors = 10; | |||
689 | numLColors = 10; | |||
690 | ierr = PetscCalloc3(numLabels, &names, numColors, &colors, numLColors, &lcolors)PetscMallocA(3,PETSC_TRUE,690,__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),690,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
691 | 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),691,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
692 | 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),692,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
693 | 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),693,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
694 | 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),694,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
695 | if (!useLabels) numLabels = 0; | |||
696 | 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),696,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
697 | if (!useColors) { | |||
698 | numColors = 3; | |||
699 | 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),699,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
700 | } | |||
701 | 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),701,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
702 | if (!useColors) { | |||
703 | numLColors = 4; | |||
704 | 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),704,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
705 | } | |||
706 | plotEdges = (PetscBool)(depth > 1 && useNumbers && dim < 3); | |||
707 | 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),707,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
708 | if (flg && plotEdges && depth < dim) SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_SUP, "Mesh must be interpolated")return PetscError(PetscObjectComm((PetscObject) dm),708,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",56, PETSC_ERROR_INITIAL,"Mesh must be interpolated"); | |||
709 | if (depth < dim) plotEdges = PETSC_FALSE; | |||
710 | ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)dm), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),710,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
711 | ierr = MPI_Comm_size(PetscObjectComm((PetscObject)dm), &size);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 | ierr = PetscObjectGetName((PetscObject) dm, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),712,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
713 | ierr = PetscViewerASCIIPrintf(viewer, "\ | |||
714 | \\documentclass[tikz]{standalone}\n\n\ | |||
715 | \\usepackage{pgflibraryshapes}\n\ | |||
716 | \\usetikzlibrary{backgrounds}\n\ | |||
717 | \\usetikzlibrary{arrows}\n\ | |||
718 | \\begin{document}\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),718,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
719 | if (size > 1) { | |||
720 | ierr = PetscViewerASCIIPrintf(viewer, "%s for process ", name);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 | for (p = 0; p < size; ++p) { | |||
722 | if (p > 0 && p == size-1) { | |||
723 | ierr = PetscViewerASCIIPrintf(viewer, ", and ", colors[p%numColors], p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),723,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
724 | } else if (p > 0) { | |||
725 | ierr = PetscViewerASCIIPrintf(viewer, ", ", colors[p%numColors], p);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 | } | |||
727 | ierr = PetscViewerASCIIPrintf(viewer, "{\\textcolor{%s}%D}", colors[p%numColors], p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),727,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
728 | } | |||
729 | ierr = PetscViewerASCIIPrintf(viewer, ".\n\n\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),729,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
730 | } | |||
731 | 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),731,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
732 | /* Plot vertices */ | |||
733 | ierr = DMPlexGetDepthStratum(dm, 0, &vStart, &vEnd);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 | ierr = VecGetArray(coordinates, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),734,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
735 | ierr = PetscViewerASCIIPushSynchronized(viewer);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 | for (v = vStart; v < vEnd; ++v) { | |||
737 | PetscInt off, dof, d; | |||
738 | PetscBool isLabeled = PETSC_FALSE; | |||
739 | ||||
740 | ierr = PetscSectionGetDof(coordSection, v, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),740,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
741 | ierr = PetscSectionGetOffset(coordSection, v, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),741,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
742 | ierr = PetscViewerASCIISynchronizedPrintf(viewer, "\\path (");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 | 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),743,__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); | |||
744 | for (d = 0; d < dof; ++d) { | |||
745 | tcoords[d] = (double) (scale*PetscRealPart(coords[off+d])(coords[off+d])); | |||
746 | tcoords[d] = PetscAbs(tcoords[d])(((tcoords[d]) >= 0) ? (tcoords[d]) : (-(tcoords[d]))) < 1e-10 ? 0.0 : tcoords[d]; | |||
747 | } | |||
748 | /* Rotate coordinates since PGF makes z point out of the page instead of up */ | |||
749 | if (dim == 3) {PetscReal tmp = tcoords[1]; tcoords[1] = tcoords[2]; tcoords[2] = -tmp;} | |||
750 | for (d = 0; d < dof; ++d) { | |||
751 | if (d > 0) {ierr = PetscViewerASCIISynchronizedPrintf(viewer, ",");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),751,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
752 | ierr = PetscViewerASCIISynchronizedPrintf(viewer, "%g", tcoords[d]);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 | } | |||
754 | color = colors[rank%numColors]; | |||
755 | for (l = 0; l < numLabels; ++l) { | |||
756 | PetscInt val; | |||
757 | ierr = DMGetLabelValue(dm, names[l], v, &val);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 | if (val >= 0) {color = lcolors[l%numLColors]; isLabeled = PETSC_TRUE; break;} | |||
759 | } | |||
760 | if (useNumbers) { | |||
761 | 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),761,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
762 | } else { | |||
763 | 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),763,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
764 | } | |||
765 | } | |||
766 | ierr = VecRestoreArray(coordinates, &coords);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 = PetscViewerFlush(viewer);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 | /* Plot cells */ | |||
769 | ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),769,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
770 | ierr = DMPlexGetDepthStratum(dm, 1, &eStart, &eEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),770,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
771 | if (dim == 3 || !useNumbers) { | |||
772 | for (e = eStart; e < eEnd; ++e) { | |||
773 | const PetscInt *cone; | |||
774 | ||||
775 | color = colors[rank%numColors]; | |||
776 | for (l = 0; l < numLabels; ++l) { | |||
777 | PetscInt val; | |||
778 | ierr = DMGetLabelValue(dm, names[l], e, &val);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),778,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
779 | if (val >= 0) {color = lcolors[l%numLColors]; break;} | |||
780 | } | |||
781 | ierr = DMPlexGetCone(dm, e, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),781,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
782 | 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),782,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
783 | } | |||
784 | } else { | |||
785 | for (c = cStart; c < cEnd; ++c) { | |||
786 | PetscInt *closure = NULL((void*)0); | |||
787 | PetscInt closureSize, firstPoint = -1; | |||
788 | ||||
789 | ierr = DMPlexGetTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),789,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
790 | ierr = PetscViewerASCIISynchronizedPrintf(viewer, "\\draw[color=%s] ", colors[rank%numColors]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),790,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
791 | for (p = 0; p < closureSize*2; p += 2) { | |||
792 | const PetscInt point = closure[p]; | |||
793 | ||||
794 | if ((point < vStart) || (point >= vEnd)) continue; | |||
795 | if (firstPoint >= 0) {ierr = PetscViewerASCIISynchronizedPrintf(viewer, " -- ");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 | ierr = PetscViewerASCIISynchronizedPrintf(viewer, "(%D_%d)", point, rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),796,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
797 | if (firstPoint < 0) firstPoint = point; | |||
798 | } | |||
799 | /* Why doesn't this work? ierr = PetscViewerASCIISynchronizedPrintf(viewer, " -- cycle;\n");CHKERRQ(ierr); */ | |||
800 | ierr = PetscViewerASCIISynchronizedPrintf(viewer, " -- (%D_%d);\n", firstPoint, rank);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 = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);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 | } | |||
803 | } | |||
804 | ierr = VecGetArray(coordinates, &coords);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 | for (c = cStart; c < cEnd; ++c) { | |||
806 | double ccoords[3] = {0.0, 0.0, 0.0}; | |||
807 | PetscBool isLabeled = PETSC_FALSE; | |||
808 | PetscInt *closure = NULL((void*)0); | |||
809 | PetscInt closureSize, dof, d, n = 0; | |||
810 | ||||
811 | ierr = DMPlexGetTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),811,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
812 | ierr = PetscViewerASCIISynchronizedPrintf(viewer, "\\path (");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),812,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
813 | for (p = 0; p < closureSize*2; p += 2) { | |||
814 | const PetscInt point = closure[p]; | |||
815 | PetscInt off; | |||
816 | ||||
817 | if ((point < vStart) || (point >= vEnd)) continue; | |||
818 | ierr = PetscSectionGetDof(coordSection, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),818,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
819 | ierr = PetscSectionGetOffset(coordSection, point, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),819,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
820 | for (d = 0; d < dof; ++d) { | |||
821 | tcoords[d] = (double) (scale*PetscRealPart(coords[off+d])(coords[off+d])); | |||
822 | tcoords[d] = PetscAbs(tcoords[d])(((tcoords[d]) >= 0) ? (tcoords[d]) : (-(tcoords[d]))) < 1e-10 ? 0.0 : tcoords[d]; | |||
823 | } | |||
824 | /* Rotate coordinates since PGF makes z point out of the page instead of up */ | |||
825 | if (dof == 3) {PetscReal tmp = tcoords[1]; tcoords[1] = tcoords[2]; tcoords[2] = -tmp;} | |||
826 | for (d = 0; d < dof; ++d) {ccoords[d] += tcoords[d];} | |||
827 | ++n; | |||
828 | } | |||
829 | for (d = 0; d < dof; ++d) {ccoords[d] /= n;} | |||
830 | ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),830,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
831 | for (d = 0; d < dof; ++d) { | |||
832 | if (d > 0) {ierr = PetscViewerASCIISynchronizedPrintf(viewer, ",");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 | ierr = PetscViewerASCIISynchronizedPrintf(viewer, "%g", ccoords[d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),833,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
834 | } | |||
835 | color = colors[rank%numColors]; | |||
836 | for (l = 0; l < numLabels; ++l) { | |||
837 | PetscInt val; | |||
838 | ierr = DMGetLabelValue(dm, names[l], c, &val);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),838,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
839 | if (val >= 0) {color = lcolors[l%numLColors]; isLabeled = PETSC_TRUE; break;} | |||
840 | } | |||
841 | if (useNumbers) { | |||
842 | 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),842,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
843 | } else { | |||
844 | 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),844,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
845 | } | |||
846 | } | |||
847 | ierr = VecRestoreArray(coordinates, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),847,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
848 | /* Plot edges */ | |||
849 | if (plotEdges) { | |||
850 | ierr = VecGetArray(coordinates, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),850,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
851 | ierr = PetscViewerASCIIPrintf(viewer, "\\path\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),851,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
852 | for (e = eStart; e < eEnd; ++e) { | |||
853 | const PetscInt *cone; | |||
854 | PetscInt coneSize, offA, offB, dof, d; | |||
855 | ||||
856 | ierr = DMPlexGetConeSize(dm, e, &coneSize);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 | 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),857,__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); | |||
858 | ierr = DMPlexGetCone(dm, e, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),858,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
859 | ierr = PetscSectionGetDof(coordSection, cone[0], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),859,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
860 | ierr = PetscSectionGetOffset(coordSection, cone[0], &offA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),860,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
861 | ierr = PetscSectionGetOffset(coordSection, cone[1], &offB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),861,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
862 | ierr = PetscViewerASCIISynchronizedPrintf(viewer, "(");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),862,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
863 | for (d = 0; d < dof; ++d) { | |||
864 | tcoords[d] = (double) (0.5*scale*PetscRealPart(coords[offA+d]+coords[offB+d])(coords[offA+d]+coords[offB+d])); | |||
865 | tcoords[d] = PetscAbs(tcoords[d])(((tcoords[d]) >= 0) ? (tcoords[d]) : (-(tcoords[d]))) < 1e-10 ? 0.0 : tcoords[d]; | |||
866 | } | |||
867 | /* Rotate coordinates since PGF makes z point out of the page instead of up */ | |||
868 | if (dim == 3) {PetscReal tmp = tcoords[1]; tcoords[1] = tcoords[2]; tcoords[2] = -tmp;} | |||
869 | for (d = 0; d < dof; ++d) { | |||
870 | if (d > 0) {ierr = PetscViewerASCIISynchronizedPrintf(viewer, ",");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 | ierr = PetscViewerASCIISynchronizedPrintf(viewer, "%g", (double)tcoords[d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),871,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
872 | } | |||
873 | color = colors[rank%numColors]; | |||
874 | for (l = 0; l < numLabels; ++l) { | |||
875 | PetscInt val; | |||
876 | ierr = DMGetLabelValue(dm, names[l], v, &val);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),876,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
877 | if (val >= 0) {color = lcolors[l%numLColors]; break;} | |||
878 | } | |||
879 | 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),879,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
880 | } | |||
881 | ierr = VecRestoreArray(coordinates, &coords);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 | ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),882,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
883 | ierr = PetscViewerASCIIPrintf(viewer, "(0,0);\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),883,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
884 | } | |||
885 | ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),885,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
886 | ierr = PetscViewerASCIIPopSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),886,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
887 | ierr = PetscViewerASCIIPrintf(viewer, "\\end{tikzpicture}\n");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, "\\end{document}\n", name);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 (l = 0; l < numLabels; ++l) {ierr = PetscFree(names[l])((*PetscTrFree)((void*)(names[l]),889,__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),889,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
890 | for (c = 0; c < numColors; ++c) {ierr = PetscFree(colors[c])((*PetscTrFree)((void*)(colors[c]),890,__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),890,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
891 | for (c = 0; c < numLColors; ++c) {ierr = PetscFree(lcolors[c])((*PetscTrFree)((void*)(lcolors[c]),891,__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),891,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
892 | ierr = PetscFree3(names, colors, lcolors)PetscFreeA(3,892,__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),892,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
893 | } else { | |||
894 | MPI_Comm comm; | |||
895 | PetscInt *sizes, *hybsizes; | |||
896 | PetscInt locDepth, depth, cellHeight, dim, d, pMax[4]; | |||
897 | PetscInt pStart, pEnd, p; | |||
898 | PetscInt numLabels, l; | |||
899 | const char *name; | |||
900 | PetscMPIInt size; | |||
901 | ||||
902 | ierr = PetscObjectGetComm((PetscObject)dm,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),902,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
903 | ierr = MPI_Comm_size(comm, &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),903,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
904 | ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),904,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
905 | ierr = DMPlexGetVTKCellHeight(dm, &cellHeight);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),905,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
906 | ierr = PetscObjectGetName((PetscObject) dm, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
907 | 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),907,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
908 | 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),908,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
909 | 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),909,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
910 | ierr = DMPlexGetDepth(dm, &locDepth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),910,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
911 | ierr = MPIU_Allreduce(&locDepth, &depth, 1, MPIU_INT, MPI_MAX, comm)(PetscAllreduceBarrierCheck(comm,1,911,__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),911,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
912 | 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),912,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
913 | ierr = PetscCalloc2(size,&sizes,size,&hybsizes)PetscMallocA(2,PETSC_TRUE,913,__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),913,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
914 | if (depth == 1) { | |||
915 | ierr = DMPlexGetDepthStratum(dm, 0, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),915,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
916 | pEnd = pEnd - pStart; | |||
917 | pMax[0] -= pStart; | |||
918 | ierr = MPI_Gather(&pEnd, 1, MPIU_INT, sizes, 1, MPIU_INT, 0, comm)((petsc_gather_ct++,0) || PetscMPITypeSize((&petsc_send_len ),(1),(((MPI_Datatype)0x4c000405))) || 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),918,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
919 | ierr = MPI_Gather(&pMax[0], 1, MPIU_INT, hybsizes, 1, MPIU_INT, 0, comm)((petsc_gather_ct++,0) || PetscMPITypeSize((&petsc_send_len ),(1),(((MPI_Datatype)0x4c000405))) || 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),919,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
920 | ierr = PetscViewerASCIIPrintf(viewer, " %d-cells:", 0);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 | for (p = 0; p < size; ++p) { | |||
922 | 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),922,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
923 | else {ierr = PetscViewerASCIIPrintf(viewer, " %D", sizes[p]);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 | } | |||
925 | ierr = PetscViewerASCIIPrintf(viewer, "\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 = DMPlexGetHeightStratum(dm, 0, &pStart, &pEnd);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 | pEnd = pEnd - pStart; | |||
928 | pMax[depth] -= pStart; | |||
929 | ierr = MPI_Gather(&pEnd, 1, MPIU_INT, sizes, 1, MPIU_INT, 0, comm)((petsc_gather_ct++,0) || PetscMPITypeSize((&petsc_send_len ),(1),(((MPI_Datatype)0x4c000405))) || 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),929,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
930 | ierr = MPI_Gather(&pMax[depth], 1, MPIU_INT, hybsizes, 1, MPIU_INT, 0, comm)((petsc_gather_ct++,0) || PetscMPITypeSize((&petsc_send_len ),(1),(((MPI_Datatype)0x4c000405))) || 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),930,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
931 | ierr = PetscViewerASCIIPrintf(viewer, " %D-cells:", dim);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 | for (p = 0; p < size; ++p) { | |||
933 | 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),933,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
934 | else {ierr = PetscViewerASCIIPrintf(viewer, " %D", sizes[p]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),934,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
935 | } | |||
936 | ierr = PetscViewerASCIIPrintf(viewer, "\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),936,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
937 | } else { | |||
938 | PetscMPIInt rank; | |||
939 | ierr = MPI_Comm_rank(comm, &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),939,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
940 | for (d = 0; d <= dim; d++) { | |||
941 | ierr = DMPlexGetDepthStratum(dm, d, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),941,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
942 | pEnd -= pStart; | |||
943 | pMax[d] -= pStart; | |||
944 | ierr = MPI_Gather(&pEnd, 1, MPIU_INT, sizes, 1, MPIU_INT, 0, comm)((petsc_gather_ct++,0) || PetscMPITypeSize((&petsc_send_len ),(1),(((MPI_Datatype)0x4c000405))) || 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),944,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
945 | ierr = MPI_Gather(&pMax[d], 1, MPIU_INT, hybsizes, 1, MPIU_INT, 0, comm)((petsc_gather_ct++,0) || PetscMPITypeSize((&petsc_send_len ),(1),(((MPI_Datatype)0x4c000405))) || 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),945,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
946 | ierr = PetscViewerASCIIPrintf(viewer, " %D-cells:", d);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 | for (p = 0; p < size; ++p) { | |||
948 | if (!rank) { | |||
949 | 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),949,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
950 | else {ierr = PetscViewerASCIIPrintf(viewer, " %D", sizes[p]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),950,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
951 | } | |||
952 | } | |||
953 | ierr = PetscViewerASCIIPrintf(viewer, "\n");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 | } | |||
955 | } | |||
956 | ierr = PetscFree2(sizes,hybsizes)PetscFreeA(2,956,__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),956,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
957 | ierr = DMGetNumLabels(dm, &numLabels);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 | if (numLabels) {ierr = PetscViewerASCIIPrintf(viewer, "Labels:\n");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 | for (l = 0; l < numLabels; ++l) { | |||
960 | DMLabel label; | |||
961 | const char *name; | |||
962 | IS valueIS; | |||
963 | const PetscInt *values; | |||
964 | PetscInt numValues, v; | |||
965 | ||||
966 | ierr = DMGetLabelName(dm, l, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),966,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
967 | ierr = DMGetLabel(dm, name, &label);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 = DMLabelGetNumValues(label, &numValues);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 = PetscViewerASCIIPrintf(viewer, " %s: %D strata with value/size (", name, numValues);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 = DMLabelGetValueIS(label, &valueIS);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 | ierr = ISGetIndices(valueIS, &values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),971,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
972 | ierr = PetscViewerASCIIUseTabs(viewer, PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),972,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
973 | for (v = 0; v < numValues; ++v) { | |||
974 | PetscInt size; | |||
975 | ||||
976 | ierr = DMLabelGetStratumSize(label, values[v], &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),976,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
977 | if (v > 0) {ierr = PetscViewerASCIIPrintf(viewer, ", ");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 = PetscViewerASCIIPrintf(viewer, "%D (%D)", values[v], size);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 | ierr = PetscViewerASCIIPrintf(viewer, ")\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),980,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
981 | ierr = PetscViewerASCIIUseTabs(viewer, PETSC_TRUE);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 = ISRestoreIndices(valueIS, &values);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 = ISDestroy(&valueIS);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 | } | |||
985 | /* If no fields are specified, people do not want to see adjacency */ | |||
986 | if (dm->Nf) { | |||
987 | PetscInt f; | |||
988 | ||||
989 | for (f = 0; f < dm->Nf; ++f) { | |||
990 | const char *name; | |||
991 | ||||
992 | ierr = PetscObjectGetName(dm->fields[f].disc, &name);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 | if (numLabels) {ierr = PetscViewerASCIIPrintf(viewer, "Field %s:\n", name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),993,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
994 | ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),994,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
995 | 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),995,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
996 | if (dm->fields[f].adjacency[0]) { | |||
997 | 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),997,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
998 | else {ierr = PetscViewerASCIIPrintf(viewer, "adjacency FVM\n");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 | } else { | |||
1000 | 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),1000,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1001 | else {ierr = PetscViewerASCIIPrintf(viewer, "adjacency FUNKY\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1001,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1002 | } | |||
1003 | ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1003,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1004 | } | |||
1005 | } | |||
1006 | ierr = DMGetCoarseDM(dm, &cdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1006,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1007 | if (cdm) { | |||
1008 | ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1008,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1009 | ierr = DMPlexView_Ascii(cdm, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1009,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1010 | ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1010,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1011 | } | |||
1012 | } | |||
1013 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1014 | } | |||
1015 | ||||
1016 | static PetscErrorCode DMPlexView_Draw(DM dm, PetscViewer viewer) | |||
1017 | { | |||
1018 | PetscDraw draw; | |||
1019 | DM cdm; | |||
1020 | PetscSection coordSection; | |||
1021 | Vec coordinates; | |||
1022 | const PetscScalar *coords; | |||
1023 | 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)}; | |||
1024 | PetscBool isnull; | |||
1025 | PetscInt dim, vStart, vEnd, cStart, cEnd, c, N; | |||
1026 | PetscMPIInt rank; | |||
1027 | PetscErrorCode ierr; | |||
1028 | ||||
1029 | 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] = 1029; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1030 | ierr = DMGetCoordinateDim(dm, &dim);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 | if (dim != 2) SETERRQ1(PetscObjectComm((PetscObject) dm), PETSC_ERR_SUP, "Cannot draw meshes of dimension %D", dim)return PetscError(PetscObjectComm((PetscObject) dm),1031,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",56, PETSC_ERROR_INITIAL,"Cannot draw meshes of dimension %D",dim); | |||
1032 | ierr = DMGetCoordinateDM(dm, &cdm);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 | ierr = DMGetSection(cdm, &coordSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1033,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1034 | ierr = DMGetCoordinatesLocal(dm, &coordinates);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1034,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1035 | ierr = DMPlexGetDepthStratum(dm, 0, &vStart, &vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1035,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1036 | ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1036,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1037 | ||||
1038 | ierr = PetscViewerDrawGetDraw(viewer, 0, &draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1038,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1039 | ierr = PetscDrawIsNull(draw, &isnull);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1039,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1040 | 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); | |||
1041 | ierr = PetscDrawSetTitle(draw, "Mesh");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1041,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1042 | ||||
1043 | ierr = VecGetLocalSize(coordinates, &N);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 = VecGetArrayRead(coordinates, &coords);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 | for (c = 0; c < N; c += dim) { | |||
1046 | 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])); | |||
1047 | 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 ])); | |||
1048 | } | |||
1049 | ierr = VecRestoreArrayRead(coordinates, &coords);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 = MPIU_Allreduce(&bound[0],xyl,2,MPIU_REAL,MPIU_MIN,PetscObjectComm((PetscObject)dm))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)dm), 2,1050,__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),1050,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1051 | ierr = MPIU_Allreduce(&bound[2],xyr,2,MPIU_REAL,MPIU_MAX,PetscObjectComm((PetscObject)dm))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)dm), 2,1051,__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),1051,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1052 | ierr = PetscDrawSetCoordinates(draw, xyl[0], xyl[1], xyr[0], xyr[1]);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 = PetscDrawClear(draw);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 | ||||
1055 | ierr = MPI_Comm_rank(PetscObjectComm((PetscObject) dm), &rank);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 | for (c = cStart; c < cEnd; ++c) { | |||
1057 | PetscScalar *coords = NULL((void*)0); | |||
1058 | PetscInt numCoords,coneSize; | |||
1059 | ||||
1060 | ierr = DMPlexGetConeSize(dm, c, &coneSize);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 | ierr = DMPlexVecGetClosure(dm, coordSection, coordinates, c, &numCoords, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1061,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1062 | switch (coneSize) { | |||
1063 | case 3: | |||
1064 | 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]), | |||
1065 | PETSC_DRAW_WHITE0 + rank % (PETSC_DRAW_BASIC_COLORS33-2) + 2, | |||
1066 | PETSC_DRAW_WHITE0 + rank % (PETSC_DRAW_BASIC_COLORS33-2) + 2, | |||
1067 | PETSC_DRAW_WHITE0 + rank % (PETSC_DRAW_BASIC_COLORS33-2) + 2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1067,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1068 | break; | |||
1069 | case 4: | |||
1070 | ierr = PetscDrawRectangle(draw, PetscRealPart(coords[0])(coords[0]), PetscRealPart(coords[1])(coords[1]), PetscRealPart(coords[4])(coords[4]), PetscRealPart(coords[5])(coords[5]), | |||
1071 | PETSC_DRAW_WHITE0 + rank % (PETSC_DRAW_BASIC_COLORS33-2) + 2, | |||
1072 | PETSC_DRAW_WHITE0 + rank % (PETSC_DRAW_BASIC_COLORS33-2) + 2, | |||
1073 | PETSC_DRAW_WHITE0 + rank % (PETSC_DRAW_BASIC_COLORS33-2) + 2, | |||
1074 | PETSC_DRAW_WHITE0 + rank % (PETSC_DRAW_BASIC_COLORS33-2) + 2);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 | break; | |||
1076 | default: SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_SUP, "Cannot draw cells with %D facets", coneSize)return PetscError(((MPI_Comm)0x44000001),1076,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,56,PETSC_ERROR_INITIAL,"Cannot draw cells with %D facets",coneSize ); | |||
1077 | } | |||
1078 | ierr = DMPlexVecRestoreClosure(dm, coordSection, coordinates, c, &numCoords, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1078,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1079 | } | |||
1080 | for (c = cStart; c < cEnd; ++c) { | |||
1081 | PetscScalar *coords = NULL((void*)0); | |||
1082 | PetscInt numCoords,coneSize; | |||
1083 | ||||
1084 | ierr = DMPlexGetConeSize(dm, c, &coneSize);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 = DMPlexVecGetClosure(dm, coordSection, coordinates, c, &numCoords, &coords);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 | switch (coneSize) { | |||
1087 | case 3: | |||
1088 | 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),1088,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1089 | 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),1089,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1090 | 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),1090,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1091 | break; | |||
1092 | case 4: | |||
1093 | 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),1093,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1094 | 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),1094,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1095 | 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),1095,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1096 | 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),1096,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1097 | break; | |||
1098 | default: SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_SUP, "Cannot draw cells with %D facets", coneSize)return PetscError(((MPI_Comm)0x44000001),1098,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,56,PETSC_ERROR_INITIAL,"Cannot draw cells with %D facets",coneSize ); | |||
1099 | } | |||
1100 | ierr = DMPlexVecRestoreClosure(dm, coordSection, coordinates, c, &numCoords, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1100,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1101 | } | |||
1102 | ierr = PetscDrawFlush(draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1102,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1103 | ierr = PetscDrawPause(draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1103,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1104 | ierr = PetscDrawSave(draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1104,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1105 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1106 | } | |||
1107 | ||||
1108 | PetscErrorCode DMView_Plex(DM dm, PetscViewer viewer) | |||
1109 | { | |||
1110 | PetscBool iascii, ishdf5, isvtk, isdraw, flg, isglvis; | |||
1111 | char name[PETSC_MAX_PATH_LEN4096]; | |||
1112 | PetscErrorCode ierr; | |||
1113 | ||||
1114 | 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] = 1114; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1115 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1115,__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),1115 ,__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),1115,__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),1115,__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); | |||
1116 | PetscValidHeaderSpecific(viewer, PETSC_VIEWER_CLASSID, 2)do { if (!viewer) return PetscError(((MPI_Comm)0x44000001),1116 ,__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),1116,__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),1116,__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),1116,__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); | |||
1117 | ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERASCII"ascii", &iascii);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 = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERVTK"vtk", &isvtk);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 | ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERHDF5"hdf5", &ishdf5);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1119,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1120 | ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERDRAW"draw", &isdraw);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 = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERGLVIS"glvis", &isglvis);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 | if (iascii) { | |||
1123 | PetscViewerFormat format; | |||
1124 | ierr = PetscViewerGetFormat(viewer, &format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1124,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1125 | if (format == PETSC_VIEWER_ASCII_GLVIS) { | |||
1126 | ierr = DMPlexView_GLVis(dm, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1126,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1127 | } else { | |||
1128 | ierr = DMPlexView_Ascii(dm, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1128,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1129 | } | |||
1130 | } else if (ishdf5) { | |||
1131 | #if defined(PETSC_HAVE_HDF5) | |||
1132 | ierr = DMPlexView_HDF5_Internal(dm, viewer);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 | #else | |||
1134 | SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_SUP, "HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5")return PetscError(PetscObjectComm((PetscObject) dm),1134,__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" ); | |||
1135 | #endif | |||
1136 | } else if (isvtk) { | |||
1137 | ierr = DMPlexVTKWriteAll((PetscObject) dm,viewer);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 if (isdraw) { | |||
1139 | ierr = DMPlexView_Draw(dm, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1139,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1140 | } else if (isglvis) { | |||
1141 | ierr = DMPlexView_GLVis(dm, viewer);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 | } else { | |||
1143 | 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),1143,__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); | |||
1144 | } | |||
1145 | /* Optionally view the partition */ | |||
1146 | 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),1146,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1147 | if (flg) { | |||
1148 | Vec ranks; | |||
1149 | ierr = DMPlexCreateRankField(dm, &ranks);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 = VecView(ranks, 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 | ierr = VecDestroy(&ranks);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1151,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1152 | } | |||
1153 | /* Optionally view a label */ | |||
1154 | 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),1154,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1155 | if (flg) { | |||
1156 | DMLabel label; | |||
1157 | Vec val; | |||
1158 | ||||
1159 | ierr = DMGetLabel(dm, name, &label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1159,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1160 | 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),1160,__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); | |||
1161 | ierr = DMPlexCreateLabelField(dm, label, &val);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1161,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1162 | ierr = VecView(val, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1162,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1163 | ierr = VecDestroy(&val);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1163,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1164 | } | |||
1165 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1166 | } | |||
1167 | ||||
1168 | PetscErrorCode DMLoad_Plex(DM dm, PetscViewer viewer) | |||
1169 | { | |||
1170 | PetscBool ishdf5; | |||
1171 | PetscErrorCode ierr; | |||
1172 | ||||
1173 | 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] = 1173; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1174 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1174,__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),1174 ,__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),1174,__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),1174,__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); | |||
1175 | PetscValidHeaderSpecific(viewer, PETSC_VIEWER_CLASSID, 2)do { if (!viewer) return PetscError(((MPI_Comm)0x44000001),1175 ,__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),1175,__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),1175,__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),1175,__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); | |||
1176 | ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERHDF5"hdf5", &ishdf5);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 | if (ishdf5) { | |||
1178 | #if defined(PETSC_HAVE_HDF5) | |||
1179 | PetscViewerFormat format; | |||
1180 | ierr = PetscViewerGetFormat(viewer, &format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1180,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1181 | if (format == PETSC_VIEWER_HDF5_XDMF || format == PETSC_VIEWER_HDF5_VIZ) { | |||
1182 | ierr = DMPlexLoad_HDF5_Xdmf_Internal(dm, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1182,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1183 | } else if (format == PETSC_VIEWER_HDF5_PETSC || format == PETSC_VIEWER_DEFAULT || format == PETSC_VIEWER_NATIVE) { | |||
1184 | ierr = DMPlexLoad_HDF5_Internal(dm, viewer);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 | } else SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_SUP, "PetscViewerFormat %s not supported for HDF5 input.", PetscViewerFormats[format])return PetscError(PetscObjectComm((PetscObject)dm),1185,__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]); | |||
1186 | #else | |||
1187 | SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_SUP, "HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5")return PetscError(PetscObjectComm((PetscObject) dm),1187,__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" ); | |||
1188 | #endif | |||
1189 | } else { | |||
1190 | 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),1190,__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); | |||
1191 | } | |||
1192 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1193 | } | |||
1194 | ||||
1195 | PetscErrorCode DMDestroy_Plex(DM dm) | |||
1196 | { | |||
1197 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
1198 | PetscErrorCode ierr; | |||
1199 | ||||
1200 | 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] = 1200; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1201 | 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),1201,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1202 | 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),1202,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1203 | 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); | |||
1204 | ierr = PetscSectionDestroy(&mesh->coneSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1204,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1205 | ierr = PetscFree(mesh->cones)((*PetscTrFree)((void*)(mesh->cones),1205,__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),1205,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1206 | ierr = PetscFree(mesh->coneOrientations)((*PetscTrFree)((void*)(mesh->coneOrientations),1206,__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),1206,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1207 | ierr = PetscSectionDestroy(&mesh->supportSection);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 | ierr = PetscSectionDestroy(&mesh->subdomainSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1208,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1209 | ierr = PetscFree(mesh->supports)((*PetscTrFree)((void*)(mesh->supports),1209,__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),1209,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1210 | ierr = PetscFree(mesh->facesTmp)((*PetscTrFree)((void*)(mesh->facesTmp),1210,__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),1210,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1211 | ierr = PetscFree(mesh->tetgenOpts)((*PetscTrFree)((void*)(mesh->tetgenOpts),1211,__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),1211,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1212 | ierr = PetscFree(mesh->triangleOpts)((*PetscTrFree)((void*)(mesh->triangleOpts),1212,__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),1212,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1213 | ierr = PetscPartitionerDestroy(&mesh->partitioner);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1213,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1214 | ierr = DMLabelDestroy(&mesh->subpointMap);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 | ierr = ISDestroy(&mesh->globalVertexNumbers);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1215,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1216 | ierr = ISDestroy(&mesh->globalCellNumbers);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1216,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1217 | ierr = PetscSectionDestroy(&mesh->anchorSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1217,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1218 | ierr = ISDestroy(&mesh->anchorIS);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 | ierr = PetscSectionDestroy(&mesh->parentSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1219,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1220 | ierr = PetscFree(mesh->parents)((*PetscTrFree)((void*)(mesh->parents),1220,__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),1220,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1221 | ierr = PetscFree(mesh->childIDs)((*PetscTrFree)((void*)(mesh->childIDs),1221,__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),1221,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1222 | ierr = PetscSectionDestroy(&mesh->childSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1222,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1223 | ierr = PetscFree(mesh->children)((*PetscTrFree)((void*)(mesh->children),1223,__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),1223,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1224 | ierr = DMDestroy(&mesh->referenceTree);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 = PetscGridHashDestroy(&mesh->lbox);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 | /* This was originally freed in DMDestroy(), but that prevents reference counting of backend objects */ | |||
1227 | ierr = PetscFree(mesh)((*PetscTrFree)((void*)(mesh),1227,__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),1227,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1228 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1229 | } | |||
1230 | ||||
1231 | PetscErrorCode DMCreateMatrix_Plex(DM dm, Mat *J) | |||
1232 | { | |||
1233 | PetscSection sectionGlobal; | |||
1234 | PetscInt bs = -1, mbs; | |||
1235 | PetscInt localSize; | |||
1236 | PetscBool isShell, isBlock, isSeqBlock, isMPIBlock, isSymBlock, isSymSeqBlock, isSymMPIBlock, isMatIS; | |||
1237 | PetscErrorCode ierr; | |||
1238 | MatType mtype; | |||
1239 | ISLocalToGlobalMapping ltog; | |||
1240 | ||||
1241 | 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] = 1241; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1242 | ierr = MatInitializePackage();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 | mtype = dm->mattype; | |||
1244 | ierr = DMGetGlobalSection(dm, §ionGlobal);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 | /* ierr = PetscSectionGetStorageSize(sectionGlobal, &localSize);CHKERRQ(ierr); */ | |||
1246 | ierr = PetscSectionGetConstrainedStorageSize(sectionGlobal, &localSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1246,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1247 | ierr = MatCreate(PetscObjectComm((PetscObject)dm), J);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1247,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1248 | ierr = MatSetSizes(*J, localSize, localSize, PETSC_DETERMINE-1, PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1248,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1249 | ierr = MatSetType(*J, mtype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1249,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1250 | ierr = MatSetFromOptions(*J);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1250,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1251 | ierr = MatGetBlockSize(*J, &mbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1251,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1252 | if (mbs > 1) bs = mbs; | |||
1253 | ierr = PetscStrcmp(mtype, MATSHELL"shell", &isShell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1253,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1254 | ierr = PetscStrcmp(mtype, MATBAIJ"baij", &isBlock);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1254,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1255 | ierr = PetscStrcmp(mtype, MATSEQBAIJ"seqbaij", &isSeqBlock);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1255,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1256 | ierr = PetscStrcmp(mtype, MATMPIBAIJ"mpibaij", &isMPIBlock);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1256,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1257 | ierr = PetscStrcmp(mtype, MATSBAIJ"sbaij", &isSymBlock);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 = PetscStrcmp(mtype, MATSEQSBAIJ"seqsbaij", &isSymSeqBlock);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 = PetscStrcmp(mtype, MATMPISBAIJ"mpisbaij", &isSymMPIBlock);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 = PetscStrcmp(mtype, MATIS"is", &isMatIS);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 | if (!isShell) { | |||
1262 | PetscSection subSection; | |||
1263 | PetscBool fillMatrix = (PetscBool)(!dm->prealloc_only && !isMatIS); | |||
1264 | PetscInt *dnz, *onz, *dnzu, *onzu, bsLocal[2], bsMinMax[2], *ltogidx, lsize; | |||
1265 | PetscInt pStart, pEnd, p, dof, cdof; | |||
1266 | ||||
1267 | /* Set localtoglobalmapping on the matrix for MatSetValuesLocal() to work (it also creates the local matrices in case of MATIS) */ | |||
1268 | if (isMatIS) { /* need a different l2g map than the one computed by DMGetLocalToGlobalMapping */ | |||
1269 | PetscSection section; | |||
1270 | PetscInt size; | |||
1271 | ||||
1272 | ierr = DMGetSection(dm, §ion);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 | ierr = PetscSectionGetStorageSize(section, &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1273,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1274 | ierr = PetscMalloc1(size,<ogidx)PetscMallocA(1,PETSC_FALSE,1274,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,(size_t)(size)*sizeof(**(<ogidx)),(<ogidx));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1274,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1275 | ierr = DMPlexGetSubdomainSection(dm, &subSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1275,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1276 | } else { | |||
1277 | ierr = DMGetLocalToGlobalMapping(dm,<og);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 | } | |||
1279 | ierr = PetscSectionGetChart(sectionGlobal, &pStart, &pEnd);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 | for (p = pStart, lsize = 0; p < pEnd; ++p) { | |||
1281 | PetscInt bdof; | |||
1282 | ||||
1283 | ierr = PetscSectionGetDof(sectionGlobal, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1283,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1284 | ierr = PetscSectionGetConstraintDof(sectionGlobal, p, &cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1284,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1285 | dof = dof < 0 ? -(dof+1) : dof; | |||
1286 | bdof = cdof && (dof-cdof) ? 1 : dof; | |||
1287 | if (dof) { | |||
1288 | if (bs < 0) {bs = bdof;} | |||
1289 | else if (bs != bdof) {bs = 1; if (!isMatIS) break;} | |||
1290 | } | |||
1291 | if (isMatIS) { | |||
1292 | PetscInt loff,c,off; | |||
1293 | ierr = PetscSectionGetOffset(subSection, p, &loff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1293,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1294 | ierr = PetscSectionGetOffset(sectionGlobal, p, &off);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 | for (c = 0; c < dof-cdof; ++c, ++lsize) ltogidx[loff+c] = off > -1 ? off+c : -(off+1)+c; | |||
1296 | } | |||
1297 | } | |||
1298 | /* Must have same blocksize on all procs (some might have no points) */ | |||
1299 | bsLocal[0] = bs < 0 ? PETSC_MAX_INT2147483647 : bs; bsLocal[1] = bs; | |||
1300 | ierr = PetscGlobalMinMaxInt(PetscObjectComm((PetscObject) dm), bsLocal, bsMinMax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1300,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1301 | if (bsMinMax[0] != bsMinMax[1]) {bs = 1;} | |||
1302 | else {bs = bsMinMax[0];} | |||
1303 | bs = bs < 0 ? 1 : bs; | |||
1304 | if (isMatIS) { | |||
1305 | PetscInt l; | |||
1306 | /* Must reduce indices by blocksize */ | |||
1307 | if (bs > 1) for (l = 0; l < lsize; ++l) ltogidx[l] /= bs; | |||
1308 | ierr = ISLocalToGlobalMappingCreate(PetscObjectComm((PetscObject)dm), bs, lsize, ltogidx, PETSC_OWN_POINTER, <og);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1308,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1309 | } | |||
1310 | ierr = MatSetLocalToGlobalMapping(*J,ltog,ltog);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1310,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1311 | if (isMatIS) { | |||
1312 | ierr = ISLocalToGlobalMappingDestroy(<og);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1312,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1313 | } | |||
1314 | ierr = PetscCalloc4(localSize/bs, &dnz, localSize/bs, &onz, localSize/bs, &dnzu, localSize/bs, &onzu)PetscMallocA(4,PETSC_TRUE,1314,__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),1314,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1315 | ierr = DMPlexPreallocateOperator(dm, bs, dnz, onz, dnzu, onzu, *J, fillMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1315,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1316 | ierr = PetscFree4(dnz, onz, dnzu, onzu)PetscFreeA(4,1316,__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),1316,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1317 | } | |||
1318 | ierr = MatSetDM(*J, dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1318,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1319 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1320 | } | |||
1321 | ||||
1322 | /*@ | |||
1323 | DMPlexGetSubdomainSection - Returns the section associated with the subdomain | |||
1324 | ||||
1325 | Not collective | |||
1326 | ||||
1327 | Input Parameter: | |||
1328 | . mesh - The DMPlex | |||
1329 | ||||
1330 | Output Parameters: | |||
1331 | . subsection - The subdomain section | |||
1332 | ||||
1333 | Level: developer | |||
1334 | ||||
1335 | .seealso: | |||
1336 | @*/ | |||
1337 | PetscErrorCode DMPlexGetSubdomainSection(DM dm, PetscSection *subsection) | |||
1338 | { | |||
1339 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
1340 | PetscErrorCode ierr; | |||
1341 | ||||
1342 | 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] = 1342; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1343 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1343,__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),1343 ,__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),1343,__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),1343,__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); | |||
1344 | if (!mesh->subdomainSection) { | |||
1345 | PetscSection section; | |||
1346 | PetscSF sf; | |||
1347 | ||||
1348 | ierr = PetscSFCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&sf);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 = DMGetSection(dm,§ion);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 = PetscSectionCreateGlobalSection(section,sf,PETSC_FALSE,PETSC_TRUE,&mesh->subdomainSection);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 = PetscSFDestroy(&sf);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 | } | |||
1353 | *subsection = mesh->subdomainSection; | |||
1354 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1355 | } | |||
1356 | ||||
1357 | /*@ | |||
1358 | DMPlexGetChart - Return the interval for all mesh points [pStart, pEnd) | |||
1359 | ||||
1360 | Not collective | |||
1361 | ||||
1362 | Input Parameter: | |||
1363 | . mesh - The DMPlex | |||
1364 | ||||
1365 | Output Parameters: | |||
1366 | + pStart - The first mesh point | |||
1367 | - pEnd - The upper bound for mesh points | |||
1368 | ||||
1369 | Level: beginner | |||
1370 | ||||
1371 | .seealso: DMPlexCreate(), DMPlexSetChart() | |||
1372 | @*/ | |||
1373 | PetscErrorCode DMPlexGetChart(DM dm, PetscInt *pStart, PetscInt *pEnd) | |||
1374 | { | |||
1375 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
1376 | PetscErrorCode ierr; | |||
1377 | ||||
1378 | 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] = 1378; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1379 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1379,__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),1379 ,__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),1379,__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),1379,__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); | |||
1380 | ierr = PetscSectionGetChart(mesh->coneSection, pStart, pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1380,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1381 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1382 | } | |||
1383 | ||||
1384 | /*@ | |||
1385 | DMPlexSetChart - Set the interval for all mesh points [pStart, pEnd) | |||
1386 | ||||
1387 | Not collective | |||
1388 | ||||
1389 | Input Parameters: | |||
1390 | + mesh - The DMPlex | |||
1391 | . pStart - The first mesh point | |||
1392 | - pEnd - The upper bound for mesh points | |||
1393 | ||||
1394 | Output Parameters: | |||
1395 | ||||
1396 | Level: beginner | |||
1397 | ||||
1398 | .seealso: DMPlexCreate(), DMPlexGetChart() | |||
1399 | @*/ | |||
1400 | PetscErrorCode DMPlexSetChart(DM dm, PetscInt pStart, PetscInt pEnd) | |||
1401 | { | |||
1402 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
1403 | PetscErrorCode ierr; | |||
1404 | ||||
1405 | 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] = 1405; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1406 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1406,__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),1406 ,__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),1406,__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),1406,__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); | |||
1407 | ierr = PetscSectionSetChart(mesh->coneSection, pStart, pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1407,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1408 | ierr = PetscSectionSetChart(mesh->supportSection, pStart, pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1408,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1409 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1410 | } | |||
1411 | ||||
1412 | /*@ | |||
1413 | DMPlexGetConeSize - Return the number of in-edges for this point in the DAG | |||
1414 | ||||
1415 | Not collective | |||
1416 | ||||
1417 | Input Parameters: | |||
1418 | + mesh - The DMPlex | |||
1419 | - p - The point, which must lie in the chart set with DMPlexSetChart() | |||
1420 | ||||
1421 | Output Parameter: | |||
1422 | . size - The cone size for point p | |||
1423 | ||||
1424 | Level: beginner | |||
1425 | ||||
1426 | .seealso: DMPlexCreate(), DMPlexSetConeSize(), DMPlexSetChart() | |||
1427 | @*/ | |||
1428 | PetscErrorCode DMPlexGetConeSize(DM dm, PetscInt p, PetscInt *size) | |||
1429 | { | |||
1430 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
1431 | PetscErrorCode ierr; | |||
1432 | ||||
1433 | 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] = 1433; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1434 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1434,__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),1434 ,__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),1434,__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),1434,__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); | |||
1435 | PetscValidPointer(size, 3)do { if (!size) return PetscError(((MPI_Comm)0x44000001),1435 ,__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),1435,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); | |||
1436 | ierr = PetscSectionGetDof(mesh->coneSection, p, size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1436,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1437 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1438 | } | |||
1439 | ||||
1440 | /*@ | |||
1441 | DMPlexSetConeSize - Set the number of in-edges for this point in the DAG | |||
1442 | ||||
1443 | Not collective | |||
1444 | ||||
1445 | Input Parameters: | |||
1446 | + mesh - The DMPlex | |||
1447 | . p - The point, which must lie in the chart set with DMPlexSetChart() | |||
1448 | - size - The cone size for point p | |||
1449 | ||||
1450 | Output Parameter: | |||
1451 | ||||
1452 | Note: | |||
1453 | This should be called after DMPlexSetChart(). | |||
1454 | ||||
1455 | Level: beginner | |||
1456 | ||||
1457 | .seealso: DMPlexCreate(), DMPlexGetConeSize(), DMPlexSetChart() | |||
1458 | @*/ | |||
1459 | PetscErrorCode DMPlexSetConeSize(DM dm, PetscInt p, PetscInt size) | |||
1460 | { | |||
1461 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
1462 | PetscErrorCode ierr; | |||
1463 | ||||
1464 | 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] = 1464; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1465 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1465,__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),1465 ,__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),1465,__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),1465,__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); | |||
1466 | ierr = PetscSectionSetDof(mesh->coneSection, p, size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1466,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1467 | ||||
1468 | mesh->maxConeSize = PetscMax(mesh->maxConeSize, size)(((mesh->maxConeSize)<(size)) ? (size) : (mesh->maxConeSize )); | |||
1469 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1470 | } | |||
1471 | ||||
1472 | /*@ | |||
1473 | DMPlexAddConeSize - Add the given number of in-edges to this point in the DAG | |||
1474 | ||||
1475 | Not collective | |||
1476 | ||||
1477 | Input Parameters: | |||
1478 | + mesh - The DMPlex | |||
1479 | . p - The point, which must lie in the chart set with DMPlexSetChart() | |||
1480 | - size - The additional cone size for point p | |||
1481 | ||||
1482 | Output Parameter: | |||
1483 | ||||
1484 | Note: | |||
1485 | This should be called after DMPlexSetChart(). | |||
1486 | ||||
1487 | Level: beginner | |||
1488 | ||||
1489 | .seealso: DMPlexCreate(), DMPlexSetConeSize(), DMPlexGetConeSize(), DMPlexSetChart() | |||
1490 | @*/ | |||
1491 | PetscErrorCode DMPlexAddConeSize(DM dm, PetscInt p, PetscInt size) | |||
1492 | { | |||
1493 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
1494 | PetscInt csize; | |||
1495 | PetscErrorCode ierr; | |||
1496 | ||||
1497 | 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] = 1497; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1498 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1498,__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),1498 ,__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),1498,__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),1498,__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); | |||
1499 | ierr = PetscSectionAddDof(mesh->coneSection, p, size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1499,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1500 | ierr = PetscSectionGetDof(mesh->coneSection, p, &csize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1500,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1501 | ||||
1502 | mesh->maxConeSize = PetscMax(mesh->maxConeSize, csize)(((mesh->maxConeSize)<(csize)) ? (csize) : (mesh->maxConeSize )); | |||
1503 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1504 | } | |||
1505 | ||||
1506 | /*@C | |||
1507 | DMPlexGetCone - Return the points on the in-edges for this point in the DAG | |||
1508 | ||||
1509 | Not collective | |||
1510 | ||||
1511 | Input Parameters: | |||
1512 | + dm - The DMPlex | |||
1513 | - p - The point, which must lie in the chart set with DMPlexSetChart() | |||
1514 | ||||
1515 | Output Parameter: | |||
1516 | . cone - An array of points which are on the in-edges for point p | |||
1517 | ||||
1518 | Level: beginner | |||
1519 | ||||
1520 | Fortran Notes: | |||
1521 | Since it returns an array, this routine is only available in Fortran 90, and you must | |||
1522 | include petsc.h90 in your code. | |||
1523 | You must also call DMPlexRestoreCone() after you finish using the returned array. | |||
1524 | DMPlexRestoreCone() is not needed/available in C. | |||
1525 | ||||
1526 | .seealso: DMPlexCreate(), DMPlexSetCone(), DMPlexGetConeTuple(), DMPlexSetChart() | |||
1527 | @*/ | |||
1528 | PetscErrorCode DMPlexGetCone(DM dm, PetscInt p, const PetscInt *cone[]) | |||
1529 | { | |||
1530 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
1531 | PetscInt off; | |||
1532 | PetscErrorCode ierr; | |||
1533 | ||||
1534 | 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] = 1534; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1535 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1535,__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),1535 ,__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),1535,__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),1535,__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); | |||
1536 | PetscValidPointer(cone, 3)do { if (!cone) return PetscError(((MPI_Comm)0x44000001),1536 ,__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),1536,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); | |||
1537 | ierr = PetscSectionGetOffset(mesh->coneSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1537,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1538 | *cone = &mesh->cones[off]; | |||
1539 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1540 | } | |||
1541 | ||||
1542 | /*@C | |||
1543 | DMPlexGetConeTuple - Return the points on the in-edges of several points in the DAG | |||
1544 | ||||
1545 | Not collective | |||
1546 | ||||
1547 | Input Parameters: | |||
1548 | + dm - The DMPlex | |||
1549 | - p - The IS of points, which must lie in the chart set with DMPlexSetChart() | |||
1550 | ||||
1551 | Output Parameter: | |||
1552 | + pConesSection - PetscSection describing the layout of pCones | |||
1553 | - pCones - An array of points which are on the in-edges for the point set p | |||
1554 | ||||
1555 | Level: intermediate | |||
1556 | ||||
1557 | .seealso: DMPlexCreate(), DMPlexGetCone(), DMPlexGetConeRecursive(), DMPlexSetChart() | |||
1558 | @*/ | |||
1559 | PetscErrorCode DMPlexGetConeTuple(DM dm, IS p, PetscSection *pConesSection, IS *pCones) | |||
1560 | { | |||
1561 | PetscSection cs, newcs; | |||
1562 | PetscInt *cones; | |||
1563 | PetscInt *newarr=NULL((void*)0); | |||
1564 | PetscInt n; | |||
1565 | PetscErrorCode ierr; | |||
1566 | ||||
1567 | 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] = 1567; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1568 | ierr = DMPlexGetCones(dm, &cones);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1568,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1569 | ierr = DMPlexGetConeSection(dm, &cs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1569,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1570 | 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),1570,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1571 | if (pConesSection) *pConesSection = newcs; | |||
1572 | if (pCones) { | |||
1573 | ierr = PetscSectionGetStorageSize(newcs, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1573,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1574 | ierr = ISCreateGeneral(PetscObjectComm((PetscObject)p), n, newarr, PETSC_OWN_POINTER, pCones);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1574,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1575 | } | |||
1576 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1577 | } | |||
1578 | ||||
1579 | static PetscErrorCode DMPlexGetConeRecursive_Private(DM dm, PetscInt *n_inout, const PetscInt points[], PetscInt *offset_inout, PetscInt buf[]) | |||
1580 | { | |||
1581 | PetscInt p, n, cn, i; | |||
1582 | const PetscInt *cone; | |||
1583 | PetscErrorCode ierr; | |||
1584 | ||||
1585 | 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] = 1585; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1586 | n = *n_inout; | |||
1587 | *n_inout = 0; | |||
1588 | for (i=0; i<n; i++) { | |||
1589 | p = points[i]; | |||
1590 | ierr = DMPlexGetConeSize(dm, p, &cn);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1590,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1591 | if (!cn) { | |||
1592 | cn = 1; | |||
1593 | if (buf) { | |||
1594 | buf[*offset_inout] = p; | |||
1595 | ++(*offset_inout); | |||
1596 | } | |||
1597 | } else { | |||
1598 | ierr = DMPlexGetCone(dm, p, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1598,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1599 | ierr = DMPlexGetConeRecursive_Private(dm, &cn, cone, offset_inout, buf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1599,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1600 | } | |||
1601 | *n_inout += cn; | |||
1602 | } | |||
1603 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1604 | } | |||
1605 | ||||
1606 | /*@C | |||
1607 | 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. | |||
1608 | ||||
1609 | Not collective | |||
1610 | ||||
1611 | Input Parameters: | |||
1612 | + dm - The DMPlex | |||
1613 | - p - The IS of points, which must lie in the chart set with DMPlexSetChart() | |||
1614 | ||||
1615 | Output Parameter: | |||
1616 | . pCones - An array of recursively expanded cones, i.e. containing only vertices, and each of them can be present multiple times | |||
1617 | ||||
1618 | Level: advanced | |||
1619 | ||||
1620 | .seealso: DMPlexCreate(), DMPlexGetCone(), DMPlexGetConeTuple() | |||
1621 | @*/ | |||
1622 | PetscErrorCode DMPlexGetConeRecursive(DM dm, IS p, IS *pCones) | |||
1623 | { | |||
1624 | const PetscInt *arr=NULL((void*)0); | |||
1625 | PetscInt *cpoints=NULL((void*)0); | |||
1626 | PetscInt n, cn; | |||
1627 | PetscInt zero; | |||
1628 | PetscErrorCode ierr; | |||
1629 | ||||
1630 | 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] = 1630; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1631 | ierr = ISGetLocalSize(p, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1631,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1632 | ierr = ISGetIndices(p, &arr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1632,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1633 | zero = 0; | |||
1634 | /* first figure out the total number of returned points */ | |||
1635 | cn = n; | |||
1636 | ierr = DMPlexGetConeRecursive_Private(dm, &cn, arr, &zero, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1636,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1637 | ierr = PetscMalloc1(cn, &cpoints)PetscMallocA(1,PETSC_FALSE,1637,__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),1637,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1638 | /* now get recursive cones themselves */ | |||
1639 | ierr = DMPlexGetConeRecursive_Private(dm, &n, arr, &zero, cpoints);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 = ISCreateGeneral(PetscObjectComm((PetscObject)p), n, cpoints, PETSC_OWN_POINTER, pCones);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 | ierr = ISRestoreIndices(p, &arr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1641,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1642 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1643 | } | |||
1644 | ||||
1645 | /*@ | |||
1646 | 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 | |||
1647 | ||||
1648 | Not collective | |||
1649 | ||||
1650 | Input Parameters: | |||
1651 | + mesh - The DMPlex | |||
1652 | . p - The point, which must lie in the chart set with DMPlexSetChart() | |||
1653 | - cone - An array of points which are on the in-edges for point p | |||
1654 | ||||
1655 | Output Parameter: | |||
1656 | ||||
1657 | Note: | |||
1658 | This should be called after all calls to DMPlexSetConeSize() and DMSetUp(). | |||
1659 | ||||
1660 | Developer Note: Why not call this DMPlexSetCover() | |||
1661 | ||||
1662 | Level: beginner | |||
1663 | ||||
1664 | .seealso: DMPlexCreate(), DMPlexGetCone(), DMPlexSetChart(), DMPlexSetConeSize(), DMSetUp(), DMPlexSetSupport(), DMPlexSetSupportSize() | |||
1665 | @*/ | |||
1666 | PetscErrorCode DMPlexSetCone(DM dm, PetscInt p, const PetscInt cone[]) | |||
1667 | { | |||
1668 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
1669 | PetscInt pStart, pEnd; | |||
1670 | PetscInt dof, off, c; | |||
1671 | PetscErrorCode ierr; | |||
1672 | ||||
1673 | 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] = 1673; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1674 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1674,__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),1674 ,__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),1674,__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),1674,__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); | |||
1675 | ierr = PetscSectionGetChart(mesh->coneSection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1675,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1676 | ierr = PetscSectionGetDof(mesh->coneSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1676,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1677 | if (dof) PetscValidPointer(cone, 3)do { if (!cone) return PetscError(((MPI_Comm)0x44000001),1677 ,__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),1677,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); | |||
1678 | ierr = PetscSectionGetOffset(mesh->coneSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1678,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1679 | 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),1679,__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); | |||
1680 | for (c = 0; c < dof; ++c) { | |||
1681 | 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),1681,__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); | |||
1682 | mesh->cones[off+c] = cone[c]; | |||
1683 | } | |||
1684 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1685 | } | |||
1686 | ||||
1687 | /*@C | |||
1688 | DMPlexGetConeOrientation - Return the orientations on the in-edges for this point in the DAG | |||
1689 | ||||
1690 | Not collective | |||
1691 | ||||
1692 | Input Parameters: | |||
1693 | + mesh - The DMPlex | |||
1694 | - p - The point, which must lie in the chart set with DMPlexSetChart() | |||
1695 | ||||
1696 | Output Parameter: | |||
1697 | . coneOrientation - An array of orientations which are on the in-edges for point p. An orientation is an | |||
1698 | integer giving the prescription for cone traversal. If it is negative, the cone is | |||
1699 | traversed in the opposite direction. Its value 'o', or if negative '-(o+1)', gives | |||
1700 | the index of the cone point on which to start. | |||
1701 | ||||
1702 | Level: beginner | |||
1703 | ||||
1704 | Fortran Notes: | |||
1705 | Since it returns an array, this routine is only available in Fortran 90, and you must | |||
1706 | include petsc.h90 in your code. | |||
1707 | You must also call DMPlexRestoreConeOrientation() after you finish using the returned array. | |||
1708 | DMPlexRestoreConeOrientation() is not needed/available in C. | |||
1709 | ||||
1710 | .seealso: DMPlexCreate(), DMPlexGetCone(), DMPlexSetCone(), DMPlexSetChart() | |||
1711 | @*/ | |||
1712 | PetscErrorCode DMPlexGetConeOrientation(DM dm, PetscInt p, const PetscInt *coneOrientation[]) | |||
1713 | { | |||
1714 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
1715 | PetscInt off; | |||
1716 | PetscErrorCode ierr; | |||
1717 | ||||
1718 | 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] = 1718; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1719 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1719,__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),1719 ,__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),1719,__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),1719,__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); | |||
1720 | #if defined(PETSC_USE_DEBUG1) | |||
1721 | { | |||
1722 | PetscInt dof; | |||
1723 | ierr = PetscSectionGetDof(mesh->coneSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1723,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1724 | if (dof) PetscValidPointer(coneOrientation, 3)do { if (!coneOrientation) return PetscError(((MPI_Comm)0x44000001 ),1724,__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),1724,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); | |||
1725 | } | |||
1726 | #endif | |||
1727 | ierr = PetscSectionGetOffset(mesh->coneSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1727,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1728 | ||||
1729 | *coneOrientation = &mesh->coneOrientations[off]; | |||
1730 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1731 | } | |||
1732 | ||||
1733 | /*@ | |||
1734 | DMPlexSetConeOrientation - Set the orientations on the in-edges for this point in the DAG | |||
1735 | ||||
1736 | Not collective | |||
1737 | ||||
1738 | Input Parameters: | |||
1739 | + mesh - The DMPlex | |||
1740 | . p - The point, which must lie in the chart set with DMPlexSetChart() | |||
1741 | - coneOrientation - An array of orientations which are on the in-edges for point p. An orientation is an | |||
1742 | integer giving the prescription for cone traversal. If it is negative, the cone is | |||
1743 | traversed in the opposite direction. Its value 'o', or if negative '-(o+1)', gives | |||
1744 | the index of the cone point on which to start. | |||
1745 | ||||
1746 | Output Parameter: | |||
1747 | ||||
1748 | Note: | |||
1749 | This should be called after all calls to DMPlexSetConeSize() and DMSetUp(). | |||
1750 | ||||
1751 | Level: beginner | |||
1752 | ||||
1753 | .seealso: DMPlexCreate(), DMPlexGetConeOrientation(), DMPlexSetCone(), DMPlexSetChart(), DMPlexSetConeSize(), DMSetUp() | |||
1754 | @*/ | |||
1755 | PetscErrorCode DMPlexSetConeOrientation(DM dm, PetscInt p, const PetscInt coneOrientation[]) | |||
1756 | { | |||
1757 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
1758 | PetscInt pStart, pEnd; | |||
1759 | PetscInt dof, off, c; | |||
1760 | PetscErrorCode ierr; | |||
1761 | ||||
1762 | 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] = 1762; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1763 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1763,__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),1763 ,__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),1763,__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),1763,__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); | |||
1764 | ierr = PetscSectionGetChart(mesh->coneSection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1764,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1765 | ierr = PetscSectionGetDof(mesh->coneSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1765,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1766 | if (dof) PetscValidPointer(coneOrientation, 3)do { if (!coneOrientation) return PetscError(((MPI_Comm)0x44000001 ),1766,__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),1766,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); | |||
1767 | ierr = PetscSectionGetOffset(mesh->coneSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1767,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1768 | 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),1768,__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); | |||
1769 | for (c = 0; c < dof; ++c) { | |||
1770 | PetscInt cdof, o = coneOrientation[c]; | |||
1771 | ||||
1772 | ierr = PetscSectionGetDof(mesh->coneSection, mesh->cones[off+c], &cdof);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 | 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),1773,__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); | |||
1774 | mesh->coneOrientations[off+c] = o; | |||
1775 | } | |||
1776 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1777 | } | |||
1778 | ||||
1779 | /*@ | |||
1780 | DMPlexInsertCone - Insert a point into the in-edges for the point p in the DAG | |||
1781 | ||||
1782 | Not collective | |||
1783 | ||||
1784 | Input Parameters: | |||
1785 | + mesh - The DMPlex | |||
1786 | . p - The point, which must lie in the chart set with DMPlexSetChart() | |||
1787 | . conePos - The local index in the cone where the point should be put | |||
1788 | - conePoint - The mesh point to insert | |||
1789 | ||||
1790 | Level: beginner | |||
1791 | ||||
1792 | .seealso: DMPlexCreate(), DMPlexGetCone(), DMPlexSetChart(), DMPlexSetConeSize(), DMSetUp() | |||
1793 | @*/ | |||
1794 | PetscErrorCode DMPlexInsertCone(DM dm, PetscInt p, PetscInt conePos, PetscInt conePoint) | |||
1795 | { | |||
1796 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
1797 | PetscInt pStart, pEnd; | |||
1798 | PetscInt dof, off; | |||
1799 | PetscErrorCode ierr; | |||
1800 | ||||
1801 | 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] = 1801; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1802 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1802,__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),1802 ,__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),1802,__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),1802,__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); | |||
1803 | ierr = PetscSectionGetChart(mesh->coneSection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1803,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1804 | 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),1804,__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); | |||
1805 | 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),1805,__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); | |||
1806 | ierr = PetscSectionGetDof(mesh->coneSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1806,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1807 | ierr = PetscSectionGetOffset(mesh->coneSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1807,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1808 | 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),1808,__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); | |||
1809 | mesh->cones[off+conePos] = conePoint; | |||
1810 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1811 | } | |||
1812 | ||||
1813 | /*@ | |||
1814 | DMPlexInsertConeOrientation - Insert a point orientation for the in-edge for the point p in the DAG | |||
1815 | ||||
1816 | Not collective | |||
1817 | ||||
1818 | Input Parameters: | |||
1819 | + mesh - The DMPlex | |||
1820 | . p - The point, which must lie in the chart set with DMPlexSetChart() | |||
1821 | . conePos - The local index in the cone where the point should be put | |||
1822 | - coneOrientation - The point orientation to insert | |||
1823 | ||||
1824 | Level: beginner | |||
1825 | ||||
1826 | .seealso: DMPlexCreate(), DMPlexGetCone(), DMPlexSetChart(), DMPlexSetConeSize(), DMSetUp() | |||
1827 | @*/ | |||
1828 | PetscErrorCode DMPlexInsertConeOrientation(DM dm, PetscInt p, PetscInt conePos, PetscInt coneOrientation) | |||
1829 | { | |||
1830 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
1831 | PetscInt pStart, pEnd; | |||
1832 | PetscInt dof, off; | |||
1833 | PetscErrorCode ierr; | |||
1834 | ||||
1835 | 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] = 1835; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1836 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1836,__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),1836 ,__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),1836,__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),1836,__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); | |||
1837 | ierr = PetscSectionGetChart(mesh->coneSection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1837,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1838 | 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),1838,__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); | |||
1839 | ierr = PetscSectionGetDof(mesh->coneSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1839,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1840 | ierr = PetscSectionGetOffset(mesh->coneSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1840,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1841 | 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),1841,__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); | |||
1842 | mesh->coneOrientations[off+conePos] = coneOrientation; | |||
1843 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1844 | } | |||
1845 | ||||
1846 | /*@ | |||
1847 | DMPlexGetSupportSize - Return the number of out-edges for this point in the DAG | |||
1848 | ||||
1849 | Not collective | |||
1850 | ||||
1851 | Input Parameters: | |||
1852 | + mesh - The DMPlex | |||
1853 | - p - The point, which must lie in the chart set with DMPlexSetChart() | |||
1854 | ||||
1855 | Output Parameter: | |||
1856 | . size - The support size for point p | |||
1857 | ||||
1858 | Level: beginner | |||
1859 | ||||
1860 | .seealso: DMPlexCreate(), DMPlexSetConeSize(), DMPlexSetChart(), DMPlexGetConeSize() | |||
1861 | @*/ | |||
1862 | PetscErrorCode DMPlexGetSupportSize(DM dm, PetscInt p, PetscInt *size) | |||
1863 | { | |||
1864 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
1865 | PetscErrorCode ierr; | |||
1866 | ||||
1867 | 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] = 1867; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1868 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1868,__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),1868 ,__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),1868,__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),1868,__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); | |||
1869 | PetscValidPointer(size, 3)do { if (!size) return PetscError(((MPI_Comm)0x44000001),1869 ,__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),1869,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); | |||
1870 | ierr = PetscSectionGetDof(mesh->supportSection, p, size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1870,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1871 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1872 | } | |||
1873 | ||||
1874 | /*@ | |||
1875 | DMPlexSetSupportSize - Set the number of out-edges for this point in the DAG | |||
1876 | ||||
1877 | Not collective | |||
1878 | ||||
1879 | Input Parameters: | |||
1880 | + mesh - The DMPlex | |||
1881 | . p - The point, which must lie in the chart set with DMPlexSetChart() | |||
1882 | - size - The support size for point p | |||
1883 | ||||
1884 | Output Parameter: | |||
1885 | ||||
1886 | Note: | |||
1887 | This should be called after DMPlexSetChart(). | |||
1888 | ||||
1889 | Level: beginner | |||
1890 | ||||
1891 | .seealso: DMPlexCreate(), DMPlexGetSupportSize(), DMPlexSetChart() | |||
1892 | @*/ | |||
1893 | PetscErrorCode DMPlexSetSupportSize(DM dm, PetscInt p, PetscInt size) | |||
1894 | { | |||
1895 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
1896 | PetscErrorCode ierr; | |||
1897 | ||||
1898 | 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] = 1898; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1899 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1899,__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),1899 ,__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),1899,__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),1899,__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); | |||
1900 | ierr = PetscSectionSetDof(mesh->supportSection, p, size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1900,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1901 | ||||
1902 | mesh->maxSupportSize = PetscMax(mesh->maxSupportSize, size)(((mesh->maxSupportSize)<(size)) ? (size) : (mesh->maxSupportSize )); | |||
1903 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1904 | } | |||
1905 | ||||
1906 | /*@C | |||
1907 | DMPlexGetSupport - Return the points on the out-edges for this point in the DAG | |||
1908 | ||||
1909 | Not collective | |||
1910 | ||||
1911 | Input Parameters: | |||
1912 | + mesh - The DMPlex | |||
1913 | - p - The point, which must lie in the chart set with DMPlexSetChart() | |||
1914 | ||||
1915 | Output Parameter: | |||
1916 | . support - An array of points which are on the out-edges for point p | |||
1917 | ||||
1918 | Level: beginner | |||
1919 | ||||
1920 | Fortran Notes: | |||
1921 | Since it returns an array, this routine is only available in Fortran 90, and you must | |||
1922 | include petsc.h90 in your code. | |||
1923 | You must also call DMPlexRestoreSupport() after you finish using the returned array. | |||
1924 | DMPlexRestoreSupport() is not needed/available in C. | |||
1925 | ||||
1926 | .seealso: DMPlexCreate(), DMPlexSetCone(), DMPlexSetChart(), DMPlexGetCone() | |||
1927 | @*/ | |||
1928 | PetscErrorCode DMPlexGetSupport(DM dm, PetscInt p, const PetscInt *support[]) | |||
1929 | { | |||
1930 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
1931 | PetscInt off; | |||
1932 | PetscErrorCode ierr; | |||
1933 | ||||
1934 | 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] = 1934; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1935 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1935,__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),1935 ,__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),1935,__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),1935,__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); | |||
1936 | PetscValidPointer(support, 3)do { if (!support) return PetscError(((MPI_Comm)0x44000001),1936 ,__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),1936,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); | |||
1937 | ierr = PetscSectionGetOffset(mesh->supportSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1937,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1938 | *support = &mesh->supports[off]; | |||
1939 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1940 | } | |||
1941 | ||||
1942 | /*@ | |||
1943 | DMPlexSetSupport - Set the points on the out-edges for this point in the DAG, that is the list of points that this point covers | |||
1944 | ||||
1945 | Not collective | |||
1946 | ||||
1947 | Input Parameters: | |||
1948 | + mesh - The DMPlex | |||
1949 | . p - The point, which must lie in the chart set with DMPlexSetChart() | |||
1950 | - support - An array of points which are on the out-edges for point p | |||
1951 | ||||
1952 | Output Parameter: | |||
1953 | ||||
1954 | Note: | |||
1955 | This should be called after all calls to DMPlexSetSupportSize() and DMSetUp(). | |||
1956 | ||||
1957 | Level: beginner | |||
1958 | ||||
1959 | .seealso: DMPlexSetCone(), DMPlexSetConeSize(), DMPlexCreate(), DMPlexGetSupport(), DMPlexSetChart(), DMPlexSetSupportSize(), DMSetUp() | |||
1960 | @*/ | |||
1961 | PetscErrorCode DMPlexSetSupport(DM dm, PetscInt p, const PetscInt support[]) | |||
1962 | { | |||
1963 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
1964 | PetscInt pStart, pEnd; | |||
1965 | PetscInt dof, off, c; | |||
1966 | PetscErrorCode ierr; | |||
1967 | ||||
1968 | 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] = 1968; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1969 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1969,__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),1969 ,__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),1969,__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),1969,__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); | |||
1970 | ierr = PetscSectionGetChart(mesh->supportSection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1970,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1971 | ierr = PetscSectionGetDof(mesh->supportSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1971,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1972 | if (dof) PetscValidPointer(support, 3)do { if (!support) return PetscError(((MPI_Comm)0x44000001),1972 ,__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),1972,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); | |||
1973 | ierr = PetscSectionGetOffset(mesh->supportSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1973,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1974 | 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),1974,__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); | |||
1975 | for (c = 0; c < dof; ++c) { | |||
1976 | 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),1976,__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); | |||
1977 | mesh->supports[off+c] = support[c]; | |||
1978 | } | |||
1979 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1980 | } | |||
1981 | ||||
1982 | /*@ | |||
1983 | DMPlexInsertSupport - Insert a point into the out-edges for the point p in the DAG | |||
1984 | ||||
1985 | Not collective | |||
1986 | ||||
1987 | Input Parameters: | |||
1988 | + mesh - The DMPlex | |||
1989 | . p - The point, which must lie in the chart set with DMPlexSetChart() | |||
1990 | . supportPos - The local index in the cone where the point should be put | |||
1991 | - supportPoint - The mesh point to insert | |||
1992 | ||||
1993 | Level: beginner | |||
1994 | ||||
1995 | .seealso: DMPlexCreate(), DMPlexGetCone(), DMPlexSetChart(), DMPlexSetConeSize(), DMSetUp() | |||
1996 | @*/ | |||
1997 | PetscErrorCode DMPlexInsertSupport(DM dm, PetscInt p, PetscInt supportPos, PetscInt supportPoint) | |||
1998 | { | |||
1999 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
2000 | PetscInt pStart, pEnd; | |||
2001 | PetscInt dof, off; | |||
2002 | PetscErrorCode ierr; | |||
2003 | ||||
2004 | 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] = 2004; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2005 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2005,__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),2005 ,__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),2005,__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),2005,__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); | |||
2006 | ierr = PetscSectionGetChart(mesh->supportSection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2006,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2007 | ierr = PetscSectionGetDof(mesh->supportSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2007,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2008 | ierr = PetscSectionGetOffset(mesh->supportSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2008,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2009 | 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),2009,__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); | |||
2010 | 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),2010,__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); | |||
2011 | 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),2011,__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); | |||
2012 | mesh->supports[off+supportPos] = supportPoint; | |||
2013 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2014 | } | |||
2015 | ||||
2016 | /*@C | |||
2017 | DMPlexGetTransitiveClosure - Return the points on the transitive closure of the in-edges or out-edges for this point in the DAG | |||
2018 | ||||
2019 | Not collective | |||
2020 | ||||
2021 | Input Parameters: | |||
2022 | + mesh - The DMPlex | |||
2023 | . p - The point, which must lie in the chart set with DMPlexSetChart() | |||
2024 | . useCone - PETSC_TRUE for in-edges, otherwise use out-edges | |||
2025 | - points - If points is NULL on input, internal storage will be returned, otherwise the provided array is used | |||
2026 | ||||
2027 | Output Parameters: | |||
2028 | + numPoints - The number of points in the closure, so points[] is of size 2*numPoints | |||
2029 | - points - The points and point orientations, interleaved as pairs [p0, o0, p1, o1, ...] | |||
2030 | ||||
2031 | Note: | |||
2032 | If using internal storage (points is NULL on input), each call overwrites the last output. | |||
2033 | ||||
2034 | Fortran Notes: | |||
2035 | Since it returns an array, this routine is only available in Fortran 90, and you must | |||
2036 | include petsc.h90 in your code. | |||
2037 | ||||
2038 | The numPoints argument is not present in the Fortran 90 binding since it is internal to the array. | |||
2039 | ||||
2040 | Level: beginner | |||
2041 | ||||
2042 | .seealso: DMPlexRestoreTransitiveClosure(), DMPlexCreate(), DMPlexSetCone(), DMPlexSetChart(), DMPlexGetCone() | |||
2043 | @*/ | |||
2044 | PetscErrorCode DMPlexGetTransitiveClosure(DM dm, PetscInt p, PetscBool useCone, PetscInt *numPoints, PetscInt *points[]) | |||
2045 | { | |||
2046 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
2047 | PetscInt *closure, *fifo; | |||
2048 | const PetscInt *tmp = NULL((void*)0), *tmpO = NULL((void*)0); | |||
2049 | PetscInt tmpSize, t; | |||
2050 | PetscInt depth = 0, maxSize; | |||
2051 | PetscInt closureSize = 2, fifoSize = 0, fifoStart = 0; | |||
2052 | PetscErrorCode ierr; | |||
2053 | ||||
2054 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack ->line[petscstack->currentsize] = 2054; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2055 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2055,__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),2055 ,__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),2055,__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),2055,__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); | |||
2056 | ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2056,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2057 | /* This is only 1-level */ | |||
2058 | if (useCone) { | |||
| ||||
2059 | ierr = DMPlexGetConeSize(dm, p, &tmpSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2059,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2060 | ierr = DMPlexGetCone(dm, p, &tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2060,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2061 | ierr = DMPlexGetConeOrientation(dm, p, &tmpO);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2061,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2062 | } else { | |||
2063 | ierr = DMPlexGetSupportSize(dm, p, &tmpSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2063,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2064 | ierr = DMPlexGetSupport(dm, p, &tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2064,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2065 | } | |||
2066 | if (depth == 1) { | |||
2067 | if (*points) { | |||
2068 | closure = *points; | |||
2069 | } else { | |||
2070 | maxSize = 2*(PetscMax(mesh->maxConeSize, mesh->maxSupportSize)(((mesh->maxConeSize)<(mesh->maxSupportSize)) ? (mesh ->maxSupportSize) : (mesh->maxConeSize))+1); | |||
2071 | ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2071,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2072 | } | |||
2073 | closure[0] = p; closure[1] = 0; | |||
2074 | for (t = 0; t < tmpSize; ++t, closureSize += 2) { | |||
2075 | closure[closureSize] = tmp[t]; | |||
2076 | closure[closureSize+1] = tmpO ? tmpO[t] : 0; | |||
2077 | } | |||
2078 | if (numPoints) *numPoints = closureSize/2; | |||
2079 | if (points) *points = closure; | |||
2080 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2081 | } | |||
2082 | { | |||
2083 | PetscInt c, coneSeries, s,supportSeries; | |||
2084 | ||||
2085 | c = mesh->maxConeSize; | |||
2086 | coneSeries = (c > 1) ? ((PetscPowInt(c,depth+1)-1)/(c-1)) : depth+1; | |||
2087 | s = mesh->maxSupportSize; | |||
2088 | supportSeries = (s > 1) ? ((PetscPowInt(s,depth+1)-1)/(s-1)) : depth+1; | |||
2089 | maxSize = 2*PetscMax(coneSeries,supportSeries)(((coneSeries)<(supportSeries)) ? (supportSeries) : (coneSeries )); | |||
2090 | } | |||
2091 | ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &fifo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2091,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2092 | if (*points) { | |||
2093 | closure = *points; | |||
2094 | } else { | |||
2095 | ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2095,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2096 | } | |||
2097 | closure[0] = p; closure[1] = 0; | |||
2098 | for (t = 0; t < tmpSize; ++t, closureSize += 2, fifoSize += 2) { | |||
2099 | const PetscInt cp = tmp[t]; | |||
2100 | const PetscInt co = tmpO ? tmpO[t] : 0; | |||
2101 | ||||
2102 | closure[closureSize] = cp; | |||
2103 | closure[closureSize+1] = co; | |||
2104 | fifo[fifoSize] = cp; | |||
2105 | fifo[fifoSize+1] = co; | |||
2106 | } | |||
2107 | /* Should kick out early when depth is reached, rather than checking all vertices for empty cones */ | |||
2108 | while (fifoSize - fifoStart) { | |||
2109 | const PetscInt q = fifo[fifoStart]; | |||
2110 | const PetscInt o = fifo[fifoStart+1]; | |||
2111 | const PetscInt rev = o >= 0 ? 0 : 1; | |||
2112 | const PetscInt off = rev ? -(o+1) : o; | |||
2113 | ||||
2114 | if (useCone) { | |||
2115 | ierr = DMPlexGetConeSize(dm, q, &tmpSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2115,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2116 | ierr = DMPlexGetCone(dm, q, &tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2116,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2117 | ierr = DMPlexGetConeOrientation(dm, q, &tmpO);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2117,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2118 | } else { | |||
2119 | ierr = DMPlexGetSupportSize(dm, q, &tmpSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2119,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2120 | ierr = DMPlexGetSupport(dm, q, &tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2120,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2121 | tmpO = NULL((void*)0); | |||
2122 | } | |||
2123 | for (t = 0; t < tmpSize; ++t) { | |||
2124 | const PetscInt i = ((rev ? tmpSize-t : t) + off)%tmpSize; | |||
2125 | const PetscInt cp = tmp[i]; | |||
2126 | /* Must propogate orientation: When we reverse orientation, we both reverse the direction of iteration and start at the other end of the chain. */ | |||
2127 | /* HACK: It is worse to get the size here, than to change the interpretation of -(*+1) | |||
2128 | const PetscInt co = tmpO ? (rev ? -(tmpO[i]+1) : tmpO[i]) : 0; */ | |||
2129 | PetscInt co = tmpO ? tmpO[i] : 0; | |||
2130 | PetscInt c; | |||
2131 | ||||
2132 | if (rev) { | |||
2133 | PetscInt childSize, coff; | |||
2134 | ierr = DMPlexGetConeSize(dm, cp, &childSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2134,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2135 | coff = tmpO[i] < 0 ? -(tmpO[i]+1) : tmpO[i]; | |||
| ||||
2136 | co = childSize ? -(((coff+childSize-1)%childSize)+1) : 0; | |||
2137 | } | |||
2138 | /* Check for duplicate */ | |||
2139 | for (c = 0; c < closureSize; c += 2) { | |||
2140 | if (closure[c] == cp) break; | |||
2141 | } | |||
2142 | if (c == closureSize) { | |||
2143 | closure[closureSize] = cp; | |||
2144 | closure[closureSize+1] = co; | |||
2145 | fifo[fifoSize] = cp; | |||
2146 | fifo[fifoSize+1] = co; | |||
2147 | closureSize += 2; | |||
2148 | fifoSize += 2; | |||
2149 | } | |||
2150 | } | |||
2151 | fifoStart += 2; | |||
2152 | } | |||
2153 | if (numPoints) *numPoints = closureSize/2; | |||
2154 | if (points) *points = closure; | |||
2155 | ierr = DMRestoreWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &fifo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2155,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2156 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2157 | } | |||
2158 | ||||
2159 | /*@C | |||
2160 | 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 | |||
2161 | ||||
2162 | Not collective | |||
2163 | ||||
2164 | Input Parameters: | |||
2165 | + mesh - The DMPlex | |||
2166 | . p - The point, which must lie in the chart set with DMPlexSetChart() | |||
2167 | . orientation - The orientation of the point | |||
2168 | . useCone - PETSC_TRUE for in-edges, otherwise use out-edges | |||
2169 | - points - If points is NULL on input, internal storage will be returned, otherwise the provided array is used | |||
2170 | ||||
2171 | Output Parameters: | |||
2172 | + numPoints - The number of points in the closure, so points[] is of size 2*numPoints | |||
2173 | - points - The points and point orientations, interleaved as pairs [p0, o0, p1, o1, ...] | |||
2174 | ||||
2175 | Note: | |||
2176 | If using internal storage (points is NULL on input), each call overwrites the last output. | |||
2177 | ||||
2178 | Fortran Notes: | |||
2179 | Since it returns an array, this routine is only available in Fortran 90, and you must | |||
2180 | include petsc.h90 in your code. | |||
2181 | ||||
2182 | The numPoints argument is not present in the Fortran 90 binding since it is internal to the array. | |||
2183 | ||||
2184 | Level: beginner | |||
2185 | ||||
2186 | .seealso: DMPlexRestoreTransitiveClosure(), DMPlexCreate(), DMPlexSetCone(), DMPlexSetChart(), DMPlexGetCone() | |||
2187 | @*/ | |||
2188 | PetscErrorCode DMPlexGetTransitiveClosure_Internal(DM dm, PetscInt p, PetscInt ornt, PetscBool useCone, PetscInt *numPoints, PetscInt *points[]) | |||
2189 | { | |||
2190 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
2191 | PetscInt *closure, *fifo; | |||
2192 | const PetscInt *tmp = NULL((void*)0), *tmpO = NULL((void*)0); | |||
2193 | PetscInt tmpSize, t; | |||
2194 | PetscInt depth = 0, maxSize; | |||
2195 | PetscInt closureSize = 2, fifoSize = 0, fifoStart = 0; | |||
2196 | PetscErrorCode ierr; | |||
2197 | ||||
2198 | 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] = 2198; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2199 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2199,__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),2199 ,__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),2199,__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),2199,__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); | |||
2200 | ierr = DMPlexGetDepth(dm, &depth);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 | /* This is only 1-level */ | |||
2202 | if (useCone) { | |||
2203 | ierr = DMPlexGetConeSize(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 = DMPlexGetCone(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 | ierr = DMPlexGetConeOrientation(dm, p, &tmpO);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2205,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2206 | } else { | |||
2207 | ierr = DMPlexGetSupportSize(dm, p, &tmpSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2207,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2208 | ierr = DMPlexGetSupport(dm, p, &tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2208,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2209 | } | |||
2210 | if (depth == 1) { | |||
2211 | if (*points) { | |||
2212 | closure = *points; | |||
2213 | } else { | |||
2214 | maxSize = 2*(PetscMax(mesh->maxConeSize, mesh->maxSupportSize)(((mesh->maxConeSize)<(mesh->maxSupportSize)) ? (mesh ->maxSupportSize) : (mesh->maxConeSize))+1); | |||
2215 | ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2215,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2216 | } | |||
2217 | closure[0] = p; closure[1] = ornt; | |||
2218 | for (t = 0; t < tmpSize; ++t, closureSize += 2) { | |||
2219 | const PetscInt i = ornt >= 0 ? (t+ornt)%tmpSize : (-(ornt+1) + tmpSize-t)%tmpSize; | |||
2220 | closure[closureSize] = tmp[i]; | |||
2221 | closure[closureSize+1] = tmpO ? tmpO[i] : 0; | |||
2222 | } | |||
2223 | if (numPoints) *numPoints = closureSize/2; | |||
2224 | if (points) *points = closure; | |||
2225 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2226 | } | |||
2227 | { | |||
2228 | PetscInt c, coneSeries, s,supportSeries; | |||
2229 | ||||
2230 | c = mesh->maxConeSize; | |||
2231 | coneSeries = (c > 1) ? ((PetscPowInt(c,depth+1)-1)/(c-1)) : depth+1; | |||
2232 | s = mesh->maxSupportSize; | |||
2233 | supportSeries = (s > 1) ? ((PetscPowInt(s,depth+1)-1)/(s-1)) : depth+1; | |||
2234 | maxSize = 2*PetscMax(coneSeries,supportSeries)(((coneSeries)<(supportSeries)) ? (supportSeries) : (coneSeries )); | |||
2235 | } | |||
2236 | ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &fifo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2236,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2237 | if (*points) { | |||
2238 | closure = *points; | |||
2239 | } else { | |||
2240 | ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2240,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2241 | } | |||
2242 | closure[0] = p; closure[1] = ornt; | |||
2243 | for (t = 0; t < tmpSize; ++t, closureSize += 2, fifoSize += 2) { | |||
2244 | const PetscInt i = ornt >= 0 ? (t+ornt)%tmpSize : (-(ornt+1) + tmpSize-t)%tmpSize; | |||
2245 | const PetscInt cp = tmp[i]; | |||
2246 | PetscInt co = tmpO ? tmpO[i] : 0; | |||
2247 | ||||
2248 | if (ornt < 0) { | |||
2249 | PetscInt childSize, coff; | |||
2250 | ierr = DMPlexGetConeSize(dm, cp, &childSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2250,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2251 | coff = co < 0 ? -(tmpO[i]+1) : tmpO[i]; | |||
2252 | co = childSize ? -(((coff+childSize-1)%childSize)+1) : 0; | |||
2253 | } | |||
2254 | closure[closureSize] = cp; | |||
2255 | closure[closureSize+1] = co; | |||
2256 | fifo[fifoSize] = cp; | |||
2257 | fifo[fifoSize+1] = co; | |||
2258 | } | |||
2259 | /* Should kick out early when depth is reached, rather than checking all vertices for empty cones */ | |||
2260 | while (fifoSize - fifoStart) { | |||
2261 | const PetscInt q = fifo[fifoStart]; | |||
2262 | const PetscInt o = fifo[fifoStart+1]; | |||
2263 | const PetscInt rev = o >= 0 ? 0 : 1; | |||
2264 | const PetscInt off = rev ? -(o+1) : o; | |||
2265 | ||||
2266 | if (useCone) { | |||
2267 | ierr = DMPlexGetConeSize(dm, q, &tmpSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2267,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2268 | ierr = DMPlexGetCone(dm, q, &tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2268,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2269 | ierr = DMPlexGetConeOrientation(dm, q, &tmpO);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2269,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2270 | } else { | |||
2271 | ierr = DMPlexGetSupportSize(dm, q, &tmpSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2271,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2272 | ierr = DMPlexGetSupport(dm, q, &tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2272,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2273 | tmpO = NULL((void*)0); | |||
2274 | } | |||
2275 | for (t = 0; t < tmpSize; ++t) { | |||
2276 | const PetscInt i = ((rev ? tmpSize-t : t) + off)%tmpSize; | |||
2277 | const PetscInt cp = tmp[i]; | |||
2278 | /* Must propogate orientation: When we reverse orientation, we both reverse the direction of iteration and start at the other end of the chain. */ | |||
2279 | /* HACK: It is worse to get the size here, than to change the interpretation of -(*+1) | |||
2280 | const PetscInt co = tmpO ? (rev ? -(tmpO[i]+1) : tmpO[i]) : 0; */ | |||
2281 | PetscInt co = tmpO ? tmpO[i] : 0; | |||
2282 | PetscInt c; | |||
2283 | ||||
2284 | if (rev) { | |||
2285 | PetscInt childSize, coff; | |||
2286 | ierr = DMPlexGetConeSize(dm, cp, &childSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2286,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2287 | coff = tmpO[i] < 0 ? -(tmpO[i]+1) : tmpO[i]; | |||
2288 | co = childSize ? -(((coff+childSize-1)%childSize)+1) : 0; | |||
2289 | } | |||
2290 | /* Check for duplicate */ | |||
2291 | for (c = 0; c < closureSize; c += 2) { | |||
2292 | if (closure[c] == cp) break; | |||
2293 | } | |||
2294 | if (c == closureSize) { | |||
2295 | closure[closureSize] = cp; | |||
2296 | closure[closureSize+1] = co; | |||
2297 | fifo[fifoSize] = cp; | |||
2298 | fifo[fifoSize+1] = co; | |||
2299 | closureSize += 2; | |||
2300 | fifoSize += 2; | |||
2301 | } | |||
2302 | } | |||
2303 | fifoStart += 2; | |||
2304 | } | |||
2305 | if (numPoints) *numPoints = closureSize/2; | |||
2306 | if (points) *points = closure; | |||
2307 | ierr = DMRestoreWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &fifo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2307,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2308 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2309 | } | |||
2310 | ||||
2311 | /*@C | |||
2312 | DMPlexRestoreTransitiveClosure - Restore the array of points on the transitive closure of the in-edges or out-edges for this point in the DAG | |||
2313 | ||||
2314 | Not collective | |||
2315 | ||||
2316 | Input Parameters: | |||
2317 | + mesh - The DMPlex | |||
2318 | . p - The point, which must lie in the chart set with DMPlexSetChart() | |||
2319 | . useCone - PETSC_TRUE for in-edges, otherwise use out-edges | |||
2320 | . numPoints - The number of points in the closure, so points[] is of size 2*numPoints, zeroed on exit | |||
2321 | - points - The points and point orientations, interleaved as pairs [p0, o0, p1, o1, ...], zeroed on exit | |||
2322 | ||||
2323 | Note: | |||
2324 | If not using internal storage (points is not NULL on input), this call is unnecessary | |||
2325 | ||||
2326 | Fortran Notes: | |||
2327 | Since it returns an array, this routine is only available in Fortran 90, and you must | |||
2328 | include petsc.h90 in your code. | |||
2329 | ||||
2330 | The numPoints argument is not present in the Fortran 90 binding since it is internal to the array. | |||
2331 | ||||
2332 | Level: beginner | |||
2333 | ||||
2334 | .seealso: DMPlexGetTransitiveClosure(), DMPlexCreate(), DMPlexSetCone(), DMPlexSetChart(), DMPlexGetCone() | |||
2335 | @*/ | |||
2336 | PetscErrorCode DMPlexRestoreTransitiveClosure(DM dm, PetscInt p, PetscBool useCone, PetscInt *numPoints, PetscInt *points[]) | |||
2337 | { | |||
2338 | PetscErrorCode ierr; | |||
2339 | ||||
2340 | 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] = 2340; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2341 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2341,__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),2341 ,__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),2341,__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),2341,__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); | |||
2342 | if (numPoints) PetscValidIntPointer(numPoints,4)do { if (!numPoints) return PetscError(((MPI_Comm)0x44000001) ,2342,__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),2342,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,4); } while (0); | |||
2343 | if (points) PetscValidPointer(points,5)do { if (!points) return PetscError(((MPI_Comm)0x44000001),2343 ,__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),2343,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",5); } while (0); | |||
2344 | ierr = DMRestoreWorkArray(dm, 0, MPIU_INT((MPI_Datatype)0x4c000405), points);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 | if (numPoints) *numPoints = 0; | |||
2346 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2347 | } | |||
2348 | ||||
2349 | /*@ | |||
2350 | DMPlexGetMaxSizes - Return the maximum number of in-edges (cone) and out-edges (support) for any point in the DAG | |||
2351 | ||||
2352 | Not collective | |||
2353 | ||||
2354 | Input Parameter: | |||
2355 | . mesh - The DMPlex | |||
2356 | ||||
2357 | Output Parameters: | |||
2358 | + maxConeSize - The maximum number of in-edges | |||
2359 | - maxSupportSize - The maximum number of out-edges | |||
2360 | ||||
2361 | Level: beginner | |||
2362 | ||||
2363 | .seealso: DMPlexCreate(), DMPlexSetConeSize(), DMPlexSetChart() | |||
2364 | @*/ | |||
2365 | PetscErrorCode DMPlexGetMaxSizes(DM dm, PetscInt *maxConeSize, PetscInt *maxSupportSize) | |||
2366 | { | |||
2367 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
2368 | ||||
2369 | 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] = 2369; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2370 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2370,__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),2370 ,__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),2370,__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),2370,__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); | |||
2371 | if (maxConeSize) *maxConeSize = mesh->maxConeSize; | |||
2372 | if (maxSupportSize) *maxSupportSize = mesh->maxSupportSize; | |||
2373 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2374 | } | |||
2375 | ||||
2376 | PetscErrorCode DMSetUp_Plex(DM dm) | |||
2377 | { | |||
2378 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
2379 | PetscInt size; | |||
2380 | PetscErrorCode ierr; | |||
2381 | ||||
2382 | 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] = 2382; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2383 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2383,__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),2383 ,__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),2383,__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),2383,__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); | |||
2384 | ierr = PetscSectionSetUp(mesh->coneSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2384,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2385 | ierr = PetscSectionGetStorageSize(mesh->coneSection, &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2385,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2386 | ierr = PetscMalloc1(size, &mesh->cones)PetscMallocA(1,PETSC_FALSE,2386,__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),2386,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2387 | ierr = PetscCalloc1(size, &mesh->coneOrientations)PetscMallocA(1,PETSC_TRUE,2387,__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),2387,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2388 | if (mesh->maxSupportSize) { | |||
2389 | ierr = PetscSectionSetUp(mesh->supportSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2389,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2390 | ierr = PetscSectionGetStorageSize(mesh->supportSection, &size);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 | ierr = PetscMalloc1(size, &mesh->supports)PetscMallocA(1,PETSC_FALSE,2391,__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),2391,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2392 | } | |||
2393 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2394 | } | |||
2395 | ||||
2396 | PetscErrorCode DMCreateSubDM_Plex(DM dm, PetscInt numFields, const PetscInt fields[], IS *is, DM *subdm) | |||
2397 | { | |||
2398 | PetscErrorCode ierr; | |||
2399 | ||||
2400 | 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] = 2400; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2401 | if (subdm) {ierr = DMClone(dm, subdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2401,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2402 | ierr = DMCreateSectionSubDM(dm, numFields, fields, is, subdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2402,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2403 | if (subdm) {(*subdm)->useNatural = dm->useNatural;} | |||
2404 | if (dm->useNatural && dm->sfMigration) { | |||
2405 | PetscSF sfMigrationInv,sfNatural; | |||
2406 | PetscSection section, sectionSeq; | |||
2407 | ||||
2408 | (*subdm)->sfMigration = dm->sfMigration; | |||
2409 | ierr = PetscObjectReference((PetscObject) dm->sfMigration);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 | ierr = DMGetSection((*subdm), §ion);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2410,__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),2410,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2411 | ierr = PetscSFCreateInverseSF((*subdm)->sfMigration, &sfMigrationInv);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 = PetscSectionCreate(PetscObjectComm((PetscObject) (*subdm)), §ionSeq);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 | ierr = PetscSFDistributeSection(sfMigrationInv, section, NULL((void*)0), sectionSeq);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2413,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2414 | ||||
2415 | ierr = DMPlexCreateGlobalToNaturalSF(*subdm, sectionSeq, (*subdm)->sfMigration, &sfNatural);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2415,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2416 | (*subdm)->sfNatural = sfNatural; | |||
2417 | ierr = PetscSectionDestroy(§ionSeq);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2417,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2418 | ierr = PetscSFDestroy(&sfMigrationInv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2418,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2419 | } | |||
2420 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2421 | } | |||
2422 | ||||
2423 | PetscErrorCode DMCreateSuperDM_Plex(DM dms[], PetscInt len, IS **is, DM *superdm) | |||
2424 | { | |||
2425 | PetscErrorCode ierr; | |||
2426 | PetscInt i = 0; | |||
2427 | ||||
2428 | 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] = 2428; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2429 | ierr = DMClone(dms[0], superdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2429,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2430 | ierr = DMCreateSectionSuperDM(dms, len, is, superdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2430,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2431 | (*superdm)->useNatural = PETSC_FALSE; | |||
2432 | for (i = 0; i < len; i++){ | |||
2433 | if (dms[i]->useNatural && dms[i]->sfMigration) { | |||
2434 | PetscSF sfMigrationInv,sfNatural; | |||
2435 | PetscSection section, sectionSeq; | |||
2436 | ||||
2437 | (*superdm)->sfMigration = dms[i]->sfMigration; | |||
2438 | ierr = PetscObjectReference((PetscObject) dms[i]->sfMigration);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2438,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2439 | (*superdm)->useNatural = PETSC_TRUE; | |||
2440 | ierr = DMGetSection((*superdm), §ion);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2440,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2441 | ierr = PetscSFCreateInverseSF((*superdm)->sfMigration, &sfMigrationInv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2441,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2442 | ierr = PetscSectionCreate(PetscObjectComm((PetscObject) (*superdm)), §ionSeq);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2442,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2443 | ierr = PetscSFDistributeSection(sfMigrationInv, section, NULL((void*)0), sectionSeq);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2443,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2444 | ||||
2445 | ierr = DMPlexCreateGlobalToNaturalSF(*superdm, sectionSeq, (*superdm)->sfMigration, &sfNatural);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2445,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2446 | (*superdm)->sfNatural = sfNatural; | |||
2447 | ierr = PetscSectionDestroy(§ionSeq);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 | ierr = PetscSFDestroy(&sfMigrationInv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2448,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2449 | break; | |||
2450 | } | |||
2451 | } | |||
2452 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2453 | } | |||
2454 | ||||
2455 | /*@ | |||
2456 | DMPlexSymmetrize - Create support (out-edge) information from cone (in-edge) information | |||
2457 | ||||
2458 | Not collective | |||
2459 | ||||
2460 | Input Parameter: | |||
2461 | . mesh - The DMPlex | |||
2462 | ||||
2463 | Output Parameter: | |||
2464 | ||||
2465 | Note: | |||
2466 | This should be called after all calls to DMPlexSetCone() | |||
2467 | ||||
2468 | Level: beginner | |||
2469 | ||||
2470 | .seealso: DMPlexCreate(), DMPlexSetChart(), DMPlexSetConeSize(), DMPlexSetCone() | |||
2471 | @*/ | |||
2472 | PetscErrorCode DMPlexSymmetrize(DM dm) | |||
2473 | { | |||
2474 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
2475 | PetscInt *offsets; | |||
2476 | PetscInt supportSize; | |||
2477 | PetscInt pStart, pEnd, p; | |||
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 (mesh->supports) SETERRQ(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "Supports were already setup in this DMPlex")return PetscError(PetscObjectComm((PetscObject)dm),2482,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",73, PETSC_ERROR_INITIAL,"Supports were already setup in this DMPlex" ); | |||
2483 | /* Calculate support sizes */ | |||
2484 | ierr = DMPlexGetChart(dm, &pStart, &pEnd);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 | for (p = pStart; p < pEnd; ++p) { | |||
2486 | PetscInt dof, off, c; | |||
2487 | ||||
2488 | ierr = PetscSectionGetDof(mesh->coneSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2488,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2489 | ierr = PetscSectionGetOffset(mesh->coneSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2489,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2490 | for (c = off; c < off+dof; ++c) { | |||
2491 | ierr = PetscSectionAddDof(mesh->supportSection, mesh->cones[c], 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2491,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2492 | } | |||
2493 | } | |||
2494 | for (p = pStart; p < pEnd; ++p) { | |||
2495 | PetscInt dof; | |||
2496 | ||||
2497 | ierr = PetscSectionGetDof(mesh->supportSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2497,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2498 | ||||
2499 | mesh->maxSupportSize = PetscMax(mesh->maxSupportSize, dof)(((mesh->maxSupportSize)<(dof)) ? (dof) : (mesh->maxSupportSize )); | |||
2500 | } | |||
2501 | ierr = PetscSectionSetUp(mesh->supportSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2501,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2502 | /* Calculate supports */ | |||
2503 | ierr = PetscSectionGetStorageSize(mesh->supportSection, &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2503,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2504 | ierr = PetscMalloc1(supportSize, &mesh->supports)PetscMallocA(1,PETSC_FALSE,2504,__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),2504,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2505 | ierr = PetscCalloc1(pEnd - pStart, &offsets)PetscMallocA(1,PETSC_TRUE,2505,__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),2505,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2506 | for (p = pStart; p < pEnd; ++p) { | |||
2507 | PetscInt dof, off, c; | |||
2508 | ||||
2509 | ierr = PetscSectionGetDof(mesh->coneSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2509,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2510 | ierr = PetscSectionGetOffset(mesh->coneSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2510,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2511 | for (c = off; c < off+dof; ++c) { | |||
2512 | const PetscInt q = mesh->cones[c]; | |||
2513 | PetscInt offS; | |||
2514 | ||||
2515 | ierr = PetscSectionGetOffset(mesh->supportSection, q, &offS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2515,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2516 | ||||
2517 | mesh->supports[offS+offsets[q]] = p; | |||
2518 | ++offsets[q]; | |||
2519 | } | |||
2520 | } | |||
2521 | ierr = PetscFree(offsets)((*PetscTrFree)((void*)(offsets),2521,__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),2521,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2522 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2523 | } | |||
2524 | ||||
2525 | static PetscErrorCode DMPlexCreateDimStratum(DM,DMLabel,DMLabel,PetscInt,PetscInt); | |||
2526 | ||||
2527 | /*@ | |||
2528 | DMPlexStratify - The DAG for most topologies is a graded poset (http://en.wikipedia.org/wiki/Graded_poset), and | |||
2529 | can be illustrated by a Hasse Diagram (a http://en.wikipedia.org/wiki/Hasse_diagram). The strata group all points of the | |||
2530 | same grade, and this function calculates the strata. This grade can be seen as the height (or depth) of the point in | |||
2531 | the DAG. | |||
2532 | ||||
2533 | Collective on dm | |||
2534 | ||||
2535 | Input Parameter: | |||
2536 | . mesh - The DMPlex | |||
2537 | ||||
2538 | Output Parameter: | |||
2539 | ||||
2540 | Notes: | |||
2541 | Concretely, DMPlexStratify() creates a new label named "depth" containing the dimension of each element: 0 for vertices, | |||
2542 | 1 for edges, and so on. The depth label can be accessed through DMPlexGetDepthLabel() or DMPlexGetDepthStratum(), or | |||
2543 | manually via DMGetLabel(). The height is defined implicitly by height = maxDimension - depth, and can be accessed | |||
2544 | via DMPlexGetHeightStratum(). For example, cells have height 0 and faces have height 1. | |||
2545 | ||||
2546 | DMPlexStratify() should be called after all calls to DMPlexSymmetrize() | |||
2547 | ||||
2548 | Level: beginner | |||
2549 | ||||
2550 | .seealso: DMPlexCreate(), DMPlexSymmetrize() | |||
2551 | @*/ | |||
2552 | PetscErrorCode DMPlexStratify(DM dm) | |||
2553 | { | |||
2554 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
2555 | DMLabel label; | |||
2556 | PetscInt pStart, pEnd, p; | |||
2557 | PetscInt numRoots = 0, numLeaves = 0; | |||
2558 | PetscInt cMax, fMax, eMax, vMax; | |||
2559 | PetscErrorCode ierr; | |||
2560 | ||||
2561 | 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] = 2561; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2562 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2562,__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),2562 ,__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),2562,__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),2562,__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); | |||
2563 | 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),2563,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2564 | /* Calculate depth */ | |||
2565 | ierr = DMPlexGetChart(dm, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2565,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2566 | ierr = DMCreateLabel(dm, "depth");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2566,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2567 | ierr = DMPlexGetDepthLabel(dm, &label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2567,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2568 | /* Initialize roots and count leaves */ | |||
2569 | for (p = pStart; p < pEnd; ++p) { | |||
2570 | PetscInt coneSize, supportSize; | |||
2571 | ||||
2572 | ierr = DMPlexGetConeSize(dm, p, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2572,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2573 | ierr = DMPlexGetSupportSize(dm, p, &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2573,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2574 | if (!coneSize && supportSize) { | |||
2575 | ++numRoots; | |||
2576 | ierr = DMLabelSetValue(label, p, 0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2576,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2577 | } else if (!supportSize && coneSize) { | |||
2578 | ++numLeaves; | |||
2579 | } else if (!supportSize && !coneSize) { | |||
2580 | /* Isolated points */ | |||
2581 | ierr = DMLabelSetValue(label, p, 0);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 | } | |||
2583 | } | |||
2584 | if (numRoots + numLeaves == (pEnd - pStart)) { | |||
2585 | for (p = pStart; p < pEnd; ++p) { | |||
2586 | PetscInt coneSize, supportSize; | |||
2587 | ||||
2588 | ierr = DMPlexGetConeSize(dm, p, &coneSize);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 | ierr = DMPlexGetSupportSize(dm, p, &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2589,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2590 | if (!supportSize && coneSize) { | |||
2591 | ierr = DMLabelSetValue(label, p, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2591,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2592 | } | |||
2593 | } | |||
2594 | } else { | |||
2595 | IS pointIS; | |||
2596 | PetscInt numPoints = 0, level = 0; | |||
2597 | ||||
2598 | ierr = DMLabelGetStratumIS(label, level, &pointIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2598,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2599 | if (pointIS) {ierr = ISGetLocalSize(pointIS, &numPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2599,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2600 | while (numPoints) { | |||
2601 | const PetscInt *points; | |||
2602 | const PetscInt newLevel = level+1; | |||
2603 | ||||
2604 | ierr = ISGetIndices(pointIS, &points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2604,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2605 | for (p = 0; p < numPoints; ++p) { | |||
2606 | const PetscInt point = points[p]; | |||
2607 | const PetscInt *support; | |||
2608 | PetscInt supportSize, s; | |||
2609 | ||||
2610 | ierr = DMPlexGetSupportSize(dm, point, &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2610,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2611 | ierr = DMPlexGetSupport(dm, point, &support);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2611,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2612 | for (s = 0; s < supportSize; ++s) { | |||
2613 | ierr = DMLabelSetValue(label, support[s], newLevel);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2613,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2614 | } | |||
2615 | } | |||
2616 | ierr = ISRestoreIndices(pointIS, &points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2616,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2617 | ++level; | |||
2618 | ierr = ISDestroy(&pointIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2618,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2619 | ierr = DMLabelGetStratumIS(label, level, &pointIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2619,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2620 | if (pointIS) {ierr = ISGetLocalSize(pointIS, &numPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2620,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2621 | else {numPoints = 0;} | |||
2622 | } | |||
2623 | ierr = ISDestroy(&pointIS);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 | } | |||
2625 | { /* just in case there is an empty process */ | |||
2626 | PetscInt numValues, maxValues = 0, v; | |||
2627 | ||||
2628 | ierr = DMLabelGetNumValues(label,&numValues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2628,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2629 | for (v = 0; v < numValues; v++) { | |||
2630 | IS pointIS; | |||
2631 | ||||
2632 | ierr = DMLabelGetStratumIS(label, v, &pointIS);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 | if (pointIS) { | |||
2634 | PetscInt min, max, numPoints; | |||
2635 | PetscInt start; | |||
2636 | PetscBool contig; | |||
2637 | ||||
2638 | ierr = ISGetLocalSize(pointIS, &numPoints);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 | ierr = ISGetMinMax(pointIS, &min, &max);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2639,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2640 | ierr = ISContiguousLocal(pointIS,min,max+1,&start,&contig);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2640,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2641 | if (start == 0 && contig) { | |||
2642 | ierr = ISDestroy(&pointIS);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 | ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),numPoints,min,1,&pointIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2643,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2644 | ierr = DMLabelSetStratumIS(label, v, pointIS);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 | } | |||
2646 | } | |||
2647 | ierr = ISDestroy(&pointIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2647,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2648 | } | |||
2649 | 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),2649,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2650 | for (v = numValues; v < maxValues; v++) { | |||
2651 | ierr = DMLabelAddStratum(label,v);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 | } | |||
2653 | } | |||
2654 | ierr = PetscObjectStateGet((PetscObject) label, &mesh->depthState);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2654,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2655 | ||||
2656 | ierr = DMPlexGetHybridBounds(dm, &cMax, &fMax, &eMax, &vMax);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 | if (cMax >= 0 || fMax >= 0 || eMax >= 0 || vMax >= 0) { | |||
2658 | DMLabel dimLabel; | |||
2659 | PetscInt dim; | |||
2660 | ||||
2661 | ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2661,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2662 | ierr = DMGetLabel(dm, "dim", &dimLabel);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 | if (!dimLabel) { | |||
2664 | ierr = DMCreateLabel(dm, "dim");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2664,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2665 | ierr = DMGetLabel(dm, "dim", &dimLabel);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2665,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2666 | } | |||
2667 | if (cMax >= 0) {ierr = DMPlexCreateDimStratum(dm, label, dimLabel, dim, cMax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2667,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2668 | if (fMax >= 0) {ierr = DMPlexCreateDimStratum(dm, label, dimLabel, dim - 1, fMax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2668,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2669 | if (eMax >= 0) {ierr = DMPlexCreateDimStratum(dm, label, dimLabel, 1, eMax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2669,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2670 | if (vMax >= 0) {ierr = DMPlexCreateDimStratum(dm, label, dimLabel, 0, vMax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2670,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2671 | } | |||
2672 | 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),2672,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2673 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; 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 | } | |||
2675 | ||||
2676 | /*@C | |||
2677 | DMPlexGetJoin - Get an array for the join of the set of points | |||
2678 | ||||
2679 | Not Collective | |||
2680 | ||||
2681 | Input Parameters: | |||
2682 | + dm - The DMPlex object | |||
2683 | . numPoints - The number of input points for the join | |||
2684 | - points - The input points | |||
2685 | ||||
2686 | Output Parameters: | |||
2687 | + numCoveredPoints - The number of points in the join | |||
2688 | - coveredPoints - The points in the join | |||
2689 | ||||
2690 | Level: intermediate | |||
2691 | ||||
2692 | Note: Currently, this is restricted to a single level join | |||
2693 | ||||
2694 | Fortran Notes: | |||
2695 | Since it returns an array, this routine is only available in Fortran 90, and you must | |||
2696 | include petsc.h90 in your code. | |||
2697 | ||||
2698 | The numCoveredPoints argument is not present in the Fortran 90 binding since it is internal to the array. | |||
2699 | ||||
2700 | .keywords: mesh | |||
2701 | .seealso: DMPlexRestoreJoin(), DMPlexGetMeet() | |||
2702 | @*/ | |||
2703 | PetscErrorCode DMPlexGetJoin(DM dm, PetscInt numPoints, const PetscInt points[], PetscInt *numCoveredPoints, const PetscInt **coveredPoints) | |||
2704 | { | |||
2705 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
2706 | PetscInt *join[2]; | |||
2707 | PetscInt joinSize, i = 0; | |||
2708 | PetscInt dof, off, p, c, m; | |||
2709 | PetscErrorCode ierr; | |||
2710 | ||||
2711 | 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] = 2711; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2712 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2712,__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),2712 ,__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),2712,__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),2712,__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); | |||
2713 | PetscValidIntPointer(points, 3)do { if (!points) return PetscError(((MPI_Comm)0x44000001),2713 ,__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),2713,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,3); } while (0); | |||
2714 | PetscValidIntPointer(numCoveredPoints, 4)do { if (!numCoveredPoints) return PetscError(((MPI_Comm)0x44000001 ),2714,__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),2714,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,4); } while (0); | |||
2715 | PetscValidPointer(coveredPoints, 5)do { if (!coveredPoints) return PetscError(((MPI_Comm)0x44000001 ),2715,__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),2715,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",5); } while (0); | |||
2716 | 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),2716,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2717 | 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),2717,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2718 | /* Copy in support of first point */ | |||
2719 | ierr = PetscSectionGetDof(mesh->supportSection, points[0], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2719,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2720 | ierr = PetscSectionGetOffset(mesh->supportSection, points[0], &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2720,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2721 | for (joinSize = 0; joinSize < dof; ++joinSize) { | |||
2722 | join[i][joinSize] = mesh->supports[off+joinSize]; | |||
2723 | } | |||
2724 | /* Check each successive support */ | |||
2725 | for (p = 1; p < numPoints; ++p) { | |||
2726 | PetscInt newJoinSize = 0; | |||
2727 | ||||
2728 | ierr = PetscSectionGetDof(mesh->supportSection, points[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2728,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2729 | ierr = PetscSectionGetOffset(mesh->supportSection, points[p], &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2729,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2730 | for (c = 0; c < dof; ++c) { | |||
2731 | const PetscInt point = mesh->supports[off+c]; | |||
2732 | ||||
2733 | for (m = 0; m < joinSize; ++m) { | |||
2734 | if (point == join[i][m]) { | |||
2735 | join[1-i][newJoinSize++] = point; | |||
2736 | break; | |||
2737 | } | |||
2738 | } | |||
2739 | } | |||
2740 | joinSize = newJoinSize; | |||
2741 | i = 1-i; | |||
2742 | } | |||
2743 | *numCoveredPoints = joinSize; | |||
2744 | *coveredPoints = join[i]; | |||
2745 | 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),2745,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2746 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2747 | } | |||
2748 | ||||
2749 | /*@C | |||
2750 | DMPlexRestoreJoin - Restore an array for the join of the set of points | |||
2751 | ||||
2752 | Not Collective | |||
2753 | ||||
2754 | Input Parameters: | |||
2755 | + dm - The DMPlex object | |||
2756 | . numPoints - The number of input points for the join | |||
2757 | - points - The input points | |||
2758 | ||||
2759 | Output Parameters: | |||
2760 | + numCoveredPoints - The number of points in the join | |||
2761 | - coveredPoints - The points in the join | |||
2762 | ||||
2763 | Fortran Notes: | |||
2764 | Since it returns an array, this routine is only available in Fortran 90, and you must | |||
2765 | include petsc.h90 in your code. | |||
2766 | ||||
2767 | The numCoveredPoints argument is not present in the Fortran 90 binding since it is internal to the array. | |||
2768 | ||||
2769 | Level: intermediate | |||
2770 | ||||
2771 | .keywords: mesh | |||
2772 | .seealso: DMPlexGetJoin(), DMPlexGetFullJoin(), DMPlexGetMeet() | |||
2773 | @*/ | |||
2774 | PetscErrorCode DMPlexRestoreJoin(DM dm, PetscInt numPoints, const PetscInt points[], PetscInt *numCoveredPoints, const PetscInt **coveredPoints) | |||
2775 | { | |||
2776 | PetscErrorCode ierr; | |||
2777 | ||||
2778 | 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] = 2778; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2779 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2779,__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),2779 ,__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),2779,__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),2779,__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); | |||
2780 | if (points) PetscValidIntPointer(points,3)do { if (!points) return PetscError(((MPI_Comm)0x44000001),2780 ,__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),2780,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,3); } while (0); | |||
2781 | if (numCoveredPoints) PetscValidIntPointer(numCoveredPoints,4)do { if (!numCoveredPoints) return PetscError(((MPI_Comm)0x44000001 ),2781,__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),2781,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,4); } while (0); | |||
2782 | PetscValidPointer(coveredPoints, 5)do { if (!coveredPoints) return PetscError(((MPI_Comm)0x44000001 ),2782,__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),2782,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",5); } while (0); | |||
2783 | ierr = DMRestoreWorkArray(dm, 0, MPIU_INT((MPI_Datatype)0x4c000405), (void*) coveredPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2783,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2784 | if (numCoveredPoints) *numCoveredPoints = 0; | |||
2785 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2786 | } | |||
2787 | ||||
2788 | /*@C | |||
2789 | DMPlexGetFullJoin - Get an array for the join of the set of points | |||
2790 | ||||
2791 | Not Collective | |||
2792 | ||||
2793 | Input Parameters: | |||
2794 | + dm - The DMPlex object | |||
2795 | . numPoints - The number of input points for the join | |||
2796 | - points - The input points | |||
2797 | ||||
2798 | Output Parameters: | |||
2799 | + numCoveredPoints - The number of points in the join | |||
2800 | - coveredPoints - The points in the join | |||
2801 | ||||
2802 | Fortran Notes: | |||
2803 | Since it returns an array, this routine is only available in Fortran 90, and you must | |||
2804 | include petsc.h90 in your code. | |||
2805 | ||||
2806 | The numCoveredPoints argument is not present in the Fortran 90 binding since it is internal to the array. | |||
2807 | ||||
2808 | Level: intermediate | |||
2809 | ||||
2810 | .keywords: mesh | |||
2811 | .seealso: DMPlexGetJoin(), DMPlexRestoreJoin(), DMPlexGetMeet() | |||
2812 | @*/ | |||
2813 | PetscErrorCode DMPlexGetFullJoin(DM dm, PetscInt numPoints, const PetscInt points[], PetscInt *numCoveredPoints, const PetscInt **coveredPoints) | |||
2814 | { | |||
2815 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
2816 | PetscInt *offsets, **closures; | |||
2817 | PetscInt *join[2]; | |||
2818 | PetscInt depth = 0, maxSize, joinSize = 0, i = 0; | |||
2819 | PetscInt p, d, c, m, ms; | |||
2820 | PetscErrorCode ierr; | |||
2821 | ||||
2822 | 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] = 2822; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2823 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2823,__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),2823 ,__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),2823,__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),2823,__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); | |||
2824 | PetscValidIntPointer(points, 3)do { if (!points) return PetscError(((MPI_Comm)0x44000001),2824 ,__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),2824,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,3); } while (0); | |||
2825 | PetscValidIntPointer(numCoveredPoints, 4)do { if (!numCoveredPoints) return PetscError(((MPI_Comm)0x44000001 ),2825,__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),2825,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,4); } while (0); | |||
2826 | PetscValidPointer(coveredPoints, 5)do { if (!coveredPoints) return PetscError(((MPI_Comm)0x44000001 ),2826,__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),2826,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",5); } while (0); | |||
2827 | ||||
2828 | ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2828,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2829 | ierr = PetscCalloc1(numPoints, &closures)PetscMallocA(1,PETSC_TRUE,2829,__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),2829,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2830 | 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),2830,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2831 | ms = mesh->maxSupportSize; | |||
2832 | maxSize = (ms > 1) ? ((PetscPowInt(ms,depth+1)-1)/(ms-1)) : depth + 1; | |||
2833 | ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &join[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2833,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2834 | ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &join[1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2834,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2835 | ||||
2836 | for (p = 0; p < numPoints; ++p) { | |||
2837 | PetscInt closureSize; | |||
2838 | ||||
2839 | ierr = DMPlexGetTransitiveClosure(dm, points[p], PETSC_FALSE, &closureSize, &closures[p]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2839,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2840 | ||||
2841 | offsets[p*(depth+2)+0] = 0; | |||
2842 | for (d = 0; d < depth+1; ++d) { | |||
2843 | PetscInt pStart, pEnd, i; | |||
2844 | ||||
2845 | ierr = DMPlexGetDepthStratum(dm, d, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2845,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2846 | for (i = offsets[p*(depth+2)+d]; i < closureSize; ++i) { | |||
2847 | if ((pStart > closures[p][i*2]) || (pEnd <= closures[p][i*2])) { | |||
2848 | offsets[p*(depth+2)+d+1] = i; | |||
2849 | break; | |||
2850 | } | |||
2851 | } | |||
2852 | if (i == closureSize) offsets[p*(depth+2)+d+1] = i; | |||
2853 | } | |||
2854 | 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),2854,__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); | |||
2855 | } | |||
2856 | for (d = 0; d < depth+1; ++d) { | |||
2857 | PetscInt dof; | |||
2858 | ||||
2859 | /* Copy in support of first point */ | |||
2860 | dof = offsets[d+1] - offsets[d]; | |||
2861 | for (joinSize = 0; joinSize < dof; ++joinSize) { | |||
2862 | join[i][joinSize] = closures[0][(offsets[d]+joinSize)*2]; | |||
2863 | } | |||
2864 | /* Check each successive cone */ | |||
2865 | for (p = 1; p < numPoints && joinSize; ++p) { | |||
2866 | PetscInt newJoinSize = 0; | |||
2867 | ||||
2868 | dof = offsets[p*(depth+2)+d+1] - offsets[p*(depth+2)+d]; | |||
2869 | for (c = 0; c < dof; ++c) { | |||
2870 | const PetscInt point = closures[p][(offsets[p*(depth+2)+d]+c)*2]; | |||
2871 | ||||
2872 | for (m = 0; m < joinSize; ++m) { | |||
2873 | if (point == join[i][m]) { | |||
2874 | join[1-i][newJoinSize++] = point; | |||
2875 | break; | |||
2876 | } | |||
2877 | } | |||
2878 | } | |||
2879 | joinSize = newJoinSize; | |||
2880 | i = 1-i; | |||
2881 | } | |||
2882 | if (joinSize) break; | |||
2883 | } | |||
2884 | *numCoveredPoints = joinSize; | |||
2885 | *coveredPoints = join[i]; | |||
2886 | for (p = 0; p < numPoints; ++p) { | |||
2887 | 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),2887,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2888 | } | |||
2889 | ierr = PetscFree(closures)((*PetscTrFree)((void*)(closures),2889,__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),2889,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2890 | 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),2890,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2891 | 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),2891,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2892 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2893 | } | |||
2894 | ||||
2895 | /*@C | |||
2896 | DMPlexGetMeet - Get an array for the meet of the set of points | |||
2897 | ||||
2898 | Not Collective | |||
2899 | ||||
2900 | Input Parameters: | |||
2901 | + dm - The DMPlex object | |||
2902 | . numPoints - The number of input points for the meet | |||
2903 | - points - The input points | |||
2904 | ||||
2905 | Output Parameters: | |||
2906 | + numCoveredPoints - The number of points in the meet | |||
2907 | - coveredPoints - The points in the meet | |||
2908 | ||||
2909 | Level: intermediate | |||
2910 | ||||
2911 | Note: Currently, this is restricted to a single level meet | |||
2912 | ||||
2913 | Fortran Notes: | |||
2914 | Since it returns an array, this routine is only available in Fortran 90, and you must | |||
2915 | include petsc.h90 in your code. | |||
2916 | ||||
2917 | The numCoveredPoints argument is not present in the Fortran 90 binding since it is internal to the array. | |||
2918 | ||||
2919 | .keywords: mesh | |||
2920 | .seealso: DMPlexRestoreMeet(), DMPlexGetJoin() | |||
2921 | @*/ | |||
2922 | PetscErrorCode DMPlexGetMeet(DM dm, PetscInt numPoints, const PetscInt points[], PetscInt *numCoveringPoints, const PetscInt **coveringPoints) | |||
2923 | { | |||
2924 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
2925 | PetscInt *meet[2]; | |||
2926 | PetscInt meetSize, i = 0; | |||
2927 | PetscInt dof, off, p, c, m; | |||
2928 | PetscErrorCode ierr; | |||
2929 | ||||
2930 | 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] = 2930; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2931 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2931,__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),2931 ,__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),2931,__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),2931,__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); | |||
2932 | PetscValidPointer(points, 2)do { if (!points) 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",2); if (!PetscCheckPointer(points,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",2); } while (0); | |||
2933 | PetscValidPointer(numCoveringPoints, 3)do { if (!numCoveringPoints) return PetscError(((MPI_Comm)0x44000001 ),2933,__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),2933,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); | |||
2934 | PetscValidPointer(coveringPoints, 4)do { if (!coveringPoints) return PetscError(((MPI_Comm)0x44000001 ),2934,__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),2934,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",4); } while (0); | |||
2935 | 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),2935,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2936 | 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),2936,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2937 | /* Copy in cone of first point */ | |||
2938 | ierr = PetscSectionGetDof(mesh->coneSection, points[0], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2938,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2939 | ierr = PetscSectionGetOffset(mesh->coneSection, points[0], &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2939,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2940 | for (meetSize = 0; meetSize < dof; ++meetSize) { | |||
2941 | meet[i][meetSize] = mesh->cones[off+meetSize]; | |||
2942 | } | |||
2943 | /* Check each successive cone */ | |||
2944 | for (p = 1; p < numPoints; ++p) { | |||
2945 | PetscInt newMeetSize = 0; | |||
2946 | ||||
2947 | ierr = PetscSectionGetDof(mesh->coneSection, points[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2947,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2948 | ierr = PetscSectionGetOffset(mesh->coneSection, points[p], &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2948,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2949 | for (c = 0; c < dof; ++c) { | |||
2950 | const PetscInt point = mesh->cones[off+c]; | |||
2951 | ||||
2952 | for (m = 0; m < meetSize; ++m) { | |||
2953 | if (point == meet[i][m]) { | |||
2954 | meet[1-i][newMeetSize++] = point; | |||
2955 | break; | |||
2956 | } | |||
2957 | } | |||
2958 | } | |||
2959 | meetSize = newMeetSize; | |||
2960 | i = 1-i; | |||
2961 | } | |||
2962 | *numCoveringPoints = meetSize; | |||
2963 | *coveringPoints = meet[i]; | |||
2964 | 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),2964,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2965 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2966 | } | |||
2967 | ||||
2968 | /*@C | |||
2969 | DMPlexRestoreMeet - Restore an array for the meet of the set of points | |||
2970 | ||||
2971 | Not Collective | |||
2972 | ||||
2973 | Input Parameters: | |||
2974 | + dm - The DMPlex object | |||
2975 | . numPoints - The number of input points for the meet | |||
2976 | - points - The input points | |||
2977 | ||||
2978 | Output Parameters: | |||
2979 | + numCoveredPoints - The number of points in the meet | |||
2980 | - coveredPoints - The points in the meet | |||
2981 | ||||
2982 | Level: intermediate | |||
2983 | ||||
2984 | Fortran Notes: | |||
2985 | Since it returns an array, this routine is only available in Fortran 90, and you must | |||
2986 | include petsc.h90 in your code. | |||
2987 | ||||
2988 | The numCoveredPoints argument is not present in the Fortran 90 binding since it is internal to the array. | |||
2989 | ||||
2990 | .keywords: mesh | |||
2991 | .seealso: DMPlexGetMeet(), DMPlexGetFullMeet(), DMPlexGetJoin() | |||
2992 | @*/ | |||
2993 | PetscErrorCode DMPlexRestoreMeet(DM dm, PetscInt numPoints, const PetscInt points[], PetscInt *numCoveredPoints, const PetscInt **coveredPoints) | |||
2994 | { | |||
2995 | PetscErrorCode ierr; | |||
2996 | ||||
2997 | 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] = 2997; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2998 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2998,__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),2998 ,__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),2998,__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),2998,__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); | |||
2999 | if (points) PetscValidIntPointer(points,3)do { if (!points) return PetscError(((MPI_Comm)0x44000001),2999 ,__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),2999,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,3); } while (0); | |||
3000 | if (numCoveredPoints) PetscValidIntPointer(numCoveredPoints,4)do { if (!numCoveredPoints) return PetscError(((MPI_Comm)0x44000001 ),3000,__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),3000,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,4); } while (0); | |||
3001 | PetscValidPointer(coveredPoints,5)do { if (!coveredPoints) return PetscError(((MPI_Comm)0x44000001 ),3001,__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),3001,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",5); } while (0); | |||
3002 | ierr = DMRestoreWorkArray(dm, 0, MPIU_INT((MPI_Datatype)0x4c000405), (void*) coveredPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3002,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3003 | if (numCoveredPoints) *numCoveredPoints = 0; | |||
3004 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3005 | } | |||
3006 | ||||
3007 | /*@C | |||
3008 | DMPlexGetFullMeet - Get an array for the meet of the set of points | |||
3009 | ||||
3010 | Not Collective | |||
3011 | ||||
3012 | Input Parameters: | |||
3013 | + dm - The DMPlex object | |||
3014 | . numPoints - The number of input points for the meet | |||
3015 | - points - The input points | |||
3016 | ||||
3017 | Output Parameters: | |||
3018 | + numCoveredPoints - The number of points in the meet | |||
3019 | - coveredPoints - The points in the meet | |||
3020 | ||||
3021 | Level: intermediate | |||
3022 | ||||
3023 | Fortran Notes: | |||
3024 | Since it returns an array, this routine is only available in Fortran 90, and you must | |||
3025 | include petsc.h90 in your code. | |||
3026 | ||||
3027 | The numCoveredPoints argument is not present in the Fortran 90 binding since it is internal to the array. | |||
3028 | ||||
3029 | .keywords: mesh | |||
3030 | .seealso: DMPlexGetMeet(), DMPlexRestoreMeet(), DMPlexGetJoin() | |||
3031 | @*/ | |||
3032 | PetscErrorCode DMPlexGetFullMeet(DM dm, PetscInt numPoints, const PetscInt points[], PetscInt *numCoveredPoints, const PetscInt **coveredPoints) | |||
3033 | { | |||
3034 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
3035 | PetscInt *offsets, **closures; | |||
3036 | PetscInt *meet[2]; | |||
3037 | PetscInt height = 0, maxSize, meetSize = 0, i = 0; | |||
3038 | PetscInt p, h, c, m, mc; | |||
3039 | PetscErrorCode ierr; | |||
3040 | ||||
3041 | 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] = 3041; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3042 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3042,__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),3042 ,__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),3042,__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),3042,__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); | |||
3043 | PetscValidPointer(points, 2)do { if (!points) return PetscError(((MPI_Comm)0x44000001),3043 ,__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),3043,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); | |||
3044 | PetscValidPointer(numCoveredPoints, 3)do { if (!numCoveredPoints) return PetscError(((MPI_Comm)0x44000001 ),3044,__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),3044,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); | |||
3045 | PetscValidPointer(coveredPoints, 4)do { if (!coveredPoints) return PetscError(((MPI_Comm)0x44000001 ),3045,__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),3045,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",4); } while (0); | |||
3046 | ||||
3047 | ierr = DMPlexGetDepth(dm, &height);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3047,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3048 | ierr = PetscMalloc1(numPoints, &closures)PetscMallocA(1,PETSC_FALSE,3048,__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),3048,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3049 | 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),3049,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3050 | mc = mesh->maxConeSize; | |||
3051 | maxSize = (mc > 1) ? ((PetscPowInt(mc,height+1)-1)/(mc-1)) : height + 1; | |||
3052 | ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &meet[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3052,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3053 | ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &meet[1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3053,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3054 | ||||
3055 | for (p = 0; p < numPoints; ++p) { | |||
3056 | PetscInt closureSize; | |||
3057 | ||||
3058 | ierr = DMPlexGetTransitiveClosure(dm, points[p], PETSC_TRUE, &closureSize, &closures[p]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3058,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3059 | ||||
3060 | offsets[p*(height+2)+0] = 0; | |||
3061 | for (h = 0; h < height+1; ++h) { | |||
3062 | PetscInt pStart, pEnd, i; | |||
3063 | ||||
3064 | ierr = DMPlexGetHeightStratum(dm, h, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3064,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3065 | for (i = offsets[p*(height+2)+h]; i < closureSize; ++i) { | |||
3066 | if ((pStart > closures[p][i*2]) || (pEnd <= closures[p][i*2])) { | |||
3067 | offsets[p*(height+2)+h+1] = i; | |||
3068 | break; | |||
3069 | } | |||
3070 | } | |||
3071 | if (i == closureSize) offsets[p*(height+2)+h+1] = i; | |||
3072 | } | |||
3073 | 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),3073,__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); | |||
3074 | } | |||
3075 | for (h = 0; h < height+1; ++h) { | |||
3076 | PetscInt dof; | |||
3077 | ||||
3078 | /* Copy in cone of first point */ | |||
3079 | dof = offsets[h+1] - offsets[h]; | |||
3080 | for (meetSize = 0; meetSize < dof; ++meetSize) { | |||
3081 | meet[i][meetSize] = closures[0][(offsets[h]+meetSize)*2]; | |||
3082 | } | |||
3083 | /* Check each successive cone */ | |||
3084 | for (p = 1; p < numPoints && meetSize; ++p) { | |||
3085 | PetscInt newMeetSize = 0; | |||
3086 | ||||
3087 | dof = offsets[p*(height+2)+h+1] - offsets[p*(height+2)+h]; | |||
3088 | for (c = 0; c < dof; ++c) { | |||
3089 | const PetscInt point = closures[p][(offsets[p*(height+2)+h]+c)*2]; | |||
3090 | ||||
3091 | for (m = 0; m < meetSize; ++m) { | |||
3092 | if (point == meet[i][m]) { | |||
3093 | meet[1-i][newMeetSize++] = point; | |||
3094 | break; | |||
3095 | } | |||
3096 | } | |||
3097 | } | |||
3098 | meetSize = newMeetSize; | |||
3099 | i = 1-i; | |||
3100 | } | |||
3101 | if (meetSize) break; | |||
3102 | } | |||
3103 | *numCoveredPoints = meetSize; | |||
3104 | *coveredPoints = meet[i]; | |||
3105 | for (p = 0; p < numPoints; ++p) { | |||
3106 | 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),3106,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3107 | } | |||
3108 | ierr = PetscFree(closures)((*PetscTrFree)((void*)(closures),3108,__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),3108,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3109 | 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),3109,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3110 | 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),3110,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3111 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3112 | } | |||
3113 | ||||
3114 | /*@C | |||
3115 | DMPlexEqual - Determine if two DMs have the same topology | |||
3116 | ||||
3117 | Not Collective | |||
3118 | ||||
3119 | Input Parameters: | |||
3120 | + dmA - A DMPlex object | |||
3121 | - dmB - A DMPlex object | |||
3122 | ||||
3123 | Output Parameters: | |||
3124 | . equal - PETSC_TRUE if the topologies are identical | |||
3125 | ||||
3126 | Level: intermediate | |||
3127 | ||||
3128 | Notes: | |||
3129 | We are not solving graph isomorphism, so we do not permutation. | |||
3130 | ||||
3131 | .keywords: mesh | |||
3132 | .seealso: DMPlexGetCone() | |||
3133 | @*/ | |||
3134 | PetscErrorCode DMPlexEqual(DM dmA, DM dmB, PetscBool *equal) | |||
3135 | { | |||
3136 | PetscInt depth, depthB, pStart, pEnd, pStartB, pEndB, p; | |||
3137 | PetscErrorCode ierr; | |||
3138 | ||||
3139 | 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] = 3139; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3140 | PetscValidHeaderSpecific(dmA, DM_CLASSID, 1)do { if (!dmA) return PetscError(((MPI_Comm)0x44000001),3140, __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),3140,__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),3140,__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),3140,__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); | |||
3141 | PetscValidHeaderSpecific(dmB, DM_CLASSID, 2)do { if (!dmB) return PetscError(((MPI_Comm)0x44000001),3141, __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),3141,__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),3141,__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),3141,__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); | |||
3142 | PetscValidPointer(equal, 3)do { if (!equal) return PetscError(((MPI_Comm)0x44000001),3142 ,__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),3142,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); | |||
3143 | ||||
3144 | *equal = PETSC_FALSE; | |||
3145 | ierr = DMPlexGetDepth(dmA, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3145,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3146 | ierr = DMPlexGetDepth(dmB, &depthB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3146,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3147 | 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); | |||
3148 | ierr = DMPlexGetChart(dmA, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3148,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3149 | ierr = DMPlexGetChart(dmB, &pStartB, &pEndB);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 ((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); | |||
3151 | for (p = pStart; p < pEnd; ++p) { | |||
3152 | const PetscInt *cone, *coneB, *ornt, *orntB, *support, *supportB; | |||
3153 | PetscInt coneSize, coneSizeB, c, supportSize, supportSizeB, s; | |||
3154 | ||||
3155 | ierr = DMPlexGetConeSize(dmA, p, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3155,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3156 | ierr = DMPlexGetCone(dmA, p, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3156,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3157 | ierr = DMPlexGetConeOrientation(dmA, p, &ornt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3157,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3158 | ierr = DMPlexGetConeSize(dmB, p, &coneSizeB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3158,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3159 | ierr = DMPlexGetCone(dmB, p, &coneB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3159,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3160 | ierr = DMPlexGetConeOrientation(dmB, p, &orntB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3160,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3161 | 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); | |||
3162 | for (c = 0; c < coneSize; ++c) { | |||
3163 | 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); | |||
3164 | 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); | |||
3165 | } | |||
3166 | ierr = DMPlexGetSupportSize(dmA, p, &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3166,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3167 | ierr = DMPlexGetSupport(dmA, p, &support);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3167,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3168 | ierr = DMPlexGetSupportSize(dmB, p, &supportSizeB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3168,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3169 | ierr = DMPlexGetSupport(dmB, p, &supportB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3169,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3170 | 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); | |||
3171 | for (s = 0; s < supportSize; ++s) { | |||
3172 | 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); | |||
3173 | } | |||
3174 | } | |||
3175 | *equal = PETSC_TRUE; | |||
3176 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3177 | } | |||
3178 | ||||
3179 | /*@C | |||
3180 | DMPlexGetNumFaceVertices - Returns the number of vertices on a face | |||
3181 | ||||
3182 | Not Collective | |||
3183 | ||||
3184 | Input Parameters: | |||
3185 | + dm - The DMPlex | |||
3186 | . cellDim - The cell dimension | |||
3187 | - numCorners - The number of vertices on a cell | |||
3188 | ||||
3189 | Output Parameters: | |||
3190 | . numFaceVertices - The number of vertices on a face | |||
3191 | ||||
3192 | Level: developer | |||
3193 | ||||
3194 | Notes: | |||
3195 | Of course this can only work for a restricted set of symmetric shapes | |||
3196 | ||||
3197 | .seealso: DMPlexGetCone() | |||
3198 | @*/ | |||
3199 | PetscErrorCode DMPlexGetNumFaceVertices(DM dm, PetscInt cellDim, PetscInt numCorners, PetscInt *numFaceVertices) | |||
3200 | { | |||
3201 | MPI_Comm comm; | |||
3202 | PetscErrorCode ierr; | |||
3203 | ||||
3204 | 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] = 3204; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3205 | ierr = PetscObjectGetComm((PetscObject)dm,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3205,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3206 | PetscValidPointer(numFaceVertices,3)do { if (!numFaceVertices) return PetscError(((MPI_Comm)0x44000001 ),3206,__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),3206,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); | |||
3207 | switch (cellDim) { | |||
3208 | case 0: | |||
3209 | *numFaceVertices = 0; | |||
3210 | break; | |||
3211 | case 1: | |||
3212 | *numFaceVertices = 1; | |||
3213 | break; | |||
3214 | case 2: | |||
3215 | switch (numCorners) { | |||
3216 | case 3: /* triangle */ | |||
3217 | *numFaceVertices = 2; /* Edge has 2 vertices */ | |||
3218 | break; | |||
3219 | case 4: /* quadrilateral */ | |||
3220 | *numFaceVertices = 2; /* Edge has 2 vertices */ | |||
3221 | break; | |||
3222 | case 6: /* quadratic triangle, tri and quad cohesive Lagrange cells */ | |||
3223 | *numFaceVertices = 3; /* Edge has 3 vertices */ | |||
3224 | break; | |||
3225 | case 9: /* quadratic quadrilateral, quadratic quad cohesive Lagrange cells */ | |||
3226 | *numFaceVertices = 3; /* Edge has 3 vertices */ | |||
3227 | break; | |||
3228 | default: | |||
3229 | SETERRQ2(comm, PETSC_ERR_ARG_OUTOFRANGE, "Invalid number of face corners %D for dimension %D", numCorners, cellDim)return PetscError(comm,3229,__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); | |||
3230 | } | |||
3231 | break; | |||
3232 | case 3: | |||
3233 | switch (numCorners) { | |||
3234 | case 4: /* tetradehdron */ | |||
3235 | *numFaceVertices = 3; /* Face has 3 vertices */ | |||
3236 | break; | |||
3237 | case 6: /* tet cohesive cells */ | |||
3238 | *numFaceVertices = 4; /* Face has 4 vertices */ | |||
3239 | break; | |||
3240 | case 8: /* hexahedron */ | |||
3241 | *numFaceVertices = 4; /* Face has 4 vertices */ | |||
3242 | break; | |||
3243 | case 9: /* tet cohesive Lagrange cells */ | |||
3244 | *numFaceVertices = 6; /* Face has 6 vertices */ | |||
3245 | break; | |||
3246 | case 10: /* quadratic tetrahedron */ | |||
3247 | *numFaceVertices = 6; /* Face has 6 vertices */ | |||
3248 | break; | |||
3249 | case 12: /* hex cohesive Lagrange cells */ | |||
3250 | *numFaceVertices = 6; /* Face has 6 vertices */ | |||
3251 | break; | |||
3252 | case 18: /* quadratic tet cohesive Lagrange cells */ | |||
3253 | *numFaceVertices = 6; /* Face has 6 vertices */ | |||
3254 | break; | |||
3255 | case 27: /* quadratic hexahedron, quadratic hex cohesive Lagrange cells */ | |||
3256 | *numFaceVertices = 9; /* Face has 9 vertices */ | |||
3257 | break; | |||
3258 | default: | |||
3259 | SETERRQ2(comm, PETSC_ERR_ARG_OUTOFRANGE, "Invalid number of face corners %D for dimension %D", numCorners, cellDim)return PetscError(comm,3259,__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); | |||
3260 | } | |||
3261 | break; | |||
3262 | default: | |||
3263 | SETERRQ1(comm, PETSC_ERR_ARG_OUTOFRANGE, "Invalid cell dimension %D", cellDim)return PetscError(comm,3263,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,63,PETSC_ERROR_INITIAL,"Invalid cell dimension %D",cellDim); | |||
3264 | } | |||
3265 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3266 | } | |||
3267 | ||||
3268 | /*@ | |||
3269 | DMPlexGetDepthLabel - Get the DMLabel recording the depth of each point | |||
3270 | ||||
3271 | Not Collective | |||
3272 | ||||
3273 | Input Parameter: | |||
3274 | . dm - The DMPlex object | |||
3275 | ||||
3276 | Output Parameter: | |||
3277 | . depthLabel - The DMLabel recording point depth | |||
3278 | ||||
3279 | Level: developer | |||
3280 | ||||
3281 | .keywords: mesh, points | |||
3282 | .seealso: DMPlexGetDepth(), DMPlexGetHeightStratum(), DMPlexGetDepthStratum() | |||
3283 | @*/ | |||
3284 | PetscErrorCode DMPlexGetDepthLabel(DM dm, DMLabel *depthLabel) | |||
3285 | { | |||
3286 | PetscErrorCode ierr; | |||
3287 | ||||
3288 | 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] = 3288; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3289 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3289,__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),3289 ,__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),3289,__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),3289,__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); | |||
3290 | PetscValidPointer(depthLabel, 2)do { if (!depthLabel) return PetscError(((MPI_Comm)0x44000001 ),3290,__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),3290,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); | |||
3291 | if (!dm->depthLabel) {ierr = DMGetLabel(dm, "depth", &dm->depthLabel);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 | *depthLabel = dm->depthLabel; | |||
3293 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3294 | } | |||
3295 | ||||
3296 | /*@ | |||
3297 | DMPlexGetDepth - Get the depth of the DAG representing this mesh | |||
3298 | ||||
3299 | Not Collective | |||
3300 | ||||
3301 | Input Parameter: | |||
3302 | . dm - The DMPlex object | |||
3303 | ||||
3304 | Output Parameter: | |||
3305 | . depth - The number of strata (breadth first levels) in the DAG | |||
3306 | ||||
3307 | Level: developer | |||
3308 | ||||
3309 | .keywords: mesh, points | |||
3310 | .seealso: DMPlexGetDepthLabel(), DMPlexGetHeightStratum(), DMPlexGetDepthStratum() | |||
3311 | @*/ | |||
3312 | PetscErrorCode DMPlexGetDepth(DM dm, PetscInt *depth) | |||
3313 | { | |||
3314 | DMLabel label; | |||
3315 | PetscInt d = 0; | |||
3316 | PetscErrorCode ierr; | |||
3317 | ||||
3318 | 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] = 3318; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3319 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3319,__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),3319 ,__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),3319,__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),3319,__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); | |||
3320 | PetscValidPointer(depth, 2)do { if (!depth) return PetscError(((MPI_Comm)0x44000001),3320 ,__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),3320,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); | |||
3321 | ierr = DMPlexGetDepthLabel(dm, &label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3321,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3322 | if (label) {ierr = DMLabelGetNumValues(label, &d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3322,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3323 | *depth = d-1; | |||
3324 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3325 | } | |||
3326 | ||||
3327 | /*@ | |||
3328 | DMPlexGetDepthStratum - Get the bounds [start, end) for all points at a certain depth. | |||
3329 | ||||
3330 | Not Collective | |||
3331 | ||||
3332 | Input Parameters: | |||
3333 | + dm - The DMPlex object | |||
3334 | - stratumValue - The requested depth | |||
3335 | ||||
3336 | Output Parameters: | |||
3337 | + start - The first point at this depth | |||
3338 | - end - One beyond the last point at this depth | |||
3339 | ||||
3340 | Level: developer | |||
3341 | ||||
3342 | .keywords: mesh, points | |||
3343 | .seealso: DMPlexGetHeightStratum(), DMPlexGetDepth() | |||
3344 | @*/ | |||
3345 | PetscErrorCode DMPlexGetDepthStratum(DM dm, PetscInt stratumValue, PetscInt *start, PetscInt *end) | |||
3346 | { | |||
3347 | DMLabel label; | |||
3348 | PetscInt pStart, pEnd; | |||
3349 | PetscErrorCode ierr; | |||
3350 | ||||
3351 | 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] = 3351; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3352 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3352,__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),3352 ,__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),3352,__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),3352,__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); | |||
3353 | if (start) {PetscValidPointer(start, 3)do { if (!start) return PetscError(((MPI_Comm)0x44000001),3353 ,__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),3353,__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;} | |||
3354 | if (end) {PetscValidPointer(end, 4)do { if (!end) return PetscError(((MPI_Comm)0x44000001),3354, __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),3354,__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;} | |||
3355 | ierr = DMPlexGetChart(dm, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3355,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3356 | 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); | |||
3357 | if (stratumValue < 0) { | |||
3358 | if (start) *start = pStart; | |||
3359 | if (end) *end = pEnd; | |||
3360 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3361 | } | |||
3362 | ierr = DMPlexGetDepthLabel(dm, &label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3362,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3363 | if (!label) SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_ARG_WRONG, "No label named depth was found")return PetscError(PetscObjectComm((PetscObject) dm),3363,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62, PETSC_ERROR_INITIAL,"No label named depth was found"); | |||
3364 | ierr = DMLabelGetStratumBounds(label, stratumValue, start, end);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3364,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3365 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3366 | } | |||
3367 | ||||
3368 | /*@ | |||
3369 | DMPlexGetHeightStratum - Get the bounds [start, end) for all points at a certain height. | |||
3370 | ||||
3371 | Not Collective | |||
3372 | ||||
3373 | Input Parameters: | |||
3374 | + dm - The DMPlex object | |||
3375 | - stratumValue - The requested height | |||
3376 | ||||
3377 | Output Parameters: | |||
3378 | + start - The first point at this height | |||
3379 | - end - One beyond the last point at this height | |||
3380 | ||||
3381 | Level: developer | |||
3382 | ||||
3383 | .keywords: mesh, points | |||
3384 | .seealso: DMPlexGetDepthStratum(), DMPlexGetDepth() | |||
3385 | @*/ | |||
3386 | PetscErrorCode DMPlexGetHeightStratum(DM dm, PetscInt stratumValue, PetscInt *start, PetscInt *end) | |||
3387 | { | |||
3388 | DMLabel label; | |||
3389 | PetscInt depth, pStart, pEnd; | |||
3390 | PetscErrorCode ierr; | |||
3391 | ||||
3392 | 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] = 3392; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3393 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3393,__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),3393 ,__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),3393,__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),3393,__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); | |||
3394 | if (start) {PetscValidPointer(start, 3)do { if (!start) return PetscError(((MPI_Comm)0x44000001),3394 ,__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),3394,__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;} | |||
3395 | if (end) {PetscValidPointer(end, 4)do { if (!end) return PetscError(((MPI_Comm)0x44000001),3395, __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),3395,__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;} | |||
3396 | ierr = DMPlexGetChart(dm, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3396,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3397 | 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); | |||
3398 | if (stratumValue < 0) { | |||
3399 | if (start) *start = pStart; | |||
3400 | if (end) *end = pEnd; | |||
3401 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3402 | } | |||
3403 | ierr = DMPlexGetDepthLabel(dm, &label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3403,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3404 | if (!label) SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_ARG_WRONG, "No label named depth was found")return PetscError(PetscObjectComm((PetscObject) dm),3404,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62, PETSC_ERROR_INITIAL,"No label named depth was found"); | |||
3405 | ierr = DMLabelGetNumValues(label, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3405,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3406 | ierr = DMLabelGetStratumBounds(label, depth-1-stratumValue, start, end);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3406,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3407 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3408 | } | |||
3409 | ||||
3410 | PetscErrorCode DMCreateCoordinateDM_Plex(DM dm, DM *cdm) | |||
3411 | { | |||
3412 | PetscSection section, s; | |||
3413 | Mat m; | |||
3414 | PetscInt maxHeight; | |||
3415 | PetscErrorCode ierr; | |||
3416 | ||||
3417 | 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] = 3417; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3418 | ierr = DMClone(dm, cdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3418,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3419 | ierr = DMPlexGetMaxProjectionHeight(dm, &maxHeight);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3419,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3420 | ierr = DMPlexSetMaxProjectionHeight(*cdm, maxHeight);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3420,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3421 | ierr = PetscSectionCreate(PetscObjectComm((PetscObject)dm), §ion);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3421,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3422 | ierr = DMSetSection(*cdm, section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3422,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3423 | ierr = PetscSectionDestroy(§ion);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3423,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3424 | ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3424,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3425 | ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3425,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3426 | ierr = DMSetDefaultConstraints(*cdm, s, m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3426,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3427 | ierr = PetscSectionDestroy(&s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3427,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3428 | ierr = MatDestroy(&m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3428,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3429 | ||||
3430 | ierr = DMSetNumFields(*cdm, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3430,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3431 | ierr = DMCreateDS(*cdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3431,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3432 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3433 | } | |||
3434 | ||||
3435 | PetscErrorCode DMCreateCoordinateField_Plex(DM dm, DMField *field) | |||
3436 | { | |||
3437 | Vec coordsLocal; | |||
3438 | DM coordsDM; | |||
3439 | PetscErrorCode ierr; | |||
3440 | ||||
3441 | 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] = 3441; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3442 | *field = NULL((void*)0); | |||
3443 | ierr = DMGetCoordinatesLocal(dm,&coordsLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3443,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3444 | ierr = DMGetCoordinateDM(dm,&coordsDM);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3444,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3445 | if (coordsLocal && coordsDM) { | |||
3446 | ierr = DMFieldCreateDS(coordsDM, 0, coordsLocal, field);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3446,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3447 | } | |||
3448 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3449 | } | |||
3450 | ||||
3451 | /*@C | |||
3452 | DMPlexGetConeSection - Return a section which describes the layout of cone data | |||
3453 | ||||
3454 | Not Collective | |||
3455 | ||||
3456 | Input Parameters: | |||
3457 | . dm - The DMPlex object | |||
3458 | ||||
3459 | Output Parameter: | |||
3460 | . section - The PetscSection object | |||
3461 | ||||
3462 | Level: developer | |||
3463 | ||||
3464 | .seealso: DMPlexGetSupportSection(), DMPlexGetCones(), DMPlexGetConeOrientations() | |||
3465 | @*/ | |||
3466 | PetscErrorCode DMPlexGetConeSection(DM dm, PetscSection *section) | |||
3467 | { | |||
3468 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
3469 | ||||
3470 | 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] = 3470; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3471 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3471,__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),3471 ,__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),3471,__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),3471,__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); | |||
3472 | if (section) *section = mesh->coneSection; | |||
3473 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3474 | } | |||
3475 | ||||
3476 | /*@C | |||
3477 | DMPlexGetSupportSection - Return a section which describes the layout of support data | |||
3478 | ||||
3479 | Not Collective | |||
3480 | ||||
3481 | Input Parameters: | |||
3482 | . dm - The DMPlex object | |||
3483 | ||||
3484 | Output Parameter: | |||
3485 | . section - The PetscSection object | |||
3486 | ||||
3487 | Level: developer | |||
3488 | ||||
3489 | .seealso: DMPlexGetConeSection() | |||
3490 | @*/ | |||
3491 | PetscErrorCode DMPlexGetSupportSection(DM dm, PetscSection *section) | |||
3492 | { | |||
3493 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
3494 | ||||
3495 | 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] = 3495; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3496 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3496,__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),3496 ,__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),3496,__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),3496,__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); | |||
3497 | if (section) *section = mesh->supportSection; | |||
3498 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3499 | } | |||
3500 | ||||
3501 | /*@C | |||
3502 | DMPlexGetCones - Return cone data | |||
3503 | ||||
3504 | Not Collective | |||
3505 | ||||
3506 | Input Parameters: | |||
3507 | . dm - The DMPlex object | |||
3508 | ||||
3509 | Output Parameter: | |||
3510 | . cones - The cone for each point | |||
3511 | ||||
3512 | Level: developer | |||
3513 | ||||
3514 | .seealso: DMPlexGetConeSection() | |||
3515 | @*/ | |||
3516 | PetscErrorCode DMPlexGetCones(DM dm, PetscInt *cones[]) | |||
3517 | { | |||
3518 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
3519 | ||||
3520 | 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] = 3520; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3521 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3521,__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),3521 ,__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),3521,__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),3521,__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); | |||
3522 | if (cones) *cones = mesh->cones; | |||
3523 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3524 | } | |||
3525 | ||||
3526 | /*@C | |||
3527 | DMPlexGetConeOrientations - Return cone orientation data | |||
3528 | ||||
3529 | Not Collective | |||
3530 | ||||
3531 | Input Parameters: | |||
3532 | . dm - The DMPlex object | |||
3533 | ||||
3534 | Output Parameter: | |||
3535 | . coneOrientations - The cone orientation for each point | |||
3536 | ||||
3537 | Level: developer | |||
3538 | ||||
3539 | .seealso: DMPlexGetConeSection() | |||
3540 | @*/ | |||
3541 | PetscErrorCode DMPlexGetConeOrientations(DM dm, PetscInt *coneOrientations[]) | |||
3542 | { | |||
3543 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
3544 | ||||
3545 | 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] = 3545; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3546 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3546,__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),3546 ,__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),3546,__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),3546,__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); | |||
3547 | if (coneOrientations) *coneOrientations = mesh->coneOrientations; | |||
3548 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; 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 | } | |||
3550 | ||||
3551 | /******************************** FEM Support **********************************/ | |||
3552 | ||||
3553 | PetscErrorCode DMPlexCreateSpectralClosurePermutation(DM dm, PetscInt point, PetscSection section) | |||
3554 | { | |||
3555 | DMLabel label; | |||
3556 | PetscInt *perm; | |||
3557 | PetscInt dim, depth, eStart, k, Nf, f, Nc, c, i, j, size = 0, offset = 0, foffset = 0; | |||
3558 | PetscErrorCode ierr; | |||
3559 | ||||
3560 | 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] = 3560; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3561 | if (point < 0) {ierr = DMPlexGetDepthStratum(dm, 1, &point, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3561,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3562 | ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3562,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3563 | ierr = DMPlexGetDepthLabel(dm, &label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3563,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3564 | ierr = DMLabelGetValue(label, point, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3564,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3565 | if (depth == 1) {eStart = point;} | |||
3566 | else if (depth == dim) { | |||
3567 | const PetscInt *cone; | |||
3568 | ||||
3569 | ierr = DMPlexGetCone(dm, point, &cone);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 | if (dim == 2) eStart = cone[0]; | |||
3571 | else if (dim == 3) { | |||
3572 | const PetscInt *cone2; | |||
3573 | ierr = DMPlexGetCone(dm, cone[0], &cone2);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 | eStart = cone2[0]; | |||
3575 | } 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),3575,__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); | |||
3576 | } 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),3576,__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); | |||
3577 | if (!section) {ierr = DMGetSection(dm, §ion);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 = PetscSectionGetNumFields(section, &Nf);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 | 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); | |||
3580 | for (f = 0; f < Nf; ++f) { | |||
3581 | /* An order k SEM disc has k-1 dofs on an edge */ | |||
3582 | ierr = PetscSectionGetFieldDof(section, eStart, f, &k);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 | ierr = PetscSectionGetFieldComponents(section, f, &Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3583,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3584 | k = k/Nc + 1; | |||
3585 | size += PetscPowInt(k+1, dim)*Nc; | |||
3586 | } | |||
3587 | ierr = PetscMalloc1(size, &perm)PetscMallocA(1,PETSC_FALSE,3587,__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),3587,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3588 | for (f = 0; f < Nf; ++f) { | |||
3589 | switch (dim) { | |||
3590 | case 2: | |||
3591 | /* The original quad closure is oriented clockwise, {f, e_b, e_r, e_t, e_l, v_lb, v_rb, v_tr, v_tl} */ | |||
3592 | ierr = PetscSectionGetFieldDof(section, eStart, f, &k);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3592,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3593 | ierr = PetscSectionGetFieldComponents(section, f, &Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3593,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3594 | k = k/Nc + 1; | |||
3595 | /* The SEM order is | |||
3596 | ||||
3597 | v_lb, {e_b}, v_rb, | |||
3598 | e^{(k-1)-i}_l, {f^{i*(k-1)}}, e^i_r, | |||
3599 | v_lt, reverse {e_t}, v_rt | |||
3600 | */ | |||
3601 | { | |||
3602 | const PetscInt of = 0; | |||
3603 | const PetscInt oeb = of + PetscSqr(k-1)((k-1)*(k-1)); | |||
3604 | const PetscInt oer = oeb + (k-1); | |||
3605 | const PetscInt oet = oer + (k-1); | |||
3606 | const PetscInt oel = oet + (k-1); | |||
3607 | const PetscInt ovlb = oel + (k-1); | |||
3608 | const PetscInt ovrb = ovlb + 1; | |||
3609 | const PetscInt ovrt = ovrb + 1; | |||
3610 | const PetscInt ovlt = ovrt + 1; | |||
3611 | PetscInt o; | |||
3612 | ||||
3613 | /* bottom */ | |||
3614 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovlb*Nc + c + foffset; | |||
3615 | for (o = oeb; o < oer; ++o) for (c = 0; c < Nc; ++c, ++offset) perm[offset] = o*Nc + c + foffset; | |||
3616 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovrb*Nc + c + foffset; | |||
3617 | /* middle */ | |||
3618 | for (i = 0; i < k-1; ++i) { | |||
3619 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oel+(k-2)-i)*Nc + c + foffset; | |||
3620 | 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; | |||
3621 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oer+i)*Nc + c + foffset; | |||
3622 | } | |||
3623 | /* top */ | |||
3624 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovlt*Nc + c + foffset; | |||
3625 | for (o = oel-1; o >= oet; --o) for (c = 0; c < Nc; ++c, ++offset) perm[offset] = o*Nc + c + foffset; | |||
3626 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovrt*Nc + c + foffset; | |||
3627 | foffset = offset; | |||
3628 | } | |||
3629 | break; | |||
3630 | case 3: | |||
3631 | /* The original hex closure is | |||
3632 | ||||
3633 | {c, | |||
3634 | f_b, f_t, f_f, f_b, f_r, f_l, | |||
3635 | e_bl, e_bb, e_br, e_bf, e_tf, e_tr, e_tb, e_tl, e_rf, e_lf, e_lb, e_rb, | |||
3636 | v_blf, v_blb, v_brb, v_brf, v_tlf, v_trf, v_trb, v_tlb} | |||
3637 | */ | |||
3638 | ierr = PetscSectionGetFieldDof(section, eStart, f, &k);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3638,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3639 | ierr = PetscSectionGetFieldComponents(section, f, &Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3639,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3640 | k = k/Nc + 1; | |||
3641 | /* The SEM order is | |||
3642 | Bottom Slice | |||
3643 | v_blf, {e^{(k-1)-n}_bf}, v_brf, | |||
3644 | e^{i}_bl, f^{n*(k-1)+(k-1)-i}_b, e^{(k-1)-i}_br, | |||
3645 | v_blb, {e_bb}, v_brb, | |||
3646 | ||||
3647 | Middle Slice (j) | |||
3648 | {e^{(k-1)-j}_lf}, {f^{j*(k-1)+n}_f}, e^j_rf, | |||
3649 | f^{i*(k-1)+j}_l, {c^{(j*(k-1) + i)*(k-1)+n}_t}, f^{j*(k-1)+i}_r, | |||
3650 | e^j_lb, {f^{j*(k-1)+(k-1)-n}_b}, e^{(k-1)-j}_rb, | |||
3651 | ||||
3652 | Top Slice | |||
3653 | v_tlf, {e_tf}, v_trf, | |||
3654 | e^{(k-1)-i}_tl, {f^{i*(k-1)}_t}, e^{i}_tr, | |||
3655 | v_tlb, {e^{(k-1)-n}_tb}, v_trb, | |||
3656 | */ | |||
3657 | { | |||
3658 | const PetscInt oc = 0; | |||
3659 | const PetscInt ofb = oc + PetscSqr(k-1)((k-1)*(k-1))*(k-1); | |||
3660 | const PetscInt oft = ofb + PetscSqr(k-1)((k-1)*(k-1)); | |||
3661 | const PetscInt off = oft + PetscSqr(k-1)((k-1)*(k-1)); | |||
3662 | const PetscInt ofk = off + PetscSqr(k-1)((k-1)*(k-1)); | |||
3663 | const PetscInt ofr = ofk + PetscSqr(k-1)((k-1)*(k-1)); | |||
3664 | const PetscInt ofl = ofr + PetscSqr(k-1)((k-1)*(k-1)); | |||
3665 | const PetscInt oebl = ofl + PetscSqr(k-1)((k-1)*(k-1)); | |||
3666 | const PetscInt oebb = oebl + (k-1); | |||
3667 | const PetscInt oebr = oebb + (k-1); | |||
3668 | const PetscInt oebf = oebr + (k-1); | |||
3669 | const PetscInt oetf = oebf + (k-1); | |||
3670 | const PetscInt oetr = oetf + (k-1); | |||
3671 | const PetscInt oetb = oetr + (k-1); | |||
3672 | const PetscInt oetl = oetb + (k-1); | |||
3673 | const PetscInt oerf = oetl + (k-1); | |||
3674 | const PetscInt oelf = oerf + (k-1); | |||
3675 | const PetscInt oelb = oelf + (k-1); | |||
3676 | const PetscInt oerb = oelb + (k-1); | |||
3677 | const PetscInt ovblf = oerb + (k-1); | |||
3678 | const PetscInt ovblb = ovblf + 1; | |||
3679 | const PetscInt ovbrb = ovblb + 1; | |||
3680 | const PetscInt ovbrf = ovbrb + 1; | |||
3681 | const PetscInt ovtlf = ovbrf + 1; | |||
3682 | const PetscInt ovtrf = ovtlf + 1; | |||
3683 | const PetscInt ovtrb = ovtrf + 1; | |||
3684 | const PetscInt ovtlb = ovtrb + 1; | |||
3685 | PetscInt o, n; | |||
3686 | ||||
3687 | /* Bottom Slice */ | |||
3688 | /* bottom */ | |||
3689 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovblf*Nc + c + foffset; | |||
3690 | for (o = oetf-1; o >= oebf; --o) for (c = 0; c < Nc; ++c, ++offset) perm[offset] = o*Nc + c + foffset; | |||
3691 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovbrf*Nc + c + foffset; | |||
3692 | /* middle */ | |||
3693 | for (i = 0; i < k-1; ++i) { | |||
3694 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oebl+i)*Nc + c + foffset; | |||
3695 | 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;} | |||
3696 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oebr+(k-2)-i)*Nc + c + foffset; | |||
3697 | } | |||
3698 | /* top */ | |||
3699 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovblb*Nc + c + foffset; | |||
3700 | for (o = oebb; o < oebr; ++o) for (c = 0; c < Nc; ++c, ++offset) perm[offset] = o*Nc + c + foffset; | |||
3701 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovbrb*Nc + c + foffset; | |||
3702 | ||||
3703 | /* Middle Slice */ | |||
3704 | for (j = 0; j < k-1; ++j) { | |||
3705 | /* bottom */ | |||
3706 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oelf+(k-2)-j)*Nc + c + foffset; | |||
3707 | 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; | |||
3708 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oerf+j)*Nc + c + foffset; | |||
3709 | /* middle */ | |||
3710 | for (i = 0; i < k-1; ++i) { | |||
3711 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (ofl+i*(k-1)+j)*Nc + c + foffset; | |||
3712 | 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; | |||
3713 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (ofr+j*(k-1)+i)*Nc + c + foffset; | |||
3714 | } | |||
3715 | /* top */ | |||
3716 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oelb+j)*Nc + c + foffset; | |||
3717 | 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; | |||
3718 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oerb+(k-2)-j)*Nc + c + foffset; | |||
3719 | } | |||
3720 | ||||
3721 | /* Top Slice */ | |||
3722 | /* bottom */ | |||
3723 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovtlf*Nc + c + foffset; | |||
3724 | for (o = oetf; o < oetr; ++o) for (c = 0; c < Nc; ++c, ++offset) perm[offset] = o*Nc + c + foffset; | |||
3725 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovtrf*Nc + c + foffset; | |||
3726 | /* middle */ | |||
3727 | for (i = 0; i < k-1; ++i) { | |||
3728 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oetl+(k-2)-i)*Nc + c + foffset; | |||
3729 | for (n = 0; n < k-1; ++n) for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oft+i*(k-1)+n)*Nc + c + foffset; | |||
3730 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oetr+i)*Nc + c + foffset; | |||
3731 | } | |||
3732 | /* top */ | |||
3733 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovtlb*Nc + c + foffset; | |||
3734 | for (o = oetl-1; o >= oetb; --o) for (c = 0; c < Nc; ++c, ++offset) perm[offset] = o*Nc + c + foffset; | |||
3735 | for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovtrb*Nc + c + foffset; | |||
3736 | ||||
3737 | foffset = offset; | |||
3738 | } | |||
3739 | break; | |||
3740 | default: SETERRQ1(PetscObjectComm((PetscObject) dm), PETSC_ERR_ARG_OUTOFRANGE, "No spectral ordering for dimension %D", dim)return PetscError(PetscObjectComm((PetscObject) dm),3740,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63, PETSC_ERROR_INITIAL,"No spectral ordering for dimension %D",dim ); | |||
3741 | } | |||
3742 | } | |||
3743 | if (offset != size) SETERRQ2(PetscObjectComm((PetscObject) dm), PETSC_ERR_PLIB, "Number of permutation entries %D != %D", offset, size)return PetscError(PetscObjectComm((PetscObject) dm),3743,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",77, PETSC_ERROR_INITIAL,"Number of permutation entries %D != %D", offset,size); | |||
3744 | /* Check permutation */ | |||
3745 | { | |||
3746 | PetscInt *check; | |||
3747 | ||||
3748 | ierr = PetscMalloc1(size, &check)PetscMallocA(1,PETSC_FALSE,3748,__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),3748,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3749 | 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),3749,__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]);} | |||
3750 | for (i = 0; i < size; ++i) check[perm[i]] = i; | |||
3751 | 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),3751,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",77, PETSC_ERROR_INITIAL,"Missing permutation index %D",i);} | |||
3752 | ierr = PetscFree(check)((*PetscTrFree)((void*)(check),3752,__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),3752,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3753 | } | |||
3754 | ierr = PetscSectionSetClosurePermutation_Internal(section, (PetscObject) dm, size, PETSC_OWN_POINTER, perm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3754,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3755 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3756 | } | |||
3757 | ||||
3758 | PetscErrorCode DMPlexGetPointDualSpaceFEM(DM dm, PetscInt point, PetscInt field, PetscDualSpace *dspace) | |||
3759 | { | |||
3760 | PetscDS prob; | |||
3761 | PetscInt depth, Nf, h; | |||
3762 | DMLabel label; | |||
3763 | PetscErrorCode ierr; | |||
3764 | ||||
3765 | 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] = 3765; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); | |||
3766 | ierr = DMGetDS(dm, &prob);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3766,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3767 | Nf = prob->Nf; | |||
3768 | label = dm->depthLabel; | |||
3769 | *dspace = NULL((void*)0); | |||
3770 | if (field < Nf) { | |||
3771 | PetscObject disc = prob->disc[field]; | |||
3772 | ||||
3773 | if (disc->classid == PETSCFE_CLASSID) { | |||
3774 | PetscDualSpace dsp; | |||
3775 | ||||
3776 | ierr = PetscFEGetDualSpace((PetscFE)disc,&dsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3776,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3777 | ierr = DMLabelGetNumValues(label,&depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3777,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3778 | ierr = DMLabelGetValue(label,point,&h);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3778,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3779 | h = depth - 1 - h; | |||
3780 | if (h) { | |||
3781 | ierr = PetscDualSpaceGetHeightSubspace(dsp,h,dspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3781,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3782 | } else { | |||
3783 | *dspace = dsp; | |||
3784 | } | |||
3785 | } | |||
3786 | } | |||
3787 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3788 | } | |||
3789 | ||||
3790 | ||||
3791 | PETSC_STATIC_INLINEstatic inline PetscErrorCode DMPlexVecGetClosure_Depth1_Static(DM dm, PetscSection section, Vec v, PetscInt point, PetscInt *csize, PetscScalar *values[]) | |||
3792 | { | |||
3793 | PetscScalar *array, *vArray; | |||
3794 | const PetscInt *cone, *coneO; | |||
3795 | PetscInt pStart, pEnd, p, numPoints, size = 0, offset = 0; | |||
3796 | PetscErrorCode ierr; | |||
3797 | ||||
3798 | 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] = 3798; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); | |||
3799 | ierr = PetscSectionGetChart(section, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3799,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3800 | ierr = DMPlexGetConeSize(dm, point, &numPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3800,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3801 | ierr = DMPlexGetCone(dm, point, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3801,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3802 | ierr = DMPlexGetConeOrientation(dm, point, &coneO);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 | if (!values || !*values) { | |||
3804 | if ((point >= pStart) && (point < pEnd)) { | |||
3805 | PetscInt dof; | |||
3806 | ||||
3807 | ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3807,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3808 | size += dof; | |||
3809 | } | |||
3810 | for (p = 0; p < numPoints; ++p) { | |||
3811 | const PetscInt cp = cone[p]; | |||
3812 | PetscInt dof; | |||
3813 | ||||
3814 | if ((cp < pStart) || (cp >= pEnd)) continue; | |||
3815 | ierr = PetscSectionGetDof(section, cp, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3815,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3816 | size += dof; | |||
3817 | } | |||
3818 | if (!values) { | |||
3819 | if (csize) *csize = size; | |||
3820 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3821 | } | |||
3822 | ierr = DMGetWorkArray(dm, size, MPIU_SCALAR((MPI_Datatype)0x4c00080b), &array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3822,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3823 | } else { | |||
3824 | array = *values; | |||
3825 | } | |||
3826 | size = 0; | |||
3827 | ierr = VecGetArray(v, &vArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3827,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3828 | if ((point >= pStart) && (point < pEnd)) { | |||
3829 | PetscInt dof, off, d; | |||
3830 | PetscScalar *varr; | |||
3831 | ||||
3832 | ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3832,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3833 | ierr = PetscSectionGetOffset(section, point, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3833,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3834 | varr = &vArray[off]; | |||
3835 | for (d = 0; d < dof; ++d, ++offset) { | |||
3836 | array[offset] = varr[d]; | |||
3837 | } | |||
3838 | size += dof; | |||
3839 | } | |||
3840 | for (p = 0; p < numPoints; ++p) { | |||
3841 | const PetscInt cp = cone[p]; | |||
3842 | PetscInt o = coneO[p]; | |||
3843 | PetscInt dof, off, d; | |||
3844 | PetscScalar *varr; | |||
3845 | ||||
3846 | if ((cp < pStart) || (cp >= pEnd)) continue; | |||
3847 | ierr = PetscSectionGetDof(section, cp, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3847,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3848 | ierr = PetscSectionGetOffset(section, cp, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3848,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3849 | varr = &vArray[off]; | |||
3850 | if (o >= 0) { | |||
3851 | for (d = 0; d < dof; ++d, ++offset) { | |||
3852 | array[offset] = varr[d]; | |||
3853 | } | |||
3854 | } else { | |||
3855 | for (d = dof-1; d >= 0; --d, ++offset) { | |||
3856 | array[offset] = varr[d]; | |||
3857 | } | |||
3858 | } | |||
3859 | size += dof; | |||
3860 | } | |||
3861 | ierr = VecRestoreArray(v, &vArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3861,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3862 | if (!*values) { | |||
3863 | if (csize) *csize = size; | |||
3864 | *values = array; | |||
3865 | } else { | |||
3866 | 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),3866,__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); | |||
3867 | *csize = size; | |||
3868 | } | |||
3869 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3870 | } | |||
3871 | ||||
3872 | static PetscErrorCode DMPlexGetCompressedClosure(DM dm, PetscSection section, PetscInt point, PetscInt *numPoints, PetscInt **points, PetscSection *clSec, IS *clPoints, const PetscInt **clp) | |||
3873 | { | |||
3874 | const PetscInt *cla; | |||
3875 | PetscInt np, *pts = NULL((void*)0); | |||
3876 | PetscErrorCode ierr; | |||
3877 | ||||
3878 | 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] = 3878; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); | |||
3879 | ierr = PetscSectionGetClosureIndex(section, (PetscObject) dm, clSec, clPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3879,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3880 | if (!*clPoints) { | |||
3881 | PetscInt pStart, pEnd, p, q; | |||
3882 | ||||
3883 | ierr = PetscSectionGetChart(section, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3883,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3884 | ierr = DMPlexGetTransitiveClosure(dm, point, PETSC_TRUE, &np, &pts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3884,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3885 | /* Compress out points not in the section */ | |||
3886 | for (p = 0, q = 0; p < np; p++) { | |||
3887 | PetscInt r = pts[2*p]; | |||
3888 | if ((r >= pStart) && (r < pEnd)) { | |||
3889 | pts[q*2] = r; | |||
3890 | pts[q*2+1] = pts[2*p+1]; | |||
3891 | ++q; | |||
3892 | } | |||
3893 | } | |||
3894 | np = q; | |||
3895 | cla = NULL((void*)0); | |||
3896 | } else { | |||
3897 | PetscInt dof, off; | |||
3898 | ||||
3899 | ierr = PetscSectionGetDof(*clSec, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3899,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3900 | ierr = PetscSectionGetOffset(*clSec, point, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3900,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3901 | ierr = ISGetIndices(*clPoints, &cla);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3901,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3902 | np = dof/2; | |||
3903 | pts = (PetscInt *) &cla[off]; | |||
3904 | } | |||
3905 | *numPoints = np; | |||
3906 | *points = pts; | |||
3907 | *clp = cla; | |||
3908 | ||||
3909 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3910 | } | |||
3911 | ||||
3912 | static PetscErrorCode DMPlexRestoreCompressedClosure(DM dm, PetscSection section, PetscInt point, PetscInt *numPoints, PetscInt **points, PetscSection *clSec, IS *clPoints, const PetscInt **clp) | |||
3913 | { | |||
3914 | PetscErrorCode ierr; | |||
3915 | ||||
3916 | 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] = 3916; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); | |||
3917 | if (!*clPoints) { | |||
3918 | ierr = DMPlexRestoreTransitiveClosure(dm, point, PETSC_TRUE, numPoints, points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3918,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3919 | } else { | |||
3920 | ierr = ISRestoreIndices(*clPoints, clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3920,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3921 | } | |||
3922 | *numPoints = 0; | |||
3923 | *points = NULL((void*)0); | |||
3924 | *clSec = NULL((void*)0); | |||
3925 | *clPoints = NULL((void*)0); | |||
3926 | *clp = NULL((void*)0); | |||
3927 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3928 | } | |||
3929 | ||||
3930 | PETSC_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[]) | |||
3931 | { | |||
3932 | PetscInt offset = 0, p; | |||
3933 | const PetscInt **perms = NULL((void*)0); | |||
3934 | const PetscScalar **flips = NULL((void*)0); | |||
3935 | PetscErrorCode ierr; | |||
3936 | ||||
3937 | 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] = 3937; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); | |||
3938 | *size = 0; | |||
3939 | ierr = PetscSectionGetPointSyms(section,numPoints,points,&perms,&flips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3939,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3940 | for (p = 0; p < numPoints; p++) { | |||
3941 | const PetscInt point = points[2*p]; | |||
3942 | const PetscInt *perm = perms ? perms[p] : NULL((void*)0); | |||
3943 | const PetscScalar *flip = flips ? flips[p] : NULL((void*)0); | |||
3944 | PetscInt dof, off, d; | |||
3945 | const PetscScalar *varr; | |||
3946 | ||||
3947 | ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3947,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3948 | ierr = PetscSectionGetOffset(section, point, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3948,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3949 | varr = &vArray[off]; | |||
3950 | if (clperm) { | |||
3951 | if (perm) { | |||
3952 | for (d = 0; d < dof; d++) array[clperm[offset + perm[d]]] = varr[d]; | |||
3953 | } else { | |||
3954 | for (d = 0; d < dof; d++) array[clperm[offset + d ]] = varr[d]; | |||
3955 | } | |||
3956 | if (flip) { | |||
3957 | for (d = 0; d < dof; d++) array[clperm[offset + d ]] *= flip[d]; | |||
3958 | } | |||
3959 | } else { | |||
3960 | if (perm) { | |||
3961 | for (d = 0; d < dof; d++) array[offset + perm[d]] = varr[d]; | |||
3962 | } else { | |||
3963 | for (d = 0; d < dof; d++) array[offset + d ] = varr[d]; | |||
3964 | } | |||
3965 | if (flip) { | |||
3966 | for (d = 0; d < dof; d++) array[offset + d ] *= flip[d]; | |||
3967 | } | |||
3968 | } | |||
3969 | offset += dof; | |||
3970 | } | |||
3971 | ierr = PetscSectionRestorePointSyms(section,numPoints,points,&perms,&flips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3971,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3972 | *size = offset; | |||
3973 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3974 | } | |||
3975 | ||||
3976 | PETSC_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[]) | |||
3977 | { | |||
3978 | PetscInt offset = 0, f; | |||
3979 | PetscErrorCode ierr; | |||
3980 | ||||
3981 | 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] = 3981; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); | |||
3982 | *size = 0; | |||
3983 | for (f = 0; f < numFields; ++f) { | |||
3984 | PetscInt p; | |||
3985 | const PetscInt **perms = NULL((void*)0); | |||
3986 | const PetscScalar **flips = NULL((void*)0); | |||
3987 | ||||
3988 | ierr = PetscSectionGetFieldPointSyms(section,f,numPoints,points,&perms,&flips);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 (p = 0; p < numPoints; p++) { | |||
3990 | const PetscInt point = points[2*p]; | |||
3991 | PetscInt fdof, foff, b; | |||
3992 | const PetscScalar *varr; | |||
3993 | const PetscInt *perm = perms ? perms[p] : NULL((void*)0); | |||
3994 | const PetscScalar *flip = flips ? flips[p] : NULL((void*)0); | |||
3995 | ||||
3996 | ierr = PetscSectionGetFieldDof(section, point, f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3996,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3997 | ierr = PetscSectionGetFieldOffset(section, point, f, &foff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3997,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3998 | varr = &vArray[foff]; | |||
3999 | if (clperm) { | |||
4000 | if (perm) {for (b = 0; b < fdof; b++) {array[clperm[offset + perm[b]]] = varr[b];}} | |||
4001 | else {for (b = 0; b < fdof; b++) {array[clperm[offset + b ]] = varr[b];}} | |||
4002 | if (flip) {for (b = 0; b < fdof; b++) {array[clperm[offset + b ]] *= flip[b];}} | |||
4003 | } else { | |||
4004 | if (perm) {for (b = 0; b < fdof; b++) {array[offset + perm[b]] = varr[b];}} | |||
4005 | else {for (b = 0; b < fdof; b++) {array[offset + b ] = varr[b];}} | |||
4006 | if (flip) {for (b = 0; b < fdof; b++) {array[offset + b ] *= flip[b];}} | |||
4007 | } | |||
4008 | offset += fdof; | |||
4009 | } | |||
4010 | ierr = PetscSectionRestoreFieldPointSyms(section,f,numPoints,points,&perms,&flips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4010,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4011 | } | |||
4012 | *size = offset; | |||
4013 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4014 | } | |||
4015 | ||||
4016 | /*@C | |||
4017 | DMPlexVecGetClosure - Get an array of the values on the closure of 'point' | |||
4018 | ||||
4019 | Not collective | |||
4020 | ||||
4021 | Input Parameters: | |||
4022 | + dm - The DM | |||
4023 | . section - The section describing the layout in v, or NULL to use the default section | |||
4024 | . v - The local vector | |||
4025 | . point - The point in the DM | |||
4026 | . csize - The size of the input values array, or NULL | |||
4027 | - values - An array to use for the values, or NULL to have it allocated automatically | |||
4028 | ||||
4029 | Output Parameters: | |||
4030 | + csize - The number of values in the closure | |||
4031 | - values - The array of values. If the user provided NULL, it is a borrowed array and should not be freed | |||
4032 | ||||
4033 | $ Note that DMPlexVecGetClosure/DMPlexVecRestoreClosure only allocates the values array if it set to NULL in the | |||
4034 | $ calling function. This is because DMPlexVecGetClosure() is typically called in the inner loop of a Vec or Mat | |||
4035 | $ assembly function, and a user may already have allocated storage for this operation. | |||
4036 | $ | |||
4037 | $ A typical use could be | |||
4038 | $ | |||
4039 | $ values = NULL; | |||
4040 | $ ierr = DMPlexVecGetClosure(dm, NULL, v, p, &clSize, &values);CHKERRQ(ierr); | |||
4041 | $ for (cl = 0; cl < clSize; ++cl) { | |||
4042 | $ <Compute on closure> | |||
4043 | $ } | |||
4044 | $ ierr = DMPlexVecRestoreClosure(dm, NULL, v, p, &clSize, &values);CHKERRQ(ierr); | |||
4045 | $ | |||
4046 | $ or | |||
4047 | $ | |||
4048 | $ PetscMalloc1(clMaxSize, &values); | |||
4049 | $ for (p = pStart; p < pEnd; ++p) { | |||
4050 | $ clSize = clMaxSize; | |||
4051 | $ ierr = DMPlexVecGetClosure(dm, NULL, v, p, &clSize, &values);CHKERRQ(ierr); | |||
4052 | $ for (cl = 0; cl < clSize; ++cl) { | |||
4053 | $ <Compute on closure> | |||
4054 | $ } | |||
4055 | $ } | |||
4056 | $ PetscFree(values); | |||
4057 | ||||
4058 | Fortran Notes: | |||
4059 | Since it returns an array, this routine is only available in Fortran 90, and you must | |||
4060 | include petsc.h90 in your code. | |||
4061 | ||||
4062 | The csize argument is not present in the Fortran 90 binding since it is internal to the array. | |||
4063 | ||||
4064 | Level: intermediate | |||
4065 | ||||
4066 | .seealso DMPlexVecRestoreClosure(), DMPlexVecSetClosure(), DMPlexMatSetClosure() | |||
4067 | @*/ | |||
4068 | PetscErrorCode DMPlexVecGetClosure(DM dm, PetscSection section, Vec v, PetscInt point, PetscInt *csize, PetscScalar *values[]) | |||
4069 | { | |||
4070 | PetscSection clSection; | |||
4071 | IS clPoints; | |||
4072 | PetscScalar *array; | |||
4073 | const PetscScalar *vArray; | |||
4074 | PetscInt *points = NULL((void*)0); | |||
4075 | const PetscInt *clp, *perm; | |||
4076 | PetscInt depth, numFields, numPoints, size; | |||
4077 | PetscErrorCode ierr; | |||
4078 | ||||
4079 | 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] = 4079; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); | |||
4080 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),4080,__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),4080 ,__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),4080,__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),4080,__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); | |||
4081 | if (!section) {ierr = DMGetSection(dm, §ion);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4081,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
4082 | PetscValidHeaderSpecific(section, PETSC_SECTION_CLASSID, 2)do { if (!section) return PetscError(((MPI_Comm)0x44000001),4082 ,__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),4082,__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),4082,__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),4082,__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); | |||
4083 | PetscValidHeaderSpecific(v, VEC_CLASSID, 3)do { if (!v) return PetscError(((MPI_Comm)0x44000001),4083,__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),4083 ,__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),4083,__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),4083,__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); | |||
4084 | ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4084,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4085 | ierr = PetscSectionGetNumFields(section, &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4085,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4086 | if (depth == 1 && numFields < 2) { | |||
4087 | ierr = DMPlexVecGetClosure_Depth1_Static(dm, section, v, point, csize, values);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 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4089 | } | |||
4090 | /* Get points */ | |||
4091 | ierr = DMPlexGetCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4091,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4092 | ierr = PetscSectionGetClosureInversePermutation_Internal(section, (PetscObject) dm, NULL((void*)0), &perm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4092,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4093 | /* Get array */ | |||
4094 | if (!values || !*values) { | |||
4095 | PetscInt asize = 0, dof, p; | |||
4096 | ||||
4097 | for (p = 0; p < numPoints*2; p += 2) { | |||
4098 | ierr = PetscSectionGetDof(section, points[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4098,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4099 | asize += dof; | |||
4100 | } | |||
4101 | if (!values) { | |||
4102 | ierr = DMPlexRestoreCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4102,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4103 | if (csize) *csize = asize; | |||
4104 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4105 | } | |||
4106 | ierr = DMGetWorkArray(dm, asize, MPIU_SCALAR((MPI_Datatype)0x4c00080b), &array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4106,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4107 | } else { | |||
4108 | array = *values; | |||
4109 | } | |||
4110 | ierr = VecGetArrayRead(v, &vArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4110,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4111 | /* Get values */ | |||
4112 | 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),4112,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
4113 | 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),4113,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
4114 | /* Cleanup points */ | |||
4115 | ierr = DMPlexRestoreCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4115,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4116 | /* Cleanup array */ | |||
4117 | ierr = VecRestoreArrayRead(v, &vArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4117,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4118 | if (!*values) { | |||
4119 | if (csize) *csize = size; | |||
4120 | *values = array; | |||
4121 | } else { | |||
4122 | 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),4122,__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); | |||
4123 | *csize = size; | |||
4124 | } | |||
4125 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4126 | } | |||
4127 | ||||
4128 | /*@C | |||
4129 | DMPlexVecRestoreClosure - Restore the array of the values on the closure of 'point' | |||
4130 | ||||
4131 | Not collective | |||
4132 | ||||
4133 | Input Parameters: | |||
4134 | + dm - The DM | |||
4135 | . section - The section describing the layout in v, or NULL to use the default section | |||
4136 | . v - The local vector | |||
4137 | . point - The point in the DM | |||
4138 | . csize - The number of values in the closure, or NULL | |||
4139 | - values - The array of values, which is a borrowed array and should not be freed | |||
4140 | ||||
4141 | Note that the array values are discarded and not copied back into v. In order to copy values back to v, use DMPlexVecSetClosure() | |||
4142 | ||||
4143 | Fortran Notes: | |||
4144 | Since it returns an array, this routine is only available in Fortran 90, and you must | |||
4145 | include petsc.h90 in your code. | |||
4146 | ||||
4147 | The csize argument is not present in the Fortran 90 binding since it is internal to the array. | |||
4148 | ||||
4149 | Level: intermediate | |||
4150 | ||||
4151 | .seealso DMPlexVecGetClosure(), DMPlexVecSetClosure(), DMPlexMatSetClosure() | |||
4152 | @*/ | |||
4153 | PetscErrorCode DMPlexVecRestoreClosure(DM dm, PetscSection section, Vec v, PetscInt point, PetscInt *csize, PetscScalar *values[]) | |||
4154 | { | |||
4155 | PetscInt size = 0; | |||
4156 | PetscErrorCode ierr; | |||
4157 | ||||
4158 | 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] = 4158; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4159 | /* Should work without recalculating size */ | |||
4160 | ierr = DMRestoreWorkArray(dm, size, MPIU_SCALAR((MPI_Datatype)0x4c00080b), (void*) values);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 | *values = NULL((void*)0); | |||
4162 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4163 | } | |||
4164 | ||||
4165 | PETSC_STATIC_INLINEstatic inline void add (PetscScalar *x, PetscScalar y) {*x += y;} | |||
4166 | PETSC_STATIC_INLINEstatic inline void insert(PetscScalar *x, PetscScalar y) {*x = y;} | |||
4167 | ||||
4168 | PETSC_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[]) | |||
4169 | { | |||
4170 | PetscInt cdof; /* The number of constraints on this point */ | |||
4171 | const PetscInt *cdofs; /* The indices of the constrained dofs on this point */ | |||
4172 | PetscScalar *a; | |||
4173 | PetscInt off, cind = 0, k; | |||
4174 | PetscErrorCode ierr; | |||
4175 | ||||
4176 | 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] = 4176; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4177 | ierr = PetscSectionGetConstraintDof(section, point, &cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4177,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4178 | ierr = PetscSectionGetOffset(section, point, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4178,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4179 | a = &array[off]; | |||
4180 | if (!cdof || setBC) { | |||
4181 | if (clperm) { | |||
4182 | if (perm) {for (k = 0; k < dof; ++k) {fuse(&a[k], values[clperm[offset+perm[k]]] * (flip ? flip[perm[k]] : 1.));}} | |||
4183 | else {for (k = 0; k < dof; ++k) {fuse(&a[k], values[clperm[offset+ k ]] * (flip ? flip[ k ] : 1.));}} | |||
4184 | } else { | |||
4185 | if (perm) {for (k = 0; k < dof; ++k) {fuse(&a[k], values[offset+perm[k]] * (flip ? flip[perm[k]] : 1.));}} | |||
4186 | else {for (k = 0; k < dof; ++k) {fuse(&a[k], values[offset+ k ] * (flip ? flip[ k ] : 1.));}} | |||
4187 | } | |||
4188 | } else { | |||
4189 | ierr = PetscSectionGetConstraintIndices(section, point, &cdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4189,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4190 | if (clperm) { | |||
4191 | if (perm) {for (k = 0; k < dof; ++k) { | |||
4192 | if ((cind < cdof) && (k == cdofs[cind])) {++cind; continue;} | |||
4193 | fuse(&a[k], values[clperm[offset+perm[k]]] * (flip ? flip[perm[k]] : 1.)); | |||
4194 | } | |||
4195 | } else { | |||
4196 | for (k = 0; k < dof; ++k) { | |||
4197 | if ((cind < cdof) && (k == cdofs[cind])) {++cind; continue;} | |||
4198 | fuse(&a[k], values[clperm[offset+ k ]] * (flip ? flip[ k ] : 1.)); | |||
4199 | } | |||
4200 | } | |||
4201 | } else { | |||
4202 | if (perm) { | |||
4203 | for (k = 0; k < dof; ++k) { | |||
4204 | if ((cind < cdof) && (k == cdofs[cind])) {++cind; continue;} | |||
4205 | fuse(&a[k], values[offset+perm[k]] * (flip ? flip[perm[k]] : 1.)); | |||
4206 | } | |||
4207 | } else { | |||
4208 | for (k = 0; k < dof; ++k) { | |||
4209 | if ((cind < cdof) && (k == cdofs[cind])) {++cind; continue;} | |||
4210 | fuse(&a[k], values[offset+ k ] * (flip ? flip[ k ] : 1.)); | |||
4211 | } | |||
4212 | } | |||
4213 | } | |||
4214 | } | |||
4215 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4216 | } | |||
4217 | ||||
4218 | PETSC_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[]) | |||
4219 | { | |||
4220 | PetscInt cdof; /* The number of constraints on this point */ | |||
4221 | const PetscInt *cdofs; /* The indices of the constrained dofs on this point */ | |||
4222 | PetscScalar *a; | |||
4223 | PetscInt off, cind = 0, k; | |||
4224 | PetscErrorCode ierr; | |||
4225 | ||||
4226 | 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] = 4226; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4227 | ierr = PetscSectionGetConstraintDof(section, point, &cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4227,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4228 | ierr = PetscSectionGetOffset(section, point, &off);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 | a = &array[off]; | |||
4230 | if (cdof) { | |||
4231 | ierr = PetscSectionGetConstraintIndices(section, point, &cdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4231,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4232 | if (clperm) { | |||
4233 | if (perm) { | |||
4234 | for (k = 0; k < dof; ++k) { | |||
4235 | if ((cind < cdof) && (k == cdofs[cind])) { | |||
4236 | fuse(&a[k], values[clperm[offset+perm[k]]] * (flip ? flip[perm[k]] : 1.)); | |||
4237 | cind++; | |||
4238 | } | |||
4239 | } | |||
4240 | } else { | |||
4241 | for (k = 0; k < dof; ++k) { | |||
4242 | if ((cind < cdof) && (k == cdofs[cind])) { | |||
4243 | fuse(&a[k], values[clperm[offset+ k ]] * (flip ? flip[ k ] : 1.)); | |||
4244 | cind++; | |||
4245 | } | |||
4246 | } | |||
4247 | } | |||
4248 | } else { | |||
4249 | if (perm) { | |||
4250 | for (k = 0; k < dof; ++k) { | |||
4251 | if ((cind < cdof) && (k == cdofs[cind])) { | |||
4252 | fuse(&a[k], values[offset+perm[k]] * (flip ? flip[perm[k]] : 1.)); | |||
4253 | cind++; | |||
4254 | } | |||
4255 | } | |||
4256 | } else { | |||
4257 | for (k = 0; k < dof; ++k) { | |||
4258 | if ((cind < cdof) && (k == cdofs[cind])) { | |||
4259 | fuse(&a[k], values[offset+ k ] * (flip ? flip[ k ] : 1.)); | |||
4260 | cind++; | |||
4261 | } | |||
4262 | } | |||
4263 | } | |||
4264 | } | |||
4265 | } | |||
4266 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4267 | } | |||
4268 | ||||
4269 | PETSC_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[]) | |||
4270 | { | |||
4271 | PetscScalar *a; | |||
4272 | PetscInt fdof, foff, fcdof, foffset = *offset; | |||
4273 | const PetscInt *fcdofs; /* The indices of the constrained dofs for field f on this point */ | |||
4274 | PetscInt cind = 0, b; | |||
4275 | PetscErrorCode ierr; | |||
4276 | ||||
4277 | 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] = 4277; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4278 | ierr = PetscSectionGetFieldDof(section, point, f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4278,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4279 | ierr = PetscSectionGetFieldConstraintDof(section, point, f, &fcdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4279,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4280 | ierr = PetscSectionGetFieldOffset(section, point, f, &foff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4280,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4281 | a = &array[foff]; | |||
4282 | if (!fcdof || setBC) { | |||
4283 | if (clperm) { | |||
4284 | if (perm) {for (b = 0; b < fdof; b++) {fuse(&a[b], values[clperm[foffset+perm[b]]] * (flip ? flip[perm[b]] : 1.));}} | |||
4285 | else {for (b = 0; b < fdof; b++) {fuse(&a[b], values[clperm[foffset+ b ]] * (flip ? flip[ b ] : 1.));}} | |||
4286 | } else { | |||
4287 | if (perm) {for (b = 0; b < fdof; b++) {fuse(&a[b], values[foffset+perm[b]] * (flip ? flip[perm[b]] : 1.));}} | |||
4288 | else {for (b = 0; b < fdof; b++) {fuse(&a[b], values[foffset+ b ] * (flip ? flip[ b ] : 1.));}} | |||
4289 | } | |||
4290 | } else { | |||
4291 | ierr = PetscSectionGetFieldConstraintIndices(section, point, f, &fcdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4291,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4292 | if (clperm) { | |||
4293 | if (perm) { | |||
4294 | for (b = 0; b < fdof; b++) { | |||
4295 | if ((cind < fcdof) && (b == fcdofs[cind])) {++cind; continue;} | |||
4296 | fuse(&a[b], values[clperm[foffset+perm[b]]] * (flip ? flip[perm[b]] : 1.)); | |||
4297 | } | |||
4298 | } else { | |||
4299 | for (b = 0; b < fdof; b++) { | |||
4300 | if ((cind < fcdof) && (b == fcdofs[cind])) {++cind; continue;} | |||
4301 | fuse(&a[b], values[clperm[foffset+ b ]] * (flip ? flip[ b ] : 1.)); | |||
4302 | } | |||
4303 | } | |||
4304 | } else { | |||
4305 | if (perm) { | |||
4306 | for (b = 0; b < fdof; b++) { | |||
4307 | if ((cind < fcdof) && (b == fcdofs[cind])) {++cind; continue;} | |||
4308 | fuse(&a[b], values[foffset+perm[b]] * (flip ? flip[perm[b]] : 1.)); | |||
4309 | } | |||
4310 | } else { | |||
4311 | for (b = 0; b < fdof; b++) { | |||
4312 | if ((cind < fcdof) && (b == fcdofs[cind])) {++cind; continue;} | |||
4313 | fuse(&a[b], values[foffset+ b ] * (flip ? flip[ b ] : 1.)); | |||
4314 | } | |||
4315 | } | |||
4316 | } | |||
4317 | } | |||
4318 | *offset += fdof; | |||
4319 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4320 | } | |||
4321 | ||||
4322 | PETSC_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[]) | |||
4323 | { | |||
4324 | PetscScalar *a; | |||
4325 | PetscInt fdof, foff, fcdof, foffset = *offset; | |||
4326 | const PetscInt *fcdofs; /* The indices of the constrained dofs for field f on this point */ | |||
4327 | PetscInt cind = 0, ncind = 0, b; | |||
4328 | PetscBool ncSet, fcSet; | |||
4329 | PetscErrorCode ierr; | |||
4330 | ||||
4331 | 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] = 4331; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4332 | ierr = PetscSectionGetFieldDof(section, point, f, &fdof);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 | ierr = PetscSectionGetFieldConstraintDof(section, point, f, &fcdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4333,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4334 | ierr = PetscSectionGetFieldOffset(section, point, f, &foff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4334,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4335 | a = &array[foff]; | |||
4336 | if (fcdof) { | |||
4337 | /* We just override fcdof and fcdofs with Ncc and comps */ | |||
4338 | ierr = PetscSectionGetFieldConstraintIndices(section, point, f, &fcdofs);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 | if (clperm) { | |||
4340 | if (perm) { | |||
4341 | if (comps) { | |||
4342 | for (b = 0; b < fdof; b++) { | |||
4343 | ncSet = fcSet = PETSC_FALSE; | |||
4344 | if ((ncind < Ncc) && (b == comps[ncind])) {++ncind; ncSet = PETSC_TRUE;} | |||
4345 | if ((cind < fcdof) && (b == fcdofs[cind])) {++cind; fcSet = PETSC_TRUE;} | |||
4346 | if (ncSet && fcSet) {fuse(&a[b], values[clperm[foffset+perm[b]]] * (flip ? flip[perm[b]] : 1.));} | |||
4347 | } | |||
4348 | } else { | |||
4349 | for (b = 0; b < fdof; b++) { | |||
4350 | if ((cind < fcdof) && (b == fcdofs[cind])) { | |||
4351 | fuse(&a[b], values[clperm[foffset+perm[b]]] * (flip ? flip[perm[b]] : 1.)); | |||
4352 | ++cind; | |||
4353 | } | |||
4354 | } | |||
4355 | } | |||
4356 | } else { | |||
4357 | if (comps) { | |||
4358 | for (b = 0; b < fdof; b++) { | |||
4359 | ncSet = fcSet = PETSC_FALSE; | |||
4360 | if ((ncind < Ncc) && (b == comps[ncind])) {++ncind; ncSet = PETSC_TRUE;} | |||
4361 | if ((cind < fcdof) && (b == fcdofs[cind])) {++cind; fcSet = PETSC_TRUE;} | |||
4362 | if (ncSet && fcSet) {fuse(&a[b], values[clperm[foffset+ b ]] * (flip ? flip[ b ] : 1.));} | |||
4363 | } | |||
4364 | } else { | |||
4365 | for (b = 0; b < fdof; b++) { | |||
4366 | if ((cind < fcdof) && (b == fcdofs[cind])) { | |||
4367 | fuse(&a[b], values[clperm[foffset+ b ]] * (flip ? flip[ b ] : 1.)); | |||
4368 | ++cind; | |||
4369 | } | |||
4370 | } | |||
4371 | } | |||
4372 | } | |||
4373 | } else { | |||
4374 | if (perm) { | |||
4375 | if (comps) { | |||
4376 | for (b = 0; b < fdof; b++) { | |||
4377 | ncSet = fcSet = PETSC_FALSE; | |||
4378 | if ((ncind < Ncc) && (b == comps[ncind])) {++ncind; ncSet = PETSC_TRUE;} | |||
4379 | if ((cind < fcdof) && (b == fcdofs[cind])) {++cind; fcSet = PETSC_TRUE;} | |||
4380 | if (ncSet && fcSet) {fuse(&a[b], values[foffset+perm[b]] * (flip ? flip[perm[b]] : 1.));} | |||
4381 | } | |||
4382 | } else { | |||
4383 | for (b = 0; b < fdof; b++) { | |||
4384 | if ((cind < fcdof) && (b == fcdofs[cind])) { | |||
4385 | fuse(&a[b], values[foffset+perm[b]] * (flip ? flip[perm[b]] : 1.)); | |||
4386 | ++cind; | |||
4387 | } | |||
4388 | } | |||
4389 | } | |||
4390 | } else { | |||
4391 | if (comps) { | |||
4392 | for (b = 0; b < fdof; b++) { | |||
4393 | ncSet = fcSet = PETSC_FALSE; | |||
4394 | if ((ncind < Ncc) && (b == comps[ncind])) {++ncind; ncSet = PETSC_TRUE;} | |||
4395 | if ((cind < fcdof) && (b == fcdofs[cind])) {++cind; fcSet = PETSC_TRUE;} | |||
4396 | if (ncSet && fcSet) {fuse(&a[b], values[foffset+ b ] * (flip ? flip[ b ] : 1.));} | |||
4397 | } | |||
4398 | } else { | |||
4399 | for (b = 0; b < fdof; b++) { | |||
4400 | if ((cind < fcdof) && (b == fcdofs[cind])) { | |||
4401 | fuse(&a[b], values[foffset+ b ] * (flip ? flip[ b ] : 1.)); | |||
4402 | ++cind; | |||
4403 | } | |||
4404 | } | |||
4405 | } | |||
4406 | } | |||
4407 | } | |||
4408 | } | |||
4409 | *offset += fdof; | |||
4410 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4411 | } | |||
4412 | ||||
4413 | PETSC_STATIC_INLINEstatic inline PetscErrorCode DMPlexVecSetClosure_Depth1_Static(DM dm, PetscSection section, Vec v, PetscInt point, const PetscScalar values[], InsertMode mode) | |||
4414 | { | |||
4415 | PetscScalar *array; | |||
4416 | const PetscInt *cone, *coneO; | |||
4417 | PetscInt pStart, pEnd, p, numPoints, off, dof; | |||
4418 | PetscErrorCode ierr; | |||
4419 | ||||
4420 | 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] = 4420; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); | |||
4421 | ierr = PetscSectionGetChart(section, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4421,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4422 | ierr = DMPlexGetConeSize(dm, point, &numPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4422,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4423 | ierr = DMPlexGetCone(dm, point, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4423,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4424 | ierr = DMPlexGetConeOrientation(dm, point, &coneO);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4424,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4425 | ierr = VecGetArray(v, &array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4425,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4426 | for (p = 0, off = 0; p <= numPoints; ++p, off += dof) { | |||
4427 | const PetscInt cp = !p ? point : cone[p-1]; | |||
4428 | const PetscInt o = !p ? 0 : coneO[p-1]; | |||
4429 | ||||
4430 | if ((cp < pStart) || (cp >= pEnd)) {dof = 0; continue;} | |||
4431 | ierr = PetscSectionGetDof(section, cp, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4431,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4432 | /* ADD_VALUES */ | |||
4433 | { | |||
4434 | const PetscInt *cdofs; /* The indices of the constrained dofs on this point */ | |||
4435 | PetscScalar *a; | |||
4436 | PetscInt cdof, coff, cind = 0, k; | |||
4437 | ||||
4438 | ierr = PetscSectionGetConstraintDof(section, cp, &cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4438,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4439 | ierr = PetscSectionGetOffset(section, cp, &coff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4439,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4440 | a = &array[coff]; | |||
4441 | if (!cdof) { | |||
4442 | if (o >= 0) { | |||
4443 | for (k = 0; k < dof; ++k) { | |||
4444 | a[k] += values[off+k]; | |||
4445 | } | |||
4446 | } else { | |||
4447 | for (k = 0; k < dof; ++k) { | |||
4448 | a[k] += values[off+dof-k-1]; | |||
4449 | } | |||
4450 | } | |||
4451 | } else { | |||
4452 | ierr = PetscSectionGetConstraintIndices(section, cp, &cdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4452,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4453 | if (o >= 0) { | |||
4454 | for (k = 0; k < dof; ++k) { | |||
4455 | if ((cind < cdof) && (k == cdofs[cind])) {++cind; continue;} | |||
4456 | a[k] += values[off+k]; | |||
4457 | } | |||
4458 | } else { | |||
4459 | for (k = 0; k < dof; ++k) { | |||
4460 | if ((cind < cdof) && (k == cdofs[cind])) {++cind; continue;} | |||
4461 | a[k] += values[off+dof-k-1]; | |||
4462 | } | |||
4463 | } | |||
4464 | } | |||
4465 | } | |||
4466 | } | |||
4467 | ierr = VecRestoreArray(v, &array);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 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4469 | } | |||
4470 | ||||
4471 | /*@C | |||
4472 | DMPlexVecSetClosure - Set an array of the values on the closure of 'point' | |||
4473 | ||||
4474 | Not collective | |||
4475 | ||||
4476 | Input Parameters: | |||
4477 | + dm - The DM | |||
4478 | . section - The section describing the layout in v, or NULL to use the default section | |||
4479 | . v - The local vector | |||
4480 | . point - The point in the DM | |||
4481 | . values - The array of values | |||
4482 | - mode - The insert mode. One of INSERT_ALL_VALUES, ADD_ALL_VALUES, INSERT_VALUES, ADD_VALUES, INSERT_BC_VALUES, and ADD_BC_VALUES, | |||
4483 | where INSERT_ALL_VALUES and ADD_ALL_VALUES also overwrite boundary conditions. | |||
4484 | ||||
4485 | Fortran Notes: | |||
4486 | This routine is only available in Fortran 90, and you must include petsc.h90 in your code. | |||
4487 | ||||
4488 | Level: intermediate | |||
4489 | ||||
4490 | .seealso DMPlexVecGetClosure(), DMPlexMatSetClosure() | |||
4491 | @*/ | |||
4492 | PetscErrorCode DMPlexVecSetClosure(DM dm, PetscSection section, Vec v, PetscInt point, const PetscScalar values[], InsertMode mode) | |||
4493 | { | |||
4494 | PetscSection clSection; | |||
4495 | IS clPoints; | |||
4496 | PetscScalar *array; | |||
4497 | PetscInt *points = NULL((void*)0); | |||
4498 | const PetscInt *clp, *clperm; | |||
4499 | PetscInt depth, numFields, numPoints, p; | |||
4500 | PetscErrorCode ierr; | |||
4501 | ||||
4502 | 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] = 4502; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); | |||
4503 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),4503,__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),4503 ,__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),4503,__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),4503,__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); | |||
4504 | if (!section) {ierr = DMGetSection(dm, §ion);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4504,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
4505 | PetscValidHeaderSpecific(section, PETSC_SECTION_CLASSID, 2)do { if (!section) return PetscError(((MPI_Comm)0x44000001),4505 ,__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),4505,__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),4505,__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),4505,__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); | |||
4506 | PetscValidHeaderSpecific(v, VEC_CLASSID, 3)do { if (!v) return PetscError(((MPI_Comm)0x44000001),4506,__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),4506 ,__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),4506,__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),4506,__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); | |||
4507 | ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4507,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4508 | ierr = PetscSectionGetNumFields(section, &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4508,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4509 | if (depth == 1 && numFields < 2 && mode == ADD_VALUES) { | |||
4510 | ierr = DMPlexVecSetClosure_Depth1_Static(dm, section, v, point, values, mode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4510,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4511 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4512 | } | |||
4513 | /* Get points */ | |||
4514 | ierr = PetscSectionGetClosureInversePermutation_Internal(section, (PetscObject) dm, NULL((void*)0), &clperm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4514,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4515 | ierr = DMPlexGetCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4515,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4516 | /* Get array */ | |||
4517 | ierr = VecGetArray(v, &array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4517,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4518 | /* Get values */ | |||
4519 | if (numFields > 0) { | |||
4520 | PetscInt offset = 0, f; | |||
4521 | for (f = 0; f < numFields; ++f) { | |||
4522 | const PetscInt **perms = NULL((void*)0); | |||
4523 | const PetscScalar **flips = NULL((void*)0); | |||
4524 | ||||
4525 | ierr = PetscSectionGetFieldPointSyms(section,f,numPoints,points,&perms,&flips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4525,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4526 | switch (mode) { | |||
4527 | case INSERT_VALUES: | |||
4528 | for (p = 0; p < numPoints; p++) { | |||
4529 | const PetscInt point = points[2*p]; | |||
4530 | const PetscInt *perm = perms ? perms[p] : NULL((void*)0); | |||
4531 | const PetscScalar *flip = flips ? flips[p] : NULL((void*)0); | |||
4532 | updatePointFields_private(section, point, perm, flip, f, insert, PETSC_FALSE, clperm, values, &offset, array); | |||
4533 | } break; | |||
4534 | case INSERT_ALL_VALUES: | |||
4535 | for (p = 0; p < numPoints; p++) { | |||
4536 | const PetscInt point = points[2*p]; | |||
4537 | const PetscInt *perm = perms ? perms[p] : NULL((void*)0); | |||
4538 | const PetscScalar *flip = flips ? flips[p] : NULL((void*)0); | |||
4539 | updatePointFields_private(section, point, perm, flip, f, insert, PETSC_TRUE, clperm, values, &offset, array); | |||
4540 | } break; | |||
4541 | case INSERT_BC_VALUES: | |||
4542 | for (p = 0; p < numPoints; p++) { | |||
4543 | const PetscInt point = points[2*p]; | |||
4544 | const PetscInt *perm = perms ? perms[p] : NULL((void*)0); | |||
4545 | const PetscScalar *flip = flips ? flips[p] : NULL((void*)0); | |||
4546 | updatePointFieldsBC_private(section, point, perm, flip, f, -1, NULL((void*)0), insert, clperm, values, &offset, array); | |||
4547 | } break; | |||
4548 | case ADD_VALUES: | |||
4549 | for (p = 0; p < numPoints; p++) { | |||
4550 | const PetscInt point = points[2*p]; | |||
4551 | const PetscInt *perm = perms ? perms[p] : NULL((void*)0); | |||
4552 | const PetscScalar *flip = flips ? flips[p] : NULL((void*)0); | |||
4553 | updatePointFields_private(section, point, perm, flip, f, add, PETSC_FALSE, clperm, values, &offset, array); | |||
4554 | } break; | |||
4555 | case ADD_ALL_VALUES: | |||
4556 | for (p = 0; p < numPoints; p++) { | |||
4557 | const PetscInt point = points[2*p]; | |||
4558 | const PetscInt *perm = perms ? perms[p] : NULL((void*)0); | |||
4559 | const PetscScalar *flip = flips ? flips[p] : NULL((void*)0); | |||
4560 | updatePointFields_private(section, point, perm, flip, f, add, PETSC_TRUE, clperm, values, &offset, array); | |||
4561 | } break; | |||
4562 | case ADD_BC_VALUES: | |||
4563 | for (p = 0; p < numPoints; p++) { | |||
4564 | const PetscInt point = points[2*p]; | |||
4565 | const PetscInt *perm = perms ? perms[p] : NULL((void*)0); | |||
4566 | const PetscScalar *flip = flips ? flips[p] : NULL((void*)0); | |||
4567 | updatePointFieldsBC_private(section, point, perm, flip, f, -1, NULL((void*)0), add, clperm, values, &offset, array); | |||
4568 | } break; | |||
4569 | default: | |||
4570 | SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Invalid insert mode %d", mode)return PetscError(PetscObjectComm((PetscObject)dm),4570,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63, PETSC_ERROR_INITIAL,"Invalid insert mode %d",mode); | |||
4571 | } | |||
4572 | ierr = PetscSectionRestoreFieldPointSyms(section,f,numPoints,points,&perms,&flips);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 | } | |||
4574 | } else { | |||
4575 | PetscInt dof, off; | |||
4576 | const PetscInt **perms = NULL((void*)0); | |||
4577 | const PetscScalar **flips = NULL((void*)0); | |||
4578 | ||||
4579 | ierr = PetscSectionGetPointSyms(section,numPoints,points,&perms,&flips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4579,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4580 | switch (mode) { | |||
4581 | case INSERT_VALUES: | |||
4582 | for (p = 0, off = 0; p < numPoints; p++, off += dof) { | |||
4583 | const PetscInt point = points[2*p]; | |||
4584 | const PetscInt *perm = perms ? perms[p] : NULL((void*)0); | |||
4585 | const PetscScalar *flip = flips ? flips[p] : NULL((void*)0); | |||
4586 | ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4586,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4587 | updatePoint_private(section, point, dof, insert, PETSC_FALSE, perm, flip, clperm, values, off, array); | |||
4588 | } break; | |||
4589 | case INSERT_ALL_VALUES: | |||
4590 | for (p = 0, off = 0; p < numPoints; p++, off += dof) { | |||
4591 | const PetscInt point = points[2*p]; | |||
4592 | const PetscInt *perm = perms ? perms[p] : NULL((void*)0); | |||
4593 | const PetscScalar *flip = flips ? flips[p] : NULL((void*)0); | |||
4594 | ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4594,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4595 | updatePoint_private(section, point, dof, insert, PETSC_TRUE, perm, flip, clperm, values, off, array); | |||
4596 | } break; | |||
4597 | case INSERT_BC_VALUES: | |||
4598 | for (p = 0, off = 0; p < numPoints; p++, off += dof) { | |||
4599 | const PetscInt point = points[2*p]; | |||
4600 | const PetscInt *perm = perms ? perms[p] : NULL((void*)0); | |||
4601 | const PetscScalar *flip = flips ? flips[p] : NULL((void*)0); | |||
4602 | ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4602,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4603 | updatePointBC_private(section, point, dof, insert, perm, flip, clperm, values, off, array); | |||
4604 | } break; | |||
4605 | case ADD_VALUES: | |||
4606 | for (p = 0, off = 0; p < numPoints; p++, off += dof) { | |||
4607 | const PetscInt point = points[2*p]; | |||
4608 | const PetscInt *perm = perms ? perms[p] : NULL((void*)0); | |||
4609 | const PetscScalar *flip = flips ? flips[p] : NULL((void*)0); | |||
4610 | ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4610,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4611 | updatePoint_private(section, point, dof, add, PETSC_FALSE, perm, flip, clperm, values, off, array); | |||
4612 | } break; | |||
4613 | case ADD_ALL_VALUES: | |||
4614 | for (p = 0, off = 0; p < numPoints; p++, off += dof) { | |||
4615 | const PetscInt point = points[2*p]; | |||
4616 | const PetscInt *perm = perms ? perms[p] : NULL((void*)0); | |||
4617 | const PetscScalar *flip = flips ? flips[p] : NULL((void*)0); | |||
4618 | ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4618,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4619 | updatePoint_private(section, point, dof, add, PETSC_TRUE, perm, flip, clperm, values, off, array); | |||
4620 | } break; | |||
4621 | case ADD_BC_VALUES: | |||
4622 | for (p = 0, off = 0; p < numPoints; p++, off += dof) { | |||
4623 | const PetscInt point = points[2*p]; | |||
4624 | const PetscInt *perm = perms ? perms[p] : NULL((void*)0); | |||
4625 | const PetscScalar *flip = flips ? flips[p] : NULL((void*)0); | |||
4626 | ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4626,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4627 | updatePointBC_private(section, point, dof, add, perm, flip, clperm, values, off, array); | |||
4628 | } break; | |||
4629 | default: | |||
4630 | SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Invalid insert mode %d", mode)return PetscError(PetscObjectComm((PetscObject)dm),4630,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63, PETSC_ERROR_INITIAL,"Invalid insert mode %d",mode); | |||
4631 | } | |||
4632 | ierr = PetscSectionRestorePointSyms(section,numPoints,points,&perms,&flips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4632,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4633 | } | |||
4634 | /* Cleanup points */ | |||
4635 | ierr = DMPlexRestoreCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4635,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4636 | /* Cleanup array */ | |||
4637 | ierr = VecRestoreArray(v, &array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4637,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4638 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4639 | } | |||
4640 | ||||
4641 | PetscErrorCode DMPlexVecSetFieldClosure_Internal(DM dm, PetscSection section, Vec v, PetscBool fieldActive[], PetscInt point, PetscInt Ncc, const PetscInt comps[], const PetscScalar values[], InsertMode mode) | |||
4642 | { | |||
4643 | PetscSection clSection; | |||
4644 | IS clPoints; | |||
4645 | PetscScalar *array; | |||
4646 | PetscInt *points = NULL((void*)0); | |||
4647 | const PetscInt *clp, *clperm; | |||
4648 | PetscInt numFields, numPoints, p; | |||
4649 | PetscInt offset = 0, f; | |||
4650 | PetscErrorCode ierr; | |||
4651 | ||||
4652 | 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] = 4652; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); | |||
4653 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),4653,__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),4653 ,__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),4653,__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),4653,__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); | |||
4654 | if (!section) {ierr = DMGetSection(dm, §ion);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4654,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
4655 | PetscValidHeaderSpecific(section, PETSC_SECTION_CLASSID, 2)do { if (!section) return PetscError(((MPI_Comm)0x44000001),4655 ,__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),4655,__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),4655,__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),4655,__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); | |||
4656 | PetscValidHeaderSpecific(v, VEC_CLASSID, 3)do { if (!v) return PetscError(((MPI_Comm)0x44000001),4656,__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),4656 ,__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),4656,__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),4656,__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); | |||
4657 | ierr = PetscSectionGetNumFields(section, &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4657,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4658 | /* Get points */ | |||
4659 | ierr = PetscSectionGetClosureInversePermutation_Internal(section, (PetscObject) dm, NULL((void*)0), &clperm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4659,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4660 | ierr = DMPlexGetCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4660,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4661 | /* Get array */ | |||
4662 | ierr = VecGetArray(v, &array);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 | /* Get values */ | |||
4664 | for (f = 0; f < numFields; ++f) { | |||
4665 | const PetscInt **perms = NULL((void*)0); | |||
4666 | const PetscScalar **flips = NULL((void*)0); | |||
4667 | ||||
4668 | if (!fieldActive[f]) { | |||
4669 | for (p = 0; p < numPoints*2; p += 2) { | |||
4670 | PetscInt fdof; | |||
4671 | ierr = PetscSectionGetFieldDof(section, points[p], f, &fdof);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 | offset += fdof; | |||
4673 | } | |||
4674 | continue; | |||
4675 | } | |||
4676 | ierr = PetscSectionGetFieldPointSyms(section,f,numPoints,points,&perms,&flips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4676,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4677 | switch (mode) { | |||
4678 | case INSERT_VALUES: | |||
4679 | for (p = 0; p < numPoints; p++) { | |||
4680 | const PetscInt point = points[2*p]; | |||
4681 | const PetscInt *perm = perms ? perms[p] : NULL((void*)0); | |||
4682 | const PetscScalar *flip = flips ? flips[p] : NULL((void*)0); | |||
4683 | updatePointFields_private(section, point, perm, flip, f, insert, PETSC_FALSE, clperm, values, &offset, array); | |||
4684 | } break; | |||
4685 | case INSERT_ALL_VALUES: | |||
4686 | for (p = 0; p < numPoints; p++) { | |||
4687 | const PetscInt point = points[2*p]; | |||
4688 | const PetscInt *perm = perms ? perms[p] : NULL((void*)0); | |||
4689 | const PetscScalar *flip = flips ? flips[p] : NULL((void*)0); | |||
4690 | updatePointFields_private(section, point, perm, flip, f, insert, PETSC_TRUE, clperm, values, &offset, array); | |||
4691 | } break; | |||
4692 | case INSERT_BC_VALUES: | |||
4693 | for (p = 0; p < numPoints; p++) { | |||
4694 | const PetscInt point = points[2*p]; | |||
4695 | const PetscInt *perm = perms ? perms[p] : NULL((void*)0); | |||
4696 | const PetscScalar *flip = flips ? flips[p] : NULL((void*)0); | |||
4697 | updatePointFieldsBC_private(section, point, perm, flip, f, Ncc, comps, insert, clperm, values, &offset, array); | |||
4698 | } break; | |||
4699 | case ADD_VALUES: | |||
4700 | for (p = 0; p < numPoints; p++) { | |||
4701 | const PetscInt point = points[2*p]; | |||
4702 | const PetscInt *perm = perms ? perms[p] : NULL((void*)0); | |||
4703 | const PetscScalar *flip = flips ? flips[p] : NULL((void*)0); | |||
4704 | updatePointFields_private(section, point, perm, flip, f, add, PETSC_FALSE, clperm, values, &offset, array); | |||
4705 | } break; | |||
4706 | case ADD_ALL_VALUES: | |||
4707 | for (p = 0; p < numPoints; p++) { | |||
4708 | const PetscInt point = points[2*p]; | |||
4709 | const PetscInt *perm = perms ? perms[p] : NULL((void*)0); | |||
4710 | const PetscScalar *flip = flips ? flips[p] : NULL((void*)0); | |||
4711 | updatePointFields_private(section, point, perm, flip, f, add, PETSC_TRUE, clperm, values, &offset, array); | |||
4712 | } break; | |||
4713 | default: | |||
4714 | SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Invalid insert mode %d", mode)return PetscError(PetscObjectComm((PetscObject)dm),4714,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63, PETSC_ERROR_INITIAL,"Invalid insert mode %d",mode); | |||
4715 | } | |||
4716 | ierr = PetscSectionRestoreFieldPointSyms(section,f,numPoints,points,&perms,&flips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4716,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4717 | } | |||
4718 | /* Cleanup points */ | |||
4719 | ierr = DMPlexRestoreCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4719,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4720 | /* Cleanup array */ | |||
4721 | ierr = VecRestoreArray(v, &array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4721,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4722 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4723 | } | |||
4724 | ||||
4725 | static PetscErrorCode DMPlexPrintMatSetValues(PetscViewer viewer, Mat A, PetscInt point, PetscInt numRIndices, const PetscInt rindices[], PetscInt numCIndices, const PetscInt cindices[], const PetscScalar values[]) | |||
4726 | { | |||
4727 | PetscMPIInt rank; | |||
4728 | PetscInt i, j; | |||
4729 | PetscErrorCode ierr; | |||
4730 | ||||
4731 | 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] = 4731; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4732 | ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)A), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4732,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4733 | ierr = PetscViewerASCIIPrintf(viewer, "[%d]mat for point %D\n", rank, point);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4733,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4734 | 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),4734,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
4735 | 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),4735,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
4736 | numCIndices = numCIndices ? numCIndices : numRIndices; | |||
4737 | for (i = 0; i < numRIndices; i++) { | |||
4738 | ierr = PetscViewerASCIIPrintf(viewer, "[%d]", rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4738,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4739 | for (j = 0; j < numCIndices; j++) { | |||
4740 | #if defined(PETSC_USE_COMPLEX) | |||
4741 | 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),4741,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4742 | #else | |||
4743 | ierr = PetscViewerASCIIPrintf(viewer, " %g", (double)values[i*numCIndices+j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4743,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4744 | #endif | |||
4745 | } | |||
4746 | ierr = PetscViewerASCIIPrintf(viewer, "\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4746,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4747 | } | |||
4748 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4749 | } | |||
4750 | ||||
4751 | /* . off - The global offset of this point */ | |||
4752 | PetscErrorCode DMPlexGetIndicesPoint_Internal(PetscSection section, PetscInt point, PetscInt off, PetscInt *loff, PetscBool setBC, const PetscInt perm[], PetscInt indices[]) | |||
4753 | { | |||
4754 | PetscInt dof; /* The number of unknowns on this point */ | |||
4755 | PetscInt cdof; /* The number of constraints on this point */ | |||
4756 | const PetscInt *cdofs; /* The indices of the constrained dofs on this point */ | |||
4757 | PetscInt cind = 0, k; | |||
4758 | PetscErrorCode ierr; | |||
4759 | ||||
4760 | 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] = 4760; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4761 | ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4761,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4762 | ierr = PetscSectionGetConstraintDof(section, point, &cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4762,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4763 | if (!cdof || setBC) { | |||
4764 | if (perm) { | |||
4765 | for (k = 0; k < dof; k++) indices[*loff+perm[k]] = off + k; | |||
4766 | } else { | |||
4767 | for (k = 0; k < dof; k++) indices[*loff+k] = off + k; | |||
4768 | } | |||
4769 | } else { | |||
4770 | ierr = PetscSectionGetConstraintIndices(section, point, &cdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4770,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4771 | if (perm) { | |||
4772 | for (k = 0; k < dof; ++k) { | |||
4773 | if ((cind < cdof) && (k == cdofs[cind])) { | |||
4774 | /* Insert check for returning constrained indices */ | |||
4775 | indices[*loff+perm[k]] = -(off+k+1); | |||
4776 | ++cind; | |||
4777 | } else { | |||
4778 | indices[*loff+perm[k]] = off+k-cind; | |||
4779 | } | |||
4780 | } | |||
4781 | } else { | |||
4782 | for (k = 0; k < dof; ++k) { | |||
4783 | if ((cind < cdof) && (k == cdofs[cind])) { | |||
4784 | /* Insert check for returning constrained indices */ | |||
4785 | indices[*loff+k] = -(off+k+1); | |||
4786 | ++cind; | |||
4787 | } else { | |||
4788 | indices[*loff+k] = off+k-cind; | |||
4789 | } | |||
4790 | } | |||
4791 | } | |||
4792 | } | |||
4793 | *loff += dof; | |||
4794 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4795 | } | |||
4796 | ||||
4797 | /* | |||
4798 | This version only believes the point offset from the globalSection | |||
4799 | ||||
4800 | . off - The global offset of this point | |||
4801 | */ | |||
4802 | PetscErrorCode DMPlexGetIndicesPointFields_Internal(PetscSection section, PetscInt point, PetscInt off, PetscInt foffs[], PetscBool setBC, const PetscInt ***perms, PetscInt permsoff, PetscInt indices[]) | |||
4803 | { | |||
4804 | PetscInt numFields, foff, f; | |||
4805 | PetscErrorCode ierr; | |||
4806 | ||||
4807 | 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] = 4807; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4808 | ierr = PetscSectionGetNumFields(section, &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4808,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4809 | for (f = 0, foff = 0; f < numFields; ++f) { | |||
4810 | PetscInt fdof, cfdof; | |||
4811 | const PetscInt *fcdofs; /* The indices of the constrained dofs for field f on this point */ | |||
4812 | PetscInt cind = 0, b; | |||
4813 | const PetscInt *perm = (perms && perms[f]) ? perms[f][permsoff] : NULL((void*)0); | |||
4814 | ||||
4815 | ierr = PetscSectionGetFieldDof(section, point, f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4815,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4816 | ierr = PetscSectionGetFieldConstraintDof(section, point, f, &cfdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4816,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4817 | if (!cfdof || setBC) { | |||
4818 | if (perm) {for (b = 0; b < fdof; b++) {indices[foffs[f]+perm[b]] = off+foff+b;}} | |||
4819 | else {for (b = 0; b < fdof; b++) {indices[foffs[f]+ b ] = off+foff+b;}} | |||
4820 | } else { | |||
4821 | ierr = PetscSectionGetFieldConstraintIndices(section, point, f, &fcdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4821,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4822 | if (perm) { | |||
4823 | for (b = 0; b < fdof; b++) { | |||
4824 | if ((cind < cfdof) && (b == fcdofs[cind])) { | |||
4825 | indices[foffs[f]+perm[b]] = -(off+foff+b+1); | |||
4826 | ++cind; | |||
4827 | } else { | |||
4828 | indices[foffs[f]+perm[b]] = off+foff+b-cind; | |||
4829 | } | |||
4830 | } | |||
4831 | } else { | |||
4832 | for (b = 0; b < fdof; b++) { | |||
4833 | if ((cind < cfdof) && (b == fcdofs[cind])) { | |||
4834 | indices[foffs[f]+b] = -(off+foff+b+1); | |||
4835 | ++cind; | |||
4836 | } else { | |||
4837 | indices[foffs[f]+b] = off+foff+b-cind; | |||
4838 | } | |||
4839 | } | |||
4840 | } | |||
4841 | } | |||
4842 | foff += (setBC ? fdof : (fdof - cfdof)); | |||
4843 | foffs[f] += fdof; | |||
4844 | } | |||
4845 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4846 | } | |||
4847 | ||||
4848 | /* | |||
4849 | This version believes the globalSection offsets for each field, rather than just the point offset | |||
4850 | ||||
4851 | . foffs - The offset into 'indices' for each field, since it is segregated by field | |||
4852 | */ | |||
4853 | PetscErrorCode DMPlexGetIndicesPointFieldsSplit_Internal(PetscSection section, PetscSection globalSection, PetscInt point, PetscInt foffs[], PetscBool setBC, const PetscInt ***perms, PetscInt permsoff, PetscInt indices[]) | |||
4854 | { | |||
4855 | PetscInt numFields, foff, f; | |||
4856 | PetscErrorCode ierr; | |||
4857 | ||||
4858 | 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] = 4858; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4859 | ierr = PetscSectionGetNumFields(section, &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4859,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4860 | for (f = 0; f < numFields; ++f) { | |||
4861 | PetscInt fdof, cfdof; | |||
4862 | const PetscInt *fcdofs; /* The indices of the constrained dofs for field f on this point */ | |||
4863 | PetscInt cind = 0, b; | |||
4864 | const PetscInt *perm = (perms && perms[f]) ? perms[f][permsoff] : NULL((void*)0); | |||
4865 | ||||
4866 | ierr = PetscSectionGetFieldDof(section, point, f, &fdof);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 | ierr = PetscSectionGetFieldConstraintDof(section, point, f, &cfdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4867,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4868 | ierr = PetscSectionGetFieldOffset(globalSection, point, f, &foff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4868,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4869 | if (!cfdof || setBC) { | |||
4870 | if (perm) {for (b = 0; b < fdof; b++) {indices[foffs[f]+perm[b]] = foff+b;}} | |||
4871 | else {for (b = 0; b < fdof; b++) {indices[foffs[f]+ b ] = foff+b;}} | |||
4872 | } else { | |||
4873 | ierr = PetscSectionGetFieldConstraintIndices(section, point, f, &fcdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4873,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4874 | if (perm) { | |||
4875 | for (b = 0; b < fdof; b++) { | |||
4876 | if ((cind < cfdof) && (b == fcdofs[cind])) { | |||
4877 | indices[foffs[f]+perm[b]] = -(foff+b+1); | |||
4878 | ++cind; | |||
4879 | } else { | |||
4880 | indices[foffs[f]+perm[b]] = foff+b-cind; | |||
4881 | } | |||
4882 | } | |||
4883 | } else { | |||
4884 | for (b = 0; b < fdof; b++) { | |||
4885 | if ((cind < cfdof) && (b == fcdofs[cind])) { | |||
4886 | indices[foffs[f]+b] = -(foff+b+1); | |||
4887 | ++cind; | |||
4888 | } else { | |||
4889 | indices[foffs[f]+b] = foff+b-cind; | |||
4890 | } | |||
4891 | } | |||
4892 | } | |||
4893 | } | |||
4894 | foffs[f] += fdof; | |||
4895 | } | |||
4896 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4897 | } | |||
4898 | ||||
4899 | PetscErrorCode 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) | |||
4900 | { | |||
4901 | Mat cMat; | |||
4902 | PetscSection aSec, cSec; | |||
4903 | IS aIS; | |||
4904 | PetscInt aStart = -1, aEnd = -1; | |||
4905 | const PetscInt *anchors; | |||
4906 | PetscInt numFields, f, p, q, newP = 0; | |||
4907 | PetscInt newNumPoints = 0, newNumIndices = 0; | |||
4908 | PetscInt *newPoints, *indices, *newIndices; | |||
4909 | PetscInt maxAnchor, maxDof; | |||
4910 | PetscInt newOffsets[32]; | |||
4911 | PetscInt *pointMatOffsets[32]; | |||
4912 | PetscInt *newPointOffsets[32]; | |||
4913 | PetscScalar *pointMat[32]; | |||
4914 | PetscScalar *newValues=NULL((void*)0),*tmpValues; | |||
4915 | PetscBool anyConstrained = PETSC_FALSE; | |||
4916 | PetscErrorCode ierr; | |||
4917 | ||||
4918 | 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] = 4918; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4919 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),4919,__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),4919 ,__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),4919,__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),4919,__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); | |||
4920 | PetscValidHeaderSpecific(section, PETSC_SECTION_CLASSID, 2)do { if (!section) return PetscError(((MPI_Comm)0x44000001),4920 ,__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),4920,__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),4920,__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),4920,__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); | |||
4921 | ierr = PetscSectionGetNumFields(section, &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4921,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4922 | ||||
4923 | ierr = DMPlexGetAnchors(dm,&aSec,&aIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4923,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4924 | /* if there are point-to-point constraints */ | |||
4925 | if (aSec) { | |||
4926 | ierr = PetscMemzero(newOffsets, 32 * sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4926,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4927 | ierr = ISGetIndices(aIS,&anchors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4927,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4928 | ierr = PetscSectionGetChart(aSec,&aStart,&aEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4928,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4929 | /* figure out how many points are going to be in the new element matrix | |||
4930 | * (we allow double counting, because it's all just going to be summed | |||
4931 | * into the global matrix anyway) */ | |||
4932 | for (p = 0; p < 2*numPoints; p+=2) { | |||
4933 | PetscInt b = points[p]; | |||
4934 | PetscInt bDof = 0, bSecDof; | |||
4935 | ||||
4936 | ierr = PetscSectionGetDof(section,b,&bSecDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4936,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4937 | if (!bSecDof) { | |||
4938 | continue; | |||
4939 | } | |||
4940 | if (b >= aStart && b < aEnd) { | |||
4941 | ierr = PetscSectionGetDof(aSec,b,&bDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4941,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4942 | } | |||
4943 | if (bDof) { | |||
4944 | /* this point is constrained */ | |||
4945 | /* it is going to be replaced by its anchors */ | |||
4946 | PetscInt bOff, q; | |||
4947 | ||||
4948 | anyConstrained = PETSC_TRUE; | |||
4949 | newNumPoints += bDof; | |||
4950 | ierr = PetscSectionGetOffset(aSec,b,&bOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4950,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4951 | for (q = 0; q < bDof; q++) { | |||
4952 | PetscInt a = anchors[bOff + q]; | |||
4953 | PetscInt aDof; | |||
4954 | ||||
4955 | ierr = PetscSectionGetDof(section,a,&aDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4955,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4956 | newNumIndices += aDof; | |||
4957 | for (f = 0; f < numFields; ++f) { | |||
4958 | PetscInt fDof; | |||
4959 | ||||
4960 | ierr = PetscSectionGetFieldDof(section, a, f, &fDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4960,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
4961 | newOffsets[f+1] += fDof; | |||
4962 | } | |||
4963 | } | |||
4964 | } | |||
4965 | else { | |||
4966 | /* this point is not constrained */ | |||
4967 | newNumPoints++; | |||
4968 | newNumIndices += bSecDof; | |||
4969 | for (f = 0; f < numFields; ++f) { | |||
4970 | PetscInt fDof; | |||
4971 | ||||
4972 | ierr = PetscSectionGetFieldDof(section, b, f, &fDof);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 | newOffsets[f+1] += fDof; | |||
4974 | } | |||
4975 | } | |||
4976 | } | |||
4977 | } | |||
4978 | if (!anyConstrained) { | |||
4979 | if (outNumPoints) *outNumPoints = 0; | |||
4980 | if (outNumIndices) *outNumIndices = 0; | |||
4981 | if (outPoints) *outPoints = NULL((void*)0); | |||
4982 | if (outValues) *outValues = NULL((void*)0); | |||
4983 | if (aSec) {ierr = ISRestoreIndices(aIS,&anchors);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 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4985 | } | |||
4986 | ||||
4987 | if (outNumPoints) *outNumPoints = newNumPoints; | |||
4988 | if (outNumIndices) *outNumIndices = newNumIndices; | |||
4989 | ||||
4990 | for (f = 0; f < numFields; ++f) newOffsets[f+1] += newOffsets[f]; | |||
4991 | ||||
4992 | if (!outPoints && !outValues) { | |||
4993 | if (offsets) { | |||
4994 | for (f = 0; f <= numFields; f++) { | |||
4995 | offsets[f] = newOffsets[f]; | |||
4996 | } | |||
4997 | } | |||
4998 | if (aSec) {ierr = ISRestoreIndices(aIS,&anchors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),4998,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
4999 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
5000 | } | |||
5001 | ||||
5002 | 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),5002,__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); | |||
5003 | ||||
5004 | ierr = DMGetDefaultConstraints(dm, &cSec, &cMat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5004,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5005 | ||||
5006 | /* workspaces */ | |||
5007 | if (numFields) { | |||
5008 | for (f = 0; f < numFields; f++) { | |||
5009 | 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),5009,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5010 | 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),5010,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5011 | } | |||
5012 | } | |||
5013 | else { | |||
5014 | 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),5014,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5015 | ierr = DMGetWorkArray(dm,numPoints,MPIU_INT((MPI_Datatype)0x4c000405),&newPointOffsets[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5015,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5016 | } | |||
5017 | ||||
5018 | /* get workspaces for the point-to-point matrices */ | |||
5019 | if (numFields) { | |||
5020 | PetscInt totalOffset, totalMatOffset; | |||
5021 | ||||
5022 | for (p = 0; p < numPoints; p++) { | |||
5023 | PetscInt b = points[2*p]; | |||
5024 | PetscInt bDof = 0, bSecDof; | |||
5025 | ||||
5026 | ierr = PetscSectionGetDof(section,b,&bSecDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5026,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5027 | if (!bSecDof) { | |||
5028 | for (f = 0; f < numFields; f++) { | |||
5029 | newPointOffsets[f][p + 1] = 0; | |||
5030 | pointMatOffsets[f][p + 1] = 0; | |||
5031 | } | |||
5032 | continue; | |||
5033 | } | |||
5034 | if (b >= aStart && b < aEnd) { | |||
5035 | ierr = PetscSectionGetDof(aSec, b, &bDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5035,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5036 | } | |||
5037 | if (bDof) { | |||
5038 | for (f = 0; f < numFields; f++) { | |||
5039 | PetscInt fDof, q, bOff, allFDof = 0; | |||
5040 | ||||
5041 | ierr = PetscSectionGetFieldDof(section, b, f, &fDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5041,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5042 | ierr = PetscSectionGetOffset(aSec, b, &bOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5042,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5043 | for (q = 0; q < bDof; q++) { | |||
5044 | PetscInt a = anchors[bOff + q]; | |||
5045 | PetscInt aFDof; | |||
5046 | ||||
5047 | ierr = PetscSectionGetFieldDof(section, a, f, &aFDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5047,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5048 | allFDof += aFDof; | |||
5049 | } | |||
5050 | newPointOffsets[f][p+1] = allFDof; | |||
5051 | pointMatOffsets[f][p+1] = fDof * allFDof; | |||
5052 | } | |||
5053 | } | |||
5054 | else { | |||
5055 | for (f = 0; f < numFields; f++) { | |||
5056 | PetscInt fDof; | |||
5057 | ||||
5058 | ierr = PetscSectionGetFieldDof(section, b, f, &fDof);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 | newPointOffsets[f][p+1] = fDof; | |||
5060 | pointMatOffsets[f][p+1] = 0; | |||
5061 | } | |||
5062 | } | |||
5063 | } | |||
5064 | for (f = 0, totalOffset = 0, totalMatOffset = 0; f < numFields; f++) { | |||
5065 | newPointOffsets[f][0] = totalOffset; | |||
5066 | pointMatOffsets[f][0] = totalMatOffset; | |||
5067 | for (p = 0; p < numPoints; p++) { | |||
5068 | newPointOffsets[f][p+1] += newPointOffsets[f][p]; | |||
5069 | pointMatOffsets[f][p+1] += pointMatOffsets[f][p]; | |||
5070 | } | |||
5071 | totalOffset = newPointOffsets[f][numPoints]; | |||
5072 | totalMatOffset = pointMatOffsets[f][numPoints]; | |||
5073 | 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),5073,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5074 | } | |||
5075 | } | |||
5076 | else { | |||
5077 | for (p = 0; p < numPoints; p++) { | |||
5078 | PetscInt b = points[2*p]; | |||
5079 | PetscInt bDof = 0, bSecDof; | |||
5080 | ||||
5081 | ierr = PetscSectionGetDof(section,b,&bSecDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5081,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5082 | if (!bSecDof) { | |||
5083 | newPointOffsets[0][p + 1] = 0; | |||
5084 | pointMatOffsets[0][p + 1] = 0; | |||
5085 | continue; | |||
5086 | } | |||
5087 | if (b >= aStart && b < aEnd) { | |||
5088 | ierr = PetscSectionGetDof(aSec, b, &bDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5088,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5089 | } | |||
5090 | if (bDof) { | |||
5091 | PetscInt bOff, q, allDof = 0; | |||
5092 | ||||
5093 | ierr = PetscSectionGetOffset(aSec, b, &bOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5093,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5094 | for (q = 0; q < bDof; q++) { | |||
5095 | PetscInt a = anchors[bOff + q], aDof; | |||
5096 | ||||
5097 | ierr = PetscSectionGetDof(section, a, &aDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5097,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5098 | allDof += aDof; | |||
5099 | } | |||
5100 | newPointOffsets[0][p+1] = allDof; | |||
5101 | pointMatOffsets[0][p+1] = bSecDof * allDof; | |||
5102 | } | |||
5103 | else { | |||
5104 | newPointOffsets[0][p+1] = bSecDof; | |||
5105 | pointMatOffsets[0][p+1] = 0; | |||
5106 | } | |||
5107 | } | |||
5108 | newPointOffsets[0][0] = 0; | |||
5109 | pointMatOffsets[0][0] = 0; | |||
5110 | for (p = 0; p < numPoints; p++) { | |||
5111 | newPointOffsets[0][p+1] += newPointOffsets[0][p]; | |||
5112 | pointMatOffsets[0][p+1] += pointMatOffsets[0][p]; | |||
5113 | } | |||
5114 | 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),5114,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5115 | } | |||
5116 | ||||
5117 | /* output arrays */ | |||
5118 | ierr = DMGetWorkArray(dm,2*newNumPoints,MPIU_INT((MPI_Datatype)0x4c000405),&newPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5118,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5119 | ||||
5120 | /* get the point-to-point matrices; construct newPoints */ | |||
5121 | ierr = PetscSectionGetMaxDof(aSec, &maxAnchor);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5121,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5122 | ierr = PetscSectionGetMaxDof(section, &maxDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5122,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5123 | ierr = DMGetWorkArray(dm,maxDof,MPIU_INT((MPI_Datatype)0x4c000405),&indices);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 | ierr = DMGetWorkArray(dm,maxAnchor*maxDof,MPIU_INT((MPI_Datatype)0x4c000405),&newIndices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5124,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5125 | if (numFields) { | |||
5126 | for (p = 0, newP = 0; p < numPoints; p++) { | |||
5127 | PetscInt b = points[2*p]; | |||
5128 | PetscInt o = points[2*p+1]; | |||
5129 | PetscInt bDof = 0, bSecDof; | |||
5130 | ||||
5131 | ierr = PetscSectionGetDof(section, b, &bSecDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5131,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5132 | if (!bSecDof) { | |||
5133 | continue; | |||
5134 | } | |||
5135 | if (b >= aStart && b < aEnd) { | |||
5136 | ierr = PetscSectionGetDof(aSec, b, &bDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5136,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5137 | } | |||
5138 | if (bDof) { | |||
5139 | PetscInt fStart[32], fEnd[32], fAnchorStart[32], fAnchorEnd[32], bOff, q; | |||
5140 | ||||
5141 | fStart[0] = 0; | |||
5142 | fEnd[0] = 0; | |||
5143 | for (f = 0; f < numFields; f++) { | |||
5144 | PetscInt fDof; | |||
5145 | ||||
5146 | ierr = PetscSectionGetFieldDof(cSec, b, f, &fDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5146,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5147 | fStart[f+1] = fStart[f] + fDof; | |||
5148 | fEnd[f+1] = fStart[f+1]; | |||
5149 | } | |||
5150 | ierr = PetscSectionGetOffset(cSec, b, &bOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5150,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5151 | ierr = DMPlexGetIndicesPointFields_Internal(cSec, b, bOff, fEnd, PETSC_TRUE, perms, p, indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5151,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5152 | ||||
5153 | fAnchorStart[0] = 0; | |||
5154 | fAnchorEnd[0] = 0; | |||
5155 | for (f = 0; f < numFields; f++) { | |||
5156 | PetscInt fDof = newPointOffsets[f][p + 1] - newPointOffsets[f][p]; | |||
5157 | ||||
5158 | fAnchorStart[f+1] = fAnchorStart[f] + fDof; | |||
5159 | fAnchorEnd[f+1] = fAnchorStart[f + 1]; | |||
5160 | } | |||
5161 | ierr = PetscSectionGetOffset(aSec, b, &bOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5161,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5162 | for (q = 0; q < bDof; q++) { | |||
5163 | PetscInt a = anchors[bOff + q], aOff; | |||
5164 | ||||
5165 | /* we take the orientation of ap into account in the order that we constructed the indices above: the newly added points have no orientation */ | |||
5166 | newPoints[2*(newP + q)] = a; | |||
5167 | newPoints[2*(newP + q) + 1] = 0; | |||
5168 | ierr = PetscSectionGetOffset(section, a, &aOff);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 = DMPlexGetIndicesPointFields_Internal(section, a, aOff, fAnchorEnd, PETSC_TRUE, NULL((void*)0), -1, newIndices);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 | } | |||
5171 | newP += bDof; | |||
5172 | ||||
5173 | if (outValues) { | |||
5174 | /* get the point-to-point submatrix */ | |||
5175 | for (f = 0; f < numFields; f++) { | |||
5176 | 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),5176,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5177 | } | |||
5178 | } | |||
5179 | } | |||
5180 | else { | |||
5181 | newPoints[2 * newP] = b; | |||
5182 | newPoints[2 * newP + 1] = o; | |||
5183 | newP++; | |||
5184 | } | |||
5185 | } | |||
5186 | } else { | |||
5187 | for (p = 0; p < numPoints; p++) { | |||
5188 | PetscInt b = points[2*p]; | |||
5189 | PetscInt o = points[2*p+1]; | |||
5190 | PetscInt bDof = 0, bSecDof; | |||
5191 | ||||
5192 | ierr = PetscSectionGetDof(section, b, &bSecDof);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 | if (!bSecDof) { | |||
5194 | continue; | |||
5195 | } | |||
5196 | if (b >= aStart && b < aEnd) { | |||
5197 | ierr = PetscSectionGetDof(aSec, b, &bDof);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 | } | |||
5199 | if (bDof) { | |||
5200 | PetscInt bEnd = 0, bAnchorEnd = 0, bOff; | |||
5201 | ||||
5202 | ierr = PetscSectionGetOffset(cSec, b, &bOff);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 | ierr = DMPlexGetIndicesPoint_Internal(cSec, b, bOff, &bEnd, PETSC_TRUE, (perms && perms[0]) ? perms[0][p] : NULL((void*)0), indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5203,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5204 | ||||
5205 | ierr = PetscSectionGetOffset (aSec, b, &bOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5205,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5206 | for (q = 0; q < bDof; q++) { | |||
5207 | PetscInt a = anchors[bOff + q], aOff; | |||
5208 | ||||
5209 | /* we take the orientation of ap into account in the order that we constructed the indices above: the newly added points have no orientation */ | |||
5210 | ||||
5211 | newPoints[2*(newP + q)] = a; | |||
5212 | newPoints[2*(newP + q) + 1] = 0; | |||
5213 | ierr = PetscSectionGetOffset(section, a, &aOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5213,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5214 | ierr = DMPlexGetIndicesPoint_Internal(section, a, aOff, &bAnchorEnd, PETSC_TRUE, NULL((void*)0), newIndices);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 | } | |||
5216 | newP += bDof; | |||
5217 | ||||
5218 | /* get the point-to-point submatrix */ | |||
5219 | if (outValues) { | |||
5220 | 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),5220,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5221 | } | |||
5222 | } | |||
5223 | else { | |||
5224 | newPoints[2 * newP] = b; | |||
5225 | newPoints[2 * newP + 1] = o; | |||
5226 | newP++; | |||
5227 | } | |||
5228 | } | |||
5229 | } | |||
5230 | ||||
5231 | if (outValues) { | |||
5232 | ierr = DMGetWorkArray(dm,newNumIndices*numIndices,MPIU_SCALAR((MPI_Datatype)0x4c00080b),&tmpValues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5232,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5233 | ierr = PetscMemzero(tmpValues,newNumIndices*numIndices*sizeof(*tmpValues));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5233,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5234 | /* multiply constraints on the right */ | |||
5235 | if (numFields) { | |||
5236 | for (f = 0; f < numFields; f++) { | |||
5237 | PetscInt oldOff = offsets[f]; | |||
5238 | ||||
5239 | for (p = 0; p < numPoints; p++) { | |||
5240 | PetscInt cStart = newPointOffsets[f][p]; | |||
5241 | PetscInt b = points[2 * p]; | |||
5242 | PetscInt c, r, k; | |||
5243 | PetscInt dof; | |||
5244 | ||||
5245 | ierr = PetscSectionGetFieldDof(section,b,f,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5245,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5246 | if (!dof) { | |||
5247 | continue; | |||
5248 | } | |||
5249 | if (pointMatOffsets[f][p] < pointMatOffsets[f][p + 1]) { | |||
5250 | PetscInt nCols = newPointOffsets[f][p+1]-cStart; | |||
5251 | const PetscScalar *mat = pointMat[f] + pointMatOffsets[f][p]; | |||
5252 | ||||
5253 | for (r = 0; r < numIndices; r++) { | |||
5254 | for (c = 0; c < nCols; c++) { | |||
5255 | for (k = 0; k < dof; k++) { | |||
5256 | tmpValues[r * newNumIndices + cStart + c] += values[r * numIndices + oldOff + k] * mat[k * nCols + c]; | |||
5257 | } | |||
5258 | } | |||
5259 | } | |||
5260 | } | |||
5261 | else { | |||
5262 | /* copy this column as is */ | |||
5263 | for (r = 0; r < numIndices; r++) { | |||
5264 | for (c = 0; c < dof; c++) { | |||
5265 | tmpValues[r * newNumIndices + cStart + c] = values[r * numIndices + oldOff + c]; | |||
5266 | } | |||
5267 | } | |||
5268 | } | |||
5269 | oldOff += dof; | |||
5270 | } | |||
5271 | } | |||
5272 | } | |||
5273 | else { | |||
5274 | PetscInt oldOff = 0; | |||
5275 | for (p = 0; p < numPoints; p++) { | |||
5276 | PetscInt cStart = newPointOffsets[0][p]; | |||
5277 | PetscInt b = points[2 * p]; | |||
5278 | PetscInt c, r, k; | |||
5279 | PetscInt dof; | |||
5280 | ||||
5281 | ierr = PetscSectionGetDof(section,b,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5281,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5282 | if (!dof) { | |||
5283 | continue; | |||
5284 | } | |||
5285 | if (pointMatOffsets[0][p] < pointMatOffsets[0][p + 1]) { | |||
5286 | PetscInt nCols = newPointOffsets[0][p+1]-cStart; | |||
5287 | const PetscScalar *mat = pointMat[0] + pointMatOffsets[0][p]; | |||
5288 | ||||
5289 | for (r = 0; r < numIndices; r++) { | |||
5290 | for (c = 0; c < nCols; c++) { | |||
5291 | for (k = 0; k < dof; k++) { | |||
5292 | tmpValues[r * newNumIndices + cStart + c] += mat[k * nCols + c] * values[r * numIndices + oldOff + k]; | |||
5293 | } | |||
5294 | } | |||
5295 | } | |||
5296 | } | |||
5297 | else { | |||
5298 | /* copy this column as is */ | |||
5299 | for (r = 0; r < numIndices; r++) { | |||
5300 | for (c = 0; c < dof; c++) { | |||
5301 | tmpValues[r * newNumIndices + cStart + c] = values[r * numIndices + oldOff + c]; | |||
5302 | } | |||
5303 | } | |||
5304 | } | |||
5305 | oldOff += dof; | |||
5306 | } | |||
5307 | } | |||
5308 | ||||
5309 | if (multiplyLeft) { | |||
5310 | ierr = DMGetWorkArray(dm,newNumIndices*newNumIndices,MPIU_SCALAR((MPI_Datatype)0x4c00080b),&newValues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5310,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5311 | ierr = PetscMemzero(newValues,newNumIndices*newNumIndices*sizeof(*newValues));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5311,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5312 | /* multiply constraints transpose on the left */ | |||
5313 | if (numFields) { | |||
5314 | for (f = 0; f < numFields; f++) { | |||
5315 | PetscInt oldOff = offsets[f]; | |||
5316 | ||||
5317 | for (p = 0; p < numPoints; p++) { | |||
5318 | PetscInt rStart = newPointOffsets[f][p]; | |||
5319 | PetscInt b = points[2 * p]; | |||
5320 | PetscInt c, r, k; | |||
5321 | PetscInt dof; | |||
5322 | ||||
5323 | ierr = PetscSectionGetFieldDof(section,b,f,&dof);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 (pointMatOffsets[f][p] < pointMatOffsets[f][p + 1]) { | |||
5325 | PetscInt nRows = newPointOffsets[f][p+1]-rStart; | |||
5326 | const PetscScalar *PETSC_RESTRICT__restrict mat = pointMat[f] + pointMatOffsets[f][p]; | |||
5327 | ||||
5328 | for (r = 0; r < nRows; r++) { | |||
5329 | for (c = 0; c < newNumIndices; c++) { | |||
5330 | for (k = 0; k < dof; k++) { | |||
5331 | newValues[(rStart + r) * newNumIndices + c] += mat[k * nRows + r] * tmpValues[(oldOff + k) * newNumIndices + c]; | |||
5332 | } | |||
5333 | } | |||
5334 | } | |||
5335 | } | |||
5336 | else { | |||
5337 | /* copy this row as is */ | |||
5338 | for (r = 0; r < dof; r++) { | |||
5339 | for (c = 0; c < newNumIndices; c++) { | |||
5340 | newValues[(rStart + r) * newNumIndices + c] = tmpValues[(oldOff + r) * newNumIndices + c]; | |||
5341 | } | |||
5342 | } | |||
5343 | } | |||
5344 | oldOff += dof; | |||
5345 | } | |||
5346 | } | |||
5347 | } | |||
5348 | else { | |||
5349 | PetscInt oldOff = 0; | |||
5350 | ||||
5351 | for (p = 0; p < numPoints; p++) { | |||
5352 | PetscInt rStart = newPointOffsets[0][p]; | |||
5353 | PetscInt b = points[2 * p]; | |||
5354 | PetscInt c, r, k; | |||
5355 | PetscInt dof; | |||
5356 | ||||
5357 | ierr = PetscSectionGetDof(section,b,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5357,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5358 | if (pointMatOffsets[0][p] < pointMatOffsets[0][p + 1]) { | |||
5359 | PetscInt nRows = newPointOffsets[0][p+1]-rStart; | |||
5360 | const PetscScalar *PETSC_RESTRICT__restrict mat = pointMat[0] + pointMatOffsets[0][p]; | |||
5361 | ||||
5362 | for (r = 0; r < nRows; r++) { | |||
5363 | for (c = 0; c < newNumIndices; c++) { | |||
5364 | for (k = 0; k < dof; k++) { | |||
5365 | newValues[(rStart + r) * newNumIndices + c] += mat[k * nRows + r] * tmpValues[(oldOff + k) * newNumIndices + c]; | |||
5366 | } | |||
5367 | } | |||
5368 | } | |||
5369 | } | |||
5370 | else { | |||
5371 | /* copy this row as is */ | |||
5372 | for (r = 0; r < dof; r++) { | |||
5373 | for (c = 0; c < newNumIndices; c++) { | |||
5374 | newValues[(rStart + r) * newNumIndices + c] = tmpValues[(oldOff + r) * newNumIndices + c]; | |||
5375 | } | |||
5376 | } | |||
5377 | } | |||
5378 | oldOff += dof; | |||
5379 | } | |||
5380 | } | |||
5381 | ||||
5382 | ierr = DMRestoreWorkArray(dm,newNumIndices*numIndices,MPIU_SCALAR((MPI_Datatype)0x4c00080b),&tmpValues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5382,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5383 | } | |||
5384 | else { | |||
5385 | newValues = tmpValues; | |||
5386 | } | |||
5387 | } | |||
5388 | ||||
5389 | /* clean up */ | |||
5390 | ierr = DMRestoreWorkArray(dm,maxDof,MPIU_INT((MPI_Datatype)0x4c000405),&indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5390,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5391 | ierr = DMRestoreWorkArray(dm,maxAnchor*maxDof,MPIU_INT((MPI_Datatype)0x4c000405),&newIndices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5391,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5392 | ||||
5393 | if (numFields) { | |||
5394 | for (f = 0; f < numFields; f++) { | |||
5395 | 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),5395,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5396 | 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),5396,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5397 | 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),5397,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5398 | } | |||
5399 | } | |||
5400 | else { | |||
5401 | 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),5401,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5402 | 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),5402,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5403 | 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),5403,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5404 | } | |||
5405 | ierr = ISRestoreIndices(aIS,&anchors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5405,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5406 | ||||
5407 | /* output */ | |||
5408 | if (outPoints) { | |||
5409 | *outPoints = newPoints; | |||
5410 | } | |||
5411 | else { | |||
5412 | ierr = DMRestoreWorkArray(dm,2*newNumPoints,MPIU_INT((MPI_Datatype)0x4c000405),&newPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5412,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5413 | } | |||
5414 | if (outValues) { | |||
5415 | *outValues = newValues; | |||
5416 | } | |||
5417 | for (f = 0; f <= numFields; f++) { | |||
5418 | offsets[f] = newOffsets[f]; | |||
5419 | } | |||
5420 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
5421 | } | |||
5422 | ||||
5423 | /*@C | |||
5424 | DMPlexGetClosureIndices - Get the global indices in a vector v for all points in the closure of the given point | |||
5425 | ||||
5426 | Not collective | |||
5427 | ||||
5428 | Input Parameters: | |||
5429 | + dm - The DM | |||
5430 | . section - The section describing the layout in v, or NULL to use the default section | |||
5431 | . globalSection - The section describing the parallel layout in v, or NULL to use the default section | |||
5432 | - point - The mesh point | |||
5433 | ||||
5434 | Output parameters: | |||
5435 | + numIndices - The number of indices | |||
5436 | . indices - The indices | |||
5437 | - outOffsets - Field offset if not NULL | |||
5438 | ||||
5439 | Note: Must call DMPlexRestoreClosureIndices() to free allocated memory | |||
5440 | ||||
5441 | Level: advanced | |||
5442 | ||||
5443 | .seealso DMPlexRestoreClosureIndices(), DMPlexVecGetClosure(), DMPlexMatSetClosure() | |||
5444 | @*/ | |||
5445 | PetscErrorCode DMPlexGetClosureIndices(DM dm, PetscSection section, PetscSection globalSection, PetscInt point, PetscInt *numIndices, PetscInt **indices, PetscInt *outOffsets) | |||
5446 | { | |||
5447 | PetscSection clSection; | |||
5448 | IS clPoints; | |||
5449 | const PetscInt *clp; | |||
5450 | const PetscInt **perms[32] = {NULL((void*)0)}; | |||
5451 | PetscInt *points = NULL((void*)0), *pointsNew; | |||
5452 | PetscInt numPoints, numPointsNew; | |||
5453 | PetscInt offsets[32]; | |||
5454 | PetscInt Nf, Nind, NindNew, off, globalOff, f, p; | |||
5455 | PetscErrorCode ierr; | |||
5456 | ||||
5457 | 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] = 5457; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
5458 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),5458,__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),5458 ,__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),5458,__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),5458,__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); | |||
5459 | PetscValidHeaderSpecific(section, PETSC_SECTION_CLASSID, 2)do { if (!section) return PetscError(((MPI_Comm)0x44000001),5459 ,__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),5459,__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),5459,__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),5459,__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); | |||
5460 | PetscValidHeaderSpecific(globalSection, PETSC_SECTION_CLASSID, 3)do { if (!globalSection) return PetscError(((MPI_Comm)0x44000001 ),5460,__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),5460,__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),5460,__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),5460,__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); | |||
5461 | if (numIndices) PetscValidPointer(numIndices, 4)do { if (!numIndices) return PetscError(((MPI_Comm)0x44000001 ),5461,__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),5461,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",4); } while (0); | |||
5462 | PetscValidPointer(indices, 5)do { if (!indices) return PetscError(((MPI_Comm)0x44000001),5462 ,__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),5462,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",5); } while (0); | |||
5463 | ierr = PetscSectionGetNumFields(section, &Nf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5463,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5464 | if (Nf > 31) SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Number of fields %D limited to 31", Nf)return PetscError(PetscObjectComm((PetscObject)dm),5464,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63, PETSC_ERROR_INITIAL,"Number of fields %D limited to 31",Nf); | |||
5465 | ierr = PetscMemzero(offsets, 32 * sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5465,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5466 | /* Get points in closure */ | |||
5467 | ierr = DMPlexGetCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5467,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5468 | /* Get number of indices and indices per field */ | |||
5469 | for (p = 0, Nind = 0; p < numPoints*2; p += 2) { | |||
5470 | PetscInt dof, fdof; | |||
5471 | ||||
5472 | ierr = PetscSectionGetDof(section, points[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5472,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5473 | for (f = 0; f < Nf; ++f) { | |||
5474 | ierr = PetscSectionGetFieldDof(section, points[p], f, &fdof);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 | offsets[f+1] += fdof; | |||
5476 | } | |||
5477 | Nind += dof; | |||
5478 | } | |||
5479 | for (f = 1; f < Nf; ++f) offsets[f+1] += offsets[f]; | |||
5480 | 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),5480,__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); | |||
5481 | if (!Nf) offsets[1] = Nind; | |||
5482 | /* Get dual space symmetries */ | |||
5483 | for (f = 0; f < PetscMax(1,Nf)(((1)<(Nf)) ? (Nf) : (1)); f++) { | |||
5484 | 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),5484,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5485 | else {ierr = PetscSectionGetPointSyms(section,numPoints,points,&perms[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5485,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5486 | } | |||
5487 | /* Correct for hanging node constraints */ | |||
5488 | { | |||
5489 | 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),5489,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5490 | if (numPointsNew) { | |||
5491 | for (f = 0; f < PetscMax(1,Nf)(((1)<(Nf)) ? (Nf) : (1)); f++) { | |||
5492 | 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),5492,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5493 | else {ierr = PetscSectionRestorePointSyms(section,numPoints,points,&perms[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5493,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5494 | } | |||
5495 | for (f = 0; f < PetscMax(1,Nf)(((1)<(Nf)) ? (Nf) : (1)); f++) { | |||
5496 | 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),5496,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5497 | else {ierr = PetscSectionGetPointSyms(section,numPointsNew,pointsNew,&perms[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5497,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5498 | } | |||
5499 | ierr = DMPlexRestoreCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5499,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5500 | numPoints = numPointsNew; | |||
5501 | Nind = NindNew; | |||
5502 | points = pointsNew; | |||
5503 | } | |||
5504 | } | |||
5505 | /* Calculate indices */ | |||
5506 | ierr = DMGetWorkArray(dm, Nind, MPIU_INT((MPI_Datatype)0x4c000405), indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5506,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5507 | if (Nf) { | |||
5508 | if (outOffsets) { | |||
5509 | PetscInt f; | |||
5510 | ||||
5511 | for (f = 0; f <= Nf; f++) { | |||
5512 | outOffsets[f] = offsets[f]; | |||
5513 | } | |||
5514 | } | |||
5515 | for (p = 0; p < numPoints; p++) { | |||
5516 | ierr = PetscSectionGetOffset(globalSection, points[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5516,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5517 | DMPlexGetIndicesPointFields_Internal(section, points[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, offsets, PETSC_FALSE, perms, p, *indices); | |||
5518 | } | |||
5519 | } else { | |||
5520 | for (p = 0, off = 0; p < numPoints; p++) { | |||
5521 | const PetscInt *perm = perms[0] ? perms[0][p] : NULL((void*)0); | |||
5522 | ||||
5523 | ierr = PetscSectionGetOffset(globalSection, points[2*p], &globalOff);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 | DMPlexGetIndicesPoint_Internal(section, points[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, &off, PETSC_FALSE, perm, *indices); | |||
5525 | } | |||
5526 | } | |||
5527 | /* Cleanup points */ | |||
5528 | for (f = 0; f < PetscMax(1,Nf)(((1)<(Nf)) ? (Nf) : (1)); f++) { | |||
5529 | 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),5529,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5530 | else {ierr = PetscSectionRestorePointSyms(section,numPoints,points,&perms[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5530,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5531 | } | |||
5532 | if (numPointsNew) { | |||
5533 | ierr = DMRestoreWorkArray(dm, 2*numPointsNew, MPIU_INT((MPI_Datatype)0x4c000405), &pointsNew);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5533,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5534 | } else { | |||
5535 | ierr = DMPlexRestoreCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5535,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5536 | } | |||
5537 | if (numIndices) *numIndices = Nind; | |||
5538 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
5539 | } | |||
5540 | ||||
5541 | /*@C | |||
5542 | DMPlexRestoreClosureIndices - Restore the indices in a vector v for all points in the closure of the given point | |||
5543 | ||||
5544 | Not collective | |||
5545 | ||||
5546 | Input Parameters: | |||
5547 | + dm - The DM | |||
5548 | . section - The section describing the layout in v, or NULL to use the default section | |||
5549 | . globalSection - The section describing the parallel layout in v, or NULL to use the default section | |||
5550 | . point - The mesh point | |||
5551 | . numIndices - The number of indices | |||
5552 | . indices - The indices | |||
5553 | - outOffsets - Field offset if not NULL | |||
5554 | ||||
5555 | Level: advanced | |||
5556 | ||||
5557 | .seealso DMPlexGetClosureIndices(), DMPlexVecGetClosure(), DMPlexMatSetClosure() | |||
5558 | @*/ | |||
5559 | PetscErrorCode DMPlexRestoreClosureIndices(DM dm, PetscSection section, PetscSection globalSection, PetscInt point, PetscInt *numIndices, PetscInt **indices,PetscInt *outOffsets) | |||
5560 | { | |||
5561 | PetscErrorCode ierr; | |||
5562 | ||||
5563 | 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] = 5563; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
5564 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),5564,__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),5564 ,__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),5564,__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),5564,__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); | |||
5565 | PetscValidPointer(indices, 5)do { if (!indices) return PetscError(((MPI_Comm)0x44000001),5565 ,__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),5565,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",5); } while (0); | |||
5566 | ierr = DMRestoreWorkArray(dm, 0, MPIU_INT((MPI_Datatype)0x4c000405), indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5566,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5567 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
5568 | } | |||
5569 | ||||
5570 | /*@C | |||
5571 | DMPlexMatSetClosure - Set an array of the values on the closure of 'point' | |||
5572 | ||||
5573 | Not collective | |||
5574 | ||||
5575 | Input Parameters: | |||
5576 | + dm - The DM | |||
5577 | . section - The section describing the layout in v, or NULL to use the default section | |||
5578 | . globalSection - The section describing the layout in v, or NULL to use the default global section | |||
5579 | . A - The matrix | |||
5580 | . point - The point in the DM | |||
5581 | . values - The array of values | |||
5582 | - mode - The insert mode, where INSERT_ALL_VALUES and ADD_ALL_VALUES also overwrite boundary conditions | |||
5583 | ||||
5584 | Fortran Notes: | |||
5585 | This routine is only available in Fortran 90, and you must include petsc.h90 in your code. | |||
5586 | ||||
5587 | Level: intermediate | |||
5588 | ||||
5589 | .seealso DMPlexVecGetClosure(), DMPlexVecSetClosure() | |||
5590 | @*/ | |||
5591 | PetscErrorCode DMPlexMatSetClosure(DM dm, PetscSection section, PetscSection globalSection, Mat A, PetscInt point, const PetscScalar values[], InsertMode mode) | |||
5592 | { | |||
5593 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
5594 | PetscSection clSection; | |||
5595 | IS clPoints; | |||
5596 | PetscInt *points = NULL((void*)0), *newPoints; | |||
5597 | const PetscInt *clp; | |||
5598 | PetscInt *indices; | |||
5599 | PetscInt offsets[32]; | |||
5600 | const PetscInt **perms[32] = {NULL((void*)0)}; | |||
5601 | const PetscScalar **flips[32] = {NULL((void*)0)}; | |||
5602 | PetscInt numFields, numPoints, newNumPoints, numIndices, newNumIndices, dof, off, globalOff, p, f; | |||
5603 | PetscScalar *valCopy = NULL((void*)0); | |||
5604 | PetscScalar *newValues; | |||
5605 | PetscErrorCode ierr; | |||
5606 | ||||
5607 | 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] = 5607; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
5608 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),5608,__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),5608 ,__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),5608,__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),5608,__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); | |||
5609 | if (!section) {ierr = DMGetSection(dm, §ion);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5609,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5610 | PetscValidHeaderSpecific(section, PETSC_SECTION_CLASSID, 2)do { if (!section) return PetscError(((MPI_Comm)0x44000001),5610 ,__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),5610,__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),5610,__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),5610,__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); | |||
5611 | if (!globalSection) {ierr = DMGetGlobalSection(dm, &globalSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5611,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5612 | PetscValidHeaderSpecific(globalSection, PETSC_SECTION_CLASSID, 3)do { if (!globalSection) return PetscError(((MPI_Comm)0x44000001 ),5612,__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),5612,__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),5612,__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),5612,__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); | |||
5613 | PetscValidHeaderSpecific(A, MAT_CLASSID, 4)do { if (!A) return PetscError(((MPI_Comm)0x44000001),5613,__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),5613 ,__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),5613,__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),5613,__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); | |||
5614 | ierr = PetscSectionGetNumFields(section, &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5614,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5615 | if (numFields > 31) SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Number of fields %D limited to 31", numFields)return PetscError(PetscObjectComm((PetscObject)dm),5615,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63, PETSC_ERROR_INITIAL,"Number of fields %D limited to 31",numFields ); | |||
5616 | ierr = PetscMemzero(offsets, 32 * sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5616,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5617 | ierr = DMPlexGetCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5617,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5618 | for (p = 0, numIndices = 0; p < numPoints*2; p += 2) { | |||
5619 | PetscInt fdof; | |||
5620 | ||||
5621 | ierr = PetscSectionGetDof(section, points[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5621,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5622 | for (f = 0; f < numFields; ++f) { | |||
5623 | ierr = PetscSectionGetFieldDof(section, points[p], f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5623,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5624 | offsets[f+1] += fdof; | |||
5625 | } | |||
5626 | numIndices += dof; | |||
5627 | } | |||
5628 | for (f = 1; f < numFields; ++f) offsets[f+1] += offsets[f]; | |||
5629 | ||||
5630 | 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),5630,__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); | |||
5631 | /* Get symmetries */ | |||
5632 | for (f = 0; f < PetscMax(1,numFields)(((1)<(numFields)) ? (numFields) : (1)); f++) { | |||
5633 | 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),5633,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5634 | else {ierr = PetscSectionGetPointSyms(section,numPoints,points,&perms[f],&flips[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5634,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5635 | if (values && flips[f]) { /* may need to apply sign changes to the element matrix */ | |||
5636 | PetscInt foffset = offsets[f]; | |||
5637 | ||||
5638 | for (p = 0; p < numPoints; p++) { | |||
5639 | PetscInt point = points[2*p], fdof; | |||
5640 | const PetscScalar *flip = flips[f] ? flips[f][p] : NULL((void*)0); | |||
5641 | ||||
5642 | if (!numFields) { | |||
5643 | ierr = PetscSectionGetDof(section,point,&fdof);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 | } else { | |||
5645 | ierr = PetscSectionGetFieldDof(section,point,f,&fdof);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 | if (flip) { | |||
5648 | PetscInt i, j, k; | |||
5649 | ||||
5650 | if (!valCopy) { | |||
5651 | ierr = DMGetWorkArray(dm,numIndices*numIndices,MPIU_SCALAR((MPI_Datatype)0x4c00080b),&valCopy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5651,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5652 | for (j = 0; j < numIndices * numIndices; j++) valCopy[j] = values[j]; | |||
5653 | values = valCopy; | |||
5654 | } | |||
5655 | for (i = 0; i < fdof; i++) { | |||
5656 | PetscScalar fval = flip[i]; | |||
5657 | ||||
5658 | for (k = 0; k < numIndices; k++) { | |||
5659 | valCopy[numIndices * (foffset + i) + k] *= fval; | |||
5660 | valCopy[numIndices * k + (foffset + i)] *= fval; | |||
5661 | } | |||
5662 | } | |||
5663 | } | |||
5664 | foffset += fdof; | |||
5665 | } | |||
5666 | } | |||
5667 | } | |||
5668 | 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),5668,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5669 | if (newNumPoints) { | |||
5670 | if (valCopy) { | |||
5671 | ierr = DMRestoreWorkArray(dm,numIndices*numIndices,MPIU_SCALAR((MPI_Datatype)0x4c00080b),&valCopy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5671,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5672 | } | |||
5673 | for (f = 0; f < PetscMax(1,numFields)(((1)<(numFields)) ? (numFields) : (1)); f++) { | |||
5674 | 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),5674,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5675 | else {ierr = PetscSectionRestorePointSyms(section,numPoints,points,&perms[f],&flips[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5675,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5676 | } | |||
5677 | for (f = 0; f < PetscMax(1,numFields)(((1)<(numFields)) ? (numFields) : (1)); f++) { | |||
5678 | 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),5678,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5679 | else {ierr = PetscSectionGetPointSyms(section,newNumPoints,newPoints,&perms[f],&flips[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5679,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5680 | } | |||
5681 | ierr = DMPlexRestoreCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5681,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5682 | numPoints = newNumPoints; | |||
5683 | numIndices = newNumIndices; | |||
5684 | points = newPoints; | |||
5685 | values = newValues; | |||
5686 | } | |||
5687 | ierr = DMGetWorkArray(dm, numIndices, MPIU_INT((MPI_Datatype)0x4c000405), &indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5687,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5688 | if (numFields) { | |||
5689 | PetscBool useFieldOffsets; | |||
5690 | ||||
5691 | ierr = PetscSectionGetUseFieldOffsets(globalSection, &useFieldOffsets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5691,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5692 | if (useFieldOffsets) { | |||
5693 | for (p = 0; p < numPoints; p++) { | |||
5694 | DMPlexGetIndicesPointFieldsSplit_Internal(section, globalSection, points[2*p], offsets, PETSC_FALSE, perms, p, indices); | |||
5695 | } | |||
5696 | } else { | |||
5697 | for (p = 0; p < numPoints; p++) { | |||
5698 | ierr = PetscSectionGetOffset(globalSection, points[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5698,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5699 | DMPlexGetIndicesPointFields_Internal(section, points[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, offsets, PETSC_FALSE, perms, p, indices); | |||
5700 | } | |||
5701 | } | |||
5702 | } else { | |||
5703 | for (p = 0, off = 0; p < numPoints; p++) { | |||
5704 | const PetscInt *perm = perms[0] ? perms[0][p] : NULL((void*)0); | |||
5705 | ierr = PetscSectionGetOffset(globalSection, points[2*p], &globalOff);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 | DMPlexGetIndicesPoint_Internal(section, points[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, &off, PETSC_FALSE, perm, indices); | |||
5707 | } | |||
5708 | } | |||
5709 | 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),5709,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5710 | ierr = MatSetValues(A, numIndices, indices, numIndices, indices, values, mode); | |||
5711 | if (mesh->printFEM > 1) { | |||
5712 | PetscInt i; | |||
5713 | ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), " Indices:");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5713,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5714 | 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),5714,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5715 | ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "\n");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 | } | |||
5717 | if (ierr) { | |||
5718 | PetscMPIInt rank; | |||
5719 | PetscErrorCode ierr2; | |||
5720 | ||||
5721 | ierr2 = MPI_Comm_rank(PetscObjectComm((PetscObject)A), &rank);CHKERRQ(ierr2)do {if (__builtin_expect(!!(ierr2),0)) return PetscError(((MPI_Comm )0x44000001),5721,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr2,PETSC_ERROR_REPEAT," ");} while (0); | |||
5722 | ierr2 = (*PetscErrorPrintf)("[%d]ERROR in DMPlexMatSetClosure\n", rank);CHKERRQ(ierr2)do {if (__builtin_expect(!!(ierr2),0)) return PetscError(((MPI_Comm )0x44000001),5722,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr2,PETSC_ERROR_REPEAT," ");} while (0); | |||
5723 | 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),5723,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr2,PETSC_ERROR_REPEAT," ");} while (0); | |||
5724 | ierr2 = DMRestoreWorkArray(dm, numIndices, MPIU_INT((MPI_Datatype)0x4c000405), &indices);CHKERRQ(ierr2)do {if (__builtin_expect(!!(ierr2),0)) return PetscError(((MPI_Comm )0x44000001),5724,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr2,PETSC_ERROR_REPEAT," ");} while (0); | |||
5725 | CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5725,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5726 | } | |||
5727 | for (f = 0; f < PetscMax(1,numFields)(((1)<(numFields)) ? (numFields) : (1)); f++) { | |||
5728 | 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),5728,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5729 | else {ierr = PetscSectionRestorePointSyms(section,numPoints,points,&perms[f],&flips[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5729,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5730 | } | |||
5731 | if (newNumPoints) { | |||
5732 | ierr = DMRestoreWorkArray(dm,newNumIndices*newNumIndices,MPIU_SCALAR((MPI_Datatype)0x4c00080b),&newValues);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 | ierr = DMRestoreWorkArray(dm,2*newNumPoints,MPIU_INT((MPI_Datatype)0x4c000405),&newPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5733,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5734 | } | |||
5735 | else { | |||
5736 | if (valCopy) { | |||
5737 | ierr = DMRestoreWorkArray(dm,numIndices*numIndices,MPIU_SCALAR((MPI_Datatype)0x4c00080b),&valCopy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5737,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5738 | } | |||
5739 | ierr = DMPlexRestoreCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);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 | } | |||
5741 | ierr = DMRestoreWorkArray(dm, numIndices, MPIU_INT((MPI_Datatype)0x4c000405), &indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5741,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5742 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
5743 | } | |||
5744 | ||||
5745 | PetscErrorCode DMPlexMatSetClosureRefined(DM dmf, PetscSection fsection, PetscSection globalFSection, DM dmc, PetscSection csection, PetscSection globalCSection, Mat A, PetscInt point, const PetscScalar values[], InsertMode mode) | |||
5746 | { | |||
5747 | DM_Plex *mesh = (DM_Plex*) dmf->data; | |||
5748 | PetscInt *fpoints = NULL((void*)0), *ftotpoints = NULL((void*)0); | |||
5749 | PetscInt *cpoints = NULL((void*)0); | |||
5750 | PetscInt *findices, *cindices; | |||
5751 | PetscInt foffsets[32], coffsets[32]; | |||
5752 | CellRefiner cellRefiner; | |||
5753 | PetscInt numFields, numSubcells, maxFPoints, numFPoints, numCPoints, numFIndices, numCIndices, dof, off, globalOff, pStart, pEnd, p, q, r, s, f; | |||
5754 | PetscErrorCode ierr; | |||
5755 | ||||
5756 | 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] = 5756; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
5757 | PetscValidHeaderSpecific(dmf, DM_CLASSID, 1)do { if (!dmf) return PetscError(((MPI_Comm)0x44000001),5757, __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),5757,__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),5757,__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),5757,__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); | |||
5758 | PetscValidHeaderSpecific(dmc, DM_CLASSID, 4)do { if (!dmc) return PetscError(((MPI_Comm)0x44000001),5758, __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),5758,__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),5758,__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),5758,__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); | |||
5759 | if (!fsection) {ierr = DMGetSection(dmf, &fsection);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 | PetscValidHeaderSpecific(fsection, PETSC_SECTION_CLASSID, 2)do { if (!fsection) return PetscError(((MPI_Comm)0x44000001), 5760,__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),5760,__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),5760,__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),5760,__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); | |||
5761 | if (!csection) {ierr = DMGetSection(dmc, &csection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5761,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5762 | PetscValidHeaderSpecific(csection, PETSC_SECTION_CLASSID, 5)do { if (!csection) return PetscError(((MPI_Comm)0x44000001), 5762,__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),5762,__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),5762,__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),5762,__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); | |||
5763 | if (!globalFSection) {ierr = DMGetGlobalSection(dmf, &globalFSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5763,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5764 | PetscValidHeaderSpecific(globalFSection, PETSC_SECTION_CLASSID, 3)do { if (!globalFSection) return PetscError(((MPI_Comm)0x44000001 ),5764,__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),5764,__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),5764,__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),5764,__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); | |||
5765 | if (!globalCSection) {ierr = DMGetGlobalSection(dmc, &globalCSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5765,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5766 | PetscValidHeaderSpecific(globalCSection, PETSC_SECTION_CLASSID, 6)do { if (!globalCSection) return PetscError(((MPI_Comm)0x44000001 ),5766,__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),5766,__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),5766,__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),5766,__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); | |||
5767 | PetscValidHeaderSpecific(A, MAT_CLASSID, 7)do { if (!A) return PetscError(((MPI_Comm)0x44000001),5767,__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),5767 ,__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),5767,__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),5767,__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); | |||
5768 | ierr = PetscSectionGetNumFields(fsection, &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5768,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5769 | if (numFields > 31) SETERRQ1(PetscObjectComm((PetscObject)dmf), PETSC_ERR_ARG_OUTOFRANGE, "Number of fields %D limited to 31", numFields)return PetscError(PetscObjectComm((PetscObject)dmf),5769,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63, PETSC_ERROR_INITIAL,"Number of fields %D limited to 31",numFields ); | |||
5770 | ierr = PetscMemzero(foffsets, 32 * sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5770,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5771 | ierr = PetscMemzero(coffsets, 32 * sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5771,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5772 | /* Column indices */ | |||
5773 | ierr = DMPlexGetTransitiveClosure(dmc, point, PETSC_TRUE, &numCPoints, &cpoints);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 | maxFPoints = numCPoints; | |||
5775 | /* Compress out points not in the section */ | |||
5776 | /* TODO: Squeeze out points with 0 dof as well */ | |||
5777 | ierr = PetscSectionGetChart(csection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5777,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5778 | for (p = 0, q = 0; p < numCPoints*2; p += 2) { | |||
5779 | if ((cpoints[p] >= pStart) && (cpoints[p] < pEnd)) { | |||
5780 | cpoints[q*2] = cpoints[p]; | |||
5781 | cpoints[q*2+1] = cpoints[p+1]; | |||
5782 | ++q; | |||
5783 | } | |||
5784 | } | |||
5785 | numCPoints = q; | |||
5786 | for (p = 0, numCIndices = 0; p < numCPoints*2; p += 2) { | |||
5787 | PetscInt fdof; | |||
5788 | ||||
5789 | ierr = PetscSectionGetDof(csection, cpoints[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5789,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5790 | if (!dof) continue; | |||
5791 | for (f = 0; f < numFields; ++f) { | |||
5792 | ierr = PetscSectionGetFieldDof(csection, cpoints[p], f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5792,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5793 | coffsets[f+1] += fdof; | |||
5794 | } | |||
5795 | numCIndices += dof; | |||
5796 | } | |||
5797 | for (f = 1; f < numFields; ++f) coffsets[f+1] += coffsets[f]; | |||
5798 | /* Row indices */ | |||
5799 | ierr = DMPlexGetCellRefiner_Internal(dmc, &cellRefiner);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5799,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5800 | 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),5800,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5801 | 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),5801,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5802 | for (r = 0, q = 0; r < numSubcells; ++r) { | |||
5803 | /* TODO Map from coarse to fine cells */ | |||
5804 | ierr = DMPlexGetTransitiveClosure(dmf, point*numSubcells + r, PETSC_TRUE, &numFPoints, &fpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5804,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5805 | /* Compress out points not in the section */ | |||
5806 | ierr = PetscSectionGetChart(fsection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5806,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5807 | for (p = 0; p < numFPoints*2; p += 2) { | |||
5808 | if ((fpoints[p] >= pStart) && (fpoints[p] < pEnd)) { | |||
5809 | ierr = PetscSectionGetDof(fsection, fpoints[p], &dof);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 | if (!dof) continue; | |||
5811 | for (s = 0; s < q; ++s) if (fpoints[p] == ftotpoints[s*2]) break; | |||
5812 | if (s < q) continue; | |||
5813 | ftotpoints[q*2] = fpoints[p]; | |||
5814 | ftotpoints[q*2+1] = fpoints[p+1]; | |||
5815 | ++q; | |||
5816 | } | |||
5817 | } | |||
5818 | ierr = DMPlexRestoreTransitiveClosure(dmf, point, PETSC_TRUE, &numFPoints, &fpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5818,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5819 | } | |||
5820 | numFPoints = q; | |||
5821 | for (p = 0, numFIndices = 0; p < numFPoints*2; p += 2) { | |||
5822 | PetscInt fdof; | |||
5823 | ||||
5824 | ierr = PetscSectionGetDof(fsection, ftotpoints[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5824,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5825 | if (!dof) continue; | |||
5826 | for (f = 0; f < numFields; ++f) { | |||
5827 | ierr = PetscSectionGetFieldDof(fsection, ftotpoints[p], f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5827,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5828 | foffsets[f+1] += fdof; | |||
5829 | } | |||
5830 | numFIndices += dof; | |||
5831 | } | |||
5832 | for (f = 1; f < numFields; ++f) foffsets[f+1] += foffsets[f]; | |||
5833 | ||||
5834 | 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),5834,__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); | |||
5835 | 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),5835,__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); | |||
5836 | ierr = DMGetWorkArray(dmf, numFIndices, MPIU_INT((MPI_Datatype)0x4c000405), &findices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5836,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5837 | ierr = DMGetWorkArray(dmc, numCIndices, MPIU_INT((MPI_Datatype)0x4c000405), &cindices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5837,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5838 | if (numFields) { | |||
5839 | const PetscInt **permsF[32] = {NULL((void*)0)}; | |||
5840 | const PetscInt **permsC[32] = {NULL((void*)0)}; | |||
5841 | ||||
5842 | for (f = 0; f < numFields; f++) { | |||
5843 | ierr = PetscSectionGetFieldPointSyms(fsection,f,numFPoints,ftotpoints,&permsF[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5843,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5844 | ierr = PetscSectionGetFieldPointSyms(csection,f,numCPoints,cpoints,&permsC[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5844,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5845 | } | |||
5846 | for (p = 0; p < numFPoints; p++) { | |||
5847 | ierr = PetscSectionGetOffset(globalFSection, ftotpoints[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5847,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5848 | ierr = DMPlexGetIndicesPointFields_Internal(fsection, ftotpoints[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, foffsets, PETSC_FALSE, permsF, p, findices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5848,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5849 | } | |||
5850 | for (p = 0; p < numCPoints; p++) { | |||
5851 | ierr = PetscSectionGetOffset(globalCSection, cpoints[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5851,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5852 | ierr = DMPlexGetIndicesPointFields_Internal(csection, cpoints[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, coffsets, PETSC_FALSE, permsC, p, cindices);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 | } | |||
5854 | for (f = 0; f < numFields; f++) { | |||
5855 | ierr = PetscSectionRestoreFieldPointSyms(fsection,f,numFPoints,ftotpoints,&permsF[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5855,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5856 | ierr = PetscSectionRestoreFieldPointSyms(csection,f,numCPoints,cpoints,&permsC[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5856,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5857 | } | |||
5858 | } else { | |||
5859 | const PetscInt **permsF = NULL((void*)0); | |||
5860 | const PetscInt **permsC = NULL((void*)0); | |||
5861 | ||||
5862 | ierr = PetscSectionGetPointSyms(fsection,numFPoints,ftotpoints,&permsF,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5862,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5863 | ierr = PetscSectionGetPointSyms(csection,numCPoints,cpoints,&permsC,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5863,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5864 | for (p = 0, off = 0; p < numFPoints; p++) { | |||
5865 | const PetscInt *perm = permsF ? permsF[p] : NULL((void*)0); | |||
5866 | ||||
5867 | ierr = PetscSectionGetOffset(globalFSection, ftotpoints[2*p], &globalOff);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 | ierr = DMPlexGetIndicesPoint_Internal(fsection, ftotpoints[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, &off, PETSC_FALSE, perm, findices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5868,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5869 | } | |||
5870 | for (p = 0, off = 0; p < numCPoints; p++) { | |||
5871 | const PetscInt *perm = permsC ? permsC[p] : NULL((void*)0); | |||
5872 | ||||
5873 | ierr = PetscSectionGetOffset(globalCSection, cpoints[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5873,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5874 | ierr = DMPlexGetIndicesPoint_Internal(csection, cpoints[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, &off, PETSC_FALSE, perm, cindices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5874,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5875 | } | |||
5876 | ierr = PetscSectionRestorePointSyms(fsection,numFPoints,ftotpoints,&permsF,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5876,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5877 | ierr = PetscSectionRestorePointSyms(csection,numCPoints,cpoints,&permsC,NULL((void*)0));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 | } | |||
5879 | 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),5879,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5880 | /* TODO: flips */ | |||
5881 | ierr = MatSetValues(A, numFIndices, findices, numCIndices, cindices, values, mode); | |||
5882 | if (ierr) { | |||
5883 | PetscMPIInt rank; | |||
5884 | PetscErrorCode ierr2; | |||
5885 | ||||
5886 | ierr2 = MPI_Comm_rank(PetscObjectComm((PetscObject)A), &rank);CHKERRQ(ierr2)do {if (__builtin_expect(!!(ierr2),0)) return PetscError(((MPI_Comm )0x44000001),5886,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr2,PETSC_ERROR_REPEAT," ");} while (0); | |||
5887 | ierr2 = (*PetscErrorPrintf)("[%d]ERROR in DMPlexMatSetClosure\n", rank);CHKERRQ(ierr2)do {if (__builtin_expect(!!(ierr2),0)) return PetscError(((MPI_Comm )0x44000001),5887,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr2,PETSC_ERROR_REPEAT," ");} while (0); | |||
5888 | 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),5888,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr2,PETSC_ERROR_REPEAT," ");} while (0); | |||
5889 | ierr2 = DMRestoreWorkArray(dmf, numFIndices, MPIU_INT((MPI_Datatype)0x4c000405), &findices);CHKERRQ(ierr2)do {if (__builtin_expect(!!(ierr2),0)) return PetscError(((MPI_Comm )0x44000001),5889,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr2,PETSC_ERROR_REPEAT," ");} while (0); | |||
5890 | ierr2 = DMRestoreWorkArray(dmc, numCIndices, MPIU_INT((MPI_Datatype)0x4c000405), &cindices);CHKERRQ(ierr2)do {if (__builtin_expect(!!(ierr2),0)) return PetscError(((MPI_Comm )0x44000001),5890,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr2,PETSC_ERROR_REPEAT," ");} while (0); | |||
5891 | CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5891,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5892 | } | |||
5893 | 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),5893,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5894 | ierr = DMPlexRestoreTransitiveClosure(dmc, point, PETSC_TRUE, &numCPoints, &cpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5894,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5895 | ierr = DMRestoreWorkArray(dmf, numFIndices, MPIU_INT((MPI_Datatype)0x4c000405), &findices);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 | ierr = DMRestoreWorkArray(dmc, numCIndices, MPIU_INT((MPI_Datatype)0x4c000405), &cindices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5896,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5897 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
5898 | } | |||
5899 | ||||
5900 | PetscErrorCode DMPlexMatGetClosureIndicesRefined(DM dmf, PetscSection fsection, PetscSection globalFSection, DM dmc, PetscSection csection, PetscSection globalCSection, PetscInt point, PetscInt cindices[], PetscInt findices[]) | |||
5901 | { | |||
5902 | PetscInt *fpoints = NULL((void*)0), *ftotpoints = NULL((void*)0); | |||
5903 | PetscInt *cpoints = NULL((void*)0); | |||
5904 | PetscInt foffsets[32], coffsets[32]; | |||
5905 | CellRefiner cellRefiner; | |||
5906 | PetscInt numFields, numSubcells, maxFPoints, numFPoints, numCPoints, numFIndices, numCIndices, dof, off, globalOff, pStart, pEnd, p, q, r, s, f; | |||
5907 | PetscErrorCode ierr; | |||
5908 | ||||
5909 | 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] = 5909; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
5910 | PetscValidHeaderSpecific(dmf, DM_CLASSID, 1)do { if (!dmf) return PetscError(((MPI_Comm)0x44000001),5910, __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),5910,__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),5910,__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),5910,__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); | |||
5911 | PetscValidHeaderSpecific(dmc, DM_CLASSID, 4)do { if (!dmc) return PetscError(((MPI_Comm)0x44000001),5911, __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),5911,__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),5911,__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),5911,__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); | |||
5912 | if (!fsection) {ierr = DMGetSection(dmf, &fsection);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 | PetscValidHeaderSpecific(fsection, PETSC_SECTION_CLASSID, 2)do { if (!fsection) return PetscError(((MPI_Comm)0x44000001), 5913,__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),5913,__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),5913,__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),5913,__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); | |||
5914 | if (!csection) {ierr = DMGetSection(dmc, &csection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5914,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5915 | PetscValidHeaderSpecific(csection, PETSC_SECTION_CLASSID, 5)do { if (!csection) return PetscError(((MPI_Comm)0x44000001), 5915,__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),5915,__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),5915,__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),5915,__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); | |||
5916 | if (!globalFSection) {ierr = DMGetGlobalSection(dmf, &globalFSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5916,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
5917 | PetscValidHeaderSpecific(globalFSection, PETSC_SECTION_CLASSID, 3)do { if (!globalFSection) return PetscError(((MPI_Comm)0x44000001 ),5917,__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),5917,__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),5917,__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),5917,__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); | |||
5918 | if (!globalCSection) {ierr = DMGetGlobalSection(dmc, &globalCSection);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 | PetscValidHeaderSpecific(globalCSection, PETSC_SECTION_CLASSID, 6)do { if (!globalCSection) return PetscError(((MPI_Comm)0x44000001 ),5919,__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),5919,__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),5919,__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),5919,__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); | |||
5920 | ierr = PetscSectionGetNumFields(fsection, &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5920,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5921 | if (numFields > 31) SETERRQ1(PetscObjectComm((PetscObject)dmf), PETSC_ERR_ARG_OUTOFRANGE, "Number of fields %D limited to 31", numFields)return PetscError(PetscObjectComm((PetscObject)dmf),5921,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63, PETSC_ERROR_INITIAL,"Number of fields %D limited to 31",numFields ); | |||
5922 | ierr = PetscMemzero(foffsets, 32 * sizeof(PetscInt));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 | ierr = PetscMemzero(coffsets, 32 * sizeof(PetscInt));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 | /* Column indices */ | |||
5925 | ierr = DMPlexGetTransitiveClosure(dmc, point, PETSC_TRUE, &numCPoints, &cpoints);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 | maxFPoints = numCPoints; | |||
5927 | /* Compress out points not in the section */ | |||
5928 | /* TODO: Squeeze out points with 0 dof as well */ | |||
5929 | ierr = PetscSectionGetChart(csection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5929,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5930 | for (p = 0, q = 0; p < numCPoints*2; p += 2) { | |||
5931 | if ((cpoints[p] >= pStart) && (cpoints[p] < pEnd)) { | |||
5932 | cpoints[q*2] = cpoints[p]; | |||
5933 | cpoints[q*2+1] = cpoints[p+1]; | |||
5934 | ++q; | |||
5935 | } | |||
5936 | } | |||
5937 | numCPoints = q; | |||
5938 | for (p = 0, numCIndices = 0; p < numCPoints*2; p += 2) { | |||
5939 | PetscInt fdof; | |||
5940 | ||||
5941 | ierr = PetscSectionGetDof(csection, cpoints[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5941,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5942 | if (!dof) continue; | |||
5943 | for (f = 0; f < numFields; ++f) { | |||
5944 | ierr = PetscSectionGetFieldDof(csection, cpoints[p], f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5944,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5945 | coffsets[f+1] += fdof; | |||
5946 | } | |||
5947 | numCIndices += dof; | |||
5948 | } | |||
5949 | for (f = 1; f < numFields; ++f) coffsets[f+1] += coffsets[f]; | |||
5950 | /* Row indices */ | |||
5951 | ierr = DMPlexGetCellRefiner_Internal(dmc, &cellRefiner);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5951,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5952 | 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),5952,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5953 | 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),5953,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5954 | for (r = 0, q = 0; r < numSubcells; ++r) { | |||
5955 | /* TODO Map from coarse to fine cells */ | |||
5956 | ierr = DMPlexGetTransitiveClosure(dmf, point*numSubcells + r, PETSC_TRUE, &numFPoints, &fpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5956,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5957 | /* Compress out points not in the section */ | |||
5958 | ierr = PetscSectionGetChart(fsection, &pStart, &pEnd);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 | for (p = 0; p < numFPoints*2; p += 2) { | |||
5960 | if ((fpoints[p] >= pStart) && (fpoints[p] < pEnd)) { | |||
5961 | ierr = PetscSectionGetDof(fsection, fpoints[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5961,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5962 | if (!dof) continue; | |||
5963 | for (s = 0; s < q; ++s) if (fpoints[p] == ftotpoints[s*2]) break; | |||
5964 | if (s < q) continue; | |||
5965 | ftotpoints[q*2] = fpoints[p]; | |||
5966 | ftotpoints[q*2+1] = fpoints[p+1]; | |||
5967 | ++q; | |||
5968 | } | |||
5969 | } | |||
5970 | ierr = DMPlexRestoreTransitiveClosure(dmf, point, PETSC_TRUE, &numFPoints, &fpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5970,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5971 | } | |||
5972 | numFPoints = q; | |||
5973 | for (p = 0, numFIndices = 0; p < numFPoints*2; p += 2) { | |||
5974 | PetscInt fdof; | |||
5975 | ||||
5976 | ierr = PetscSectionGetDof(fsection, ftotpoints[p], &dof);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 | if (!dof) continue; | |||
5978 | for (f = 0; f < numFields; ++f) { | |||
5979 | ierr = PetscSectionGetFieldDof(fsection, ftotpoints[p], f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5979,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5980 | foffsets[f+1] += fdof; | |||
5981 | } | |||
5982 | numFIndices += dof; | |||
5983 | } | |||
5984 | for (f = 1; f < numFields; ++f) foffsets[f+1] += foffsets[f]; | |||
5985 | ||||
5986 | 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),5986,__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); | |||
5987 | 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),5987,__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); | |||
5988 | if (numFields) { | |||
5989 | const PetscInt **permsF[32] = {NULL((void*)0)}; | |||
5990 | const PetscInt **permsC[32] = {NULL((void*)0)}; | |||
5991 | ||||
5992 | for (f = 0; f < numFields; f++) { | |||
5993 | ierr = PetscSectionGetFieldPointSyms(fsection,f,numFPoints,ftotpoints,&permsF[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5993,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5994 | ierr = PetscSectionGetFieldPointSyms(csection,f,numCPoints,cpoints,&permsC[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5994,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5995 | } | |||
5996 | for (p = 0; p < numFPoints; p++) { | |||
5997 | ierr = PetscSectionGetOffset(globalFSection, ftotpoints[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),5997,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
5998 | DMPlexGetIndicesPointFields_Internal(fsection, ftotpoints[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, foffsets, PETSC_FALSE, permsF, p, findices); | |||
5999 | } | |||
6000 | for (p = 0; p < numCPoints; p++) { | |||
6001 | ierr = PetscSectionGetOffset(globalCSection, cpoints[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6001,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6002 | DMPlexGetIndicesPointFields_Internal(csection, cpoints[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, coffsets, PETSC_FALSE, permsC, p, cindices); | |||
6003 | } | |||
6004 | for (f = 0; f < numFields; f++) { | |||
6005 | ierr = PetscSectionRestoreFieldPointSyms(fsection,f,numFPoints,ftotpoints,&permsF[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6005,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6006 | ierr = PetscSectionRestoreFieldPointSyms(csection,f,numCPoints,cpoints,&permsC[f],NULL((void*)0));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 | } | |||
6008 | } else { | |||
6009 | const PetscInt **permsF = NULL((void*)0); | |||
6010 | const PetscInt **permsC = NULL((void*)0); | |||
6011 | ||||
6012 | ierr = PetscSectionGetPointSyms(fsection,numFPoints,ftotpoints,&permsF,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6012,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6013 | ierr = PetscSectionGetPointSyms(csection,numCPoints,cpoints,&permsC,NULL((void*)0));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 | for (p = 0, off = 0; p < numFPoints; p++) { | |||
6015 | const PetscInt *perm = permsF ? permsF[p] : NULL((void*)0); | |||
6016 | ||||
6017 | ierr = PetscSectionGetOffset(globalFSection, ftotpoints[2*p], &globalOff);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 | DMPlexGetIndicesPoint_Internal(fsection, ftotpoints[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, &off, PETSC_FALSE, perm, findices); | |||
6019 | } | |||
6020 | for (p = 0, off = 0; p < numCPoints; p++) { | |||
6021 | const PetscInt *perm = permsC ? permsC[p] : NULL((void*)0); | |||
6022 | ||||
6023 | ierr = PetscSectionGetOffset(globalCSection, cpoints[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6023,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6024 | DMPlexGetIndicesPoint_Internal(csection, cpoints[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, &off, PETSC_FALSE, perm, cindices); | |||
6025 | } | |||
6026 | ierr = PetscSectionRestorePointSyms(fsection,numFPoints,ftotpoints,&permsF,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6026,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6027 | ierr = PetscSectionRestorePointSyms(csection,numCPoints,cpoints,&permsC,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6027,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6028 | } | |||
6029 | 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),6029,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6030 | ierr = DMPlexRestoreTransitiveClosure(dmc, point, PETSC_TRUE, &numCPoints, &cpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6030,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6031 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6032 | } | |||
6033 | ||||
6034 | /*@ | |||
6035 | DMPlexGetHybridBounds - Get the first mesh point of each dimension which is a hybrid | |||
6036 | ||||
6037 | Input Parameter: | |||
6038 | . dm - The DMPlex object | |||
6039 | ||||
6040 | Output Parameters: | |||
6041 | + cMax - The first hybrid cell | |||
6042 | . fMax - The first hybrid face | |||
6043 | . eMax - The first hybrid edge | |||
6044 | - vMax - The first hybrid vertex | |||
6045 | ||||
6046 | Level: developer | |||
6047 | ||||
6048 | .seealso DMPlexCreateHybridMesh(), DMPlexSetHybridBounds() | |||
6049 | @*/ | |||
6050 | PetscErrorCode DMPlexGetHybridBounds(DM dm, PetscInt *cMax, PetscInt *fMax, PetscInt *eMax, PetscInt *vMax) | |||
6051 | { | |||
6052 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
6053 | PetscInt dim; | |||
6054 | PetscErrorCode ierr; | |||
6055 | ||||
6056 | 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] = 6056; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6057 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6057,__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),6057 ,__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),6057,__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),6057,__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); | |||
6058 | ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6058,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6059 | if (dim < 0) SETERRQ(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "DM dimension not yet set")return PetscError(PetscObjectComm((PetscObject)dm),6059,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",73, PETSC_ERROR_INITIAL,"DM dimension not yet set"); | |||
6060 | if (cMax) *cMax = mesh->hybridPointMax[dim]; | |||
6061 | if (fMax) *fMax = mesh->hybridPointMax[PetscMax(dim-1,0)(((dim-1)<(0)) ? (0) : (dim-1))]; | |||
6062 | if (eMax) *eMax = mesh->hybridPointMax[1]; | |||
6063 | if (vMax) *vMax = mesh->hybridPointMax[0]; | |||
6064 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6065 | } | |||
6066 | ||||
6067 | static PetscErrorCode DMPlexCreateDimStratum(DM dm, DMLabel depthLabel, DMLabel dimLabel, PetscInt d, PetscInt dMax) | |||
6068 | { | |||
6069 | IS is, his; | |||
6070 | PetscInt first = 0, stride; | |||
6071 | PetscBool isStride; | |||
6072 | PetscErrorCode ierr; | |||
6073 | ||||
6074 | 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] = 6074; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6075 | ierr = DMLabelGetStratumIS(depthLabel, d, &is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6075,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6076 | ierr = PetscObjectTypeCompare((PetscObject) is, ISSTRIDE"stride", &isStride);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6076,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6077 | if (isStride) { | |||
6078 | ierr = ISStrideGetInfo(is, &first, &stride);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6078,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6079 | } | |||
6080 | 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),6080,__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); | |||
6081 | 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),6081,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6082 | ierr = DMLabelSetStratumIS(dimLabel, d, his);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6082,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6083 | ierr = ISDestroy(&his);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 = ISDestroy(&is);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 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6086 | } | |||
6087 | ||||
6088 | /*@ | |||
6089 | DMPlexSetHybridBounds - Set the first mesh point of each dimension which is a hybrid | |||
6090 | ||||
6091 | Input Parameters: | |||
6092 | . dm - The DMPlex object | |||
6093 | . cMax - The first hybrid cell | |||
6094 | . fMax - The first hybrid face | |||
6095 | . eMax - The first hybrid edge | |||
6096 | - vMax - The first hybrid vertex | |||
6097 | ||||
6098 | Level: developer | |||
6099 | ||||
6100 | .seealso DMPlexCreateHybridMesh(), DMPlexGetHybridBounds() | |||
6101 | @*/ | |||
6102 | PetscErrorCode DMPlexSetHybridBounds(DM dm, PetscInt cMax, PetscInt fMax, PetscInt eMax, PetscInt vMax) | |||
6103 | { | |||
6104 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
6105 | PetscInt dim; | |||
6106 | PetscErrorCode ierr; | |||
6107 | ||||
6108 | 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] = 6108; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6109 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6109,__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),6109 ,__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),6109,__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),6109,__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); | |||
6110 | ierr = DMGetDimension(dm, &dim);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 | if (dim < 0) SETERRQ(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "DM dimension not yet set")return PetscError(PetscObjectComm((PetscObject)dm),6111,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",73, PETSC_ERROR_INITIAL,"DM dimension not yet set"); | |||
6112 | if (cMax >= 0) mesh->hybridPointMax[dim] = cMax; | |||
6113 | if (fMax >= 0) mesh->hybridPointMax[PetscMax(dim-1,0)(((dim-1)<(0)) ? (0) : (dim-1))] = fMax; | |||
6114 | if (eMax >= 0) mesh->hybridPointMax[1] = eMax; | |||
6115 | if (vMax >= 0) mesh->hybridPointMax[0] = vMax; | |||
6116 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6117 | } | |||
6118 | ||||
6119 | /*@C | |||
6120 | DMPlexGetVTKCellHeight - Returns the height in the DAG used to determine which points are cells (normally 0) | |||
6121 | ||||
6122 | Input Parameter: | |||
6123 | . dm - The DMPlex object | |||
6124 | ||||
6125 | Output Parameter: | |||
6126 | . cellHeight - The height of a cell | |||
6127 | ||||
6128 | Level: developer | |||
6129 | ||||
6130 | .seealso DMPlexSetVTKCellHeight() | |||
6131 | @*/ | |||
6132 | PetscErrorCode DMPlexGetVTKCellHeight(DM dm, PetscInt *cellHeight) | |||
6133 | { | |||
6134 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
6135 | ||||
6136 | 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] = 6136; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6137 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6137,__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),6137 ,__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),6137,__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),6137,__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); | |||
6138 | PetscValidPointer(cellHeight, 2)do { if (!cellHeight) return PetscError(((MPI_Comm)0x44000001 ),6138,__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),6138,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); | |||
6139 | *cellHeight = mesh->vtkCellHeight; | |||
6140 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6141 | } | |||
6142 | ||||
6143 | /*@C | |||
6144 | DMPlexSetVTKCellHeight - Sets the height in the DAG used to determine which points are cells (normally 0) | |||
6145 | ||||
6146 | Input Parameters: | |||
6147 | + dm - The DMPlex object | |||
6148 | - cellHeight - The height of a cell | |||
6149 | ||||
6150 | Level: developer | |||
6151 | ||||
6152 | .seealso DMPlexGetVTKCellHeight() | |||
6153 | @*/ | |||
6154 | PetscErrorCode DMPlexSetVTKCellHeight(DM dm, PetscInt cellHeight) | |||
6155 | { | |||
6156 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
6157 | ||||
6158 | 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] = 6158; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6159 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) 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",1); if (!PetscCheckPointer (dm,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" ,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if ( ((PetscObject)(dm))->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" ,1); 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",1) ; } } while (0); | |||
6160 | mesh->vtkCellHeight = cellHeight; | |||
6161 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6162 | } | |||
6163 | ||||
6164 | /* We can easily have a form that takes an IS instead */ | |||
6165 | PetscErrorCode DMPlexCreateNumbering_Internal(DM dm, PetscInt pStart, PetscInt pEnd, PetscInt shift, PetscInt *globalSize, PetscSF sf, IS *numbering) | |||
6166 | { | |||
6167 | PetscSection section, globalSection; | |||
6168 | PetscInt *numbers, p; | |||
6169 | PetscErrorCode ierr; | |||
6170 | ||||
6171 | 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] = 6171; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6172 | ierr = PetscSectionCreate(PetscObjectComm((PetscObject)dm), §ion);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 = PetscSectionSetChart(section, pStart, pEnd);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 | for (p = pStart; p < pEnd; ++p) { | |||
6175 | ierr = PetscSectionSetDof(section, p, 1);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 | } | |||
6177 | ierr = PetscSectionSetUp(section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6177,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6178 | ierr = PetscSectionCreateGlobalSection(section, sf, PETSC_FALSE, PETSC_FALSE, &globalSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6178,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6179 | ierr = PetscMalloc1(pEnd - pStart, &numbers)PetscMallocA(1,PETSC_FALSE,6179,__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),6179,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6180 | for (p = pStart; p < pEnd; ++p) { | |||
6181 | ierr = PetscSectionGetOffset(globalSection, p, &numbers[p-pStart]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6181,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6182 | if (numbers[p-pStart] < 0) numbers[p-pStart] -= shift; | |||
6183 | else numbers[p-pStart] += shift; | |||
6184 | } | |||
6185 | 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),6185,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6186 | if (globalSize) { | |||
6187 | PetscLayout layout; | |||
6188 | ierr = PetscSectionGetPointLayout(PetscObjectComm((PetscObject) dm), globalSection, &layout);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6188,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6189 | ierr = PetscLayoutGetSize(layout, globalSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6189,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6190 | ierr = PetscLayoutDestroy(&layout);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6190,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6191 | } | |||
6192 | ierr = PetscSectionDestroy(§ion);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6192,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6193 | ierr = PetscSectionDestroy(&globalSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6193,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6194 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6195 | } | |||
6196 | ||||
6197 | PetscErrorCode DMPlexCreateCellNumbering_Internal(DM dm, PetscBool includeHybrid, IS *globalCellNumbers) | |||
6198 | { | |||
6199 | PetscInt cellHeight, cStart, cEnd, cMax; | |||
6200 | PetscErrorCode ierr; | |||
6201 | ||||
6202 | 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] = 6202; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6203 | ierr = DMPlexGetVTKCellHeight(dm, &cellHeight);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 | ierr = DMPlexGetHeightStratum(dm, cellHeight, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6204,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6205 | 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),6205,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6206 | if (cMax >= 0 && !includeHybrid) cEnd = PetscMin(cEnd, cMax)(((cEnd)<(cMax)) ? (cEnd) : (cMax)); | |||
6207 | 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),6207,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6208 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6209 | } | |||
6210 | ||||
6211 | /*@ | |||
6212 | DMPlexGetCellNumbering - Get a global cell numbering for all cells on this process | |||
6213 | ||||
6214 | Input Parameter: | |||
6215 | . dm - The DMPlex object | |||
6216 | ||||
6217 | Output Parameter: | |||
6218 | . globalCellNumbers - Global cell numbers for all cells on this process | |||
6219 | ||||
6220 | Level: developer | |||
6221 | ||||
6222 | .seealso DMPlexGetVertexNumbering() | |||
6223 | @*/ | |||
6224 | PetscErrorCode DMPlexGetCellNumbering(DM dm, IS *globalCellNumbers) | |||
6225 | { | |||
6226 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
6227 | PetscErrorCode ierr; | |||
6228 | ||||
6229 | 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] = 6229; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6230 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6230,__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),6230 ,__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),6230,__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),6230,__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); | |||
6231 | if (!mesh->globalCellNumbers) {ierr = DMPlexCreateCellNumbering_Internal(dm, PETSC_FALSE, &mesh->globalCellNumbers);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6231,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
6232 | *globalCellNumbers = mesh->globalCellNumbers; | |||
6233 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6234 | } | |||
6235 | ||||
6236 | PetscErrorCode DMPlexCreateVertexNumbering_Internal(DM dm, PetscBool includeHybrid, IS *globalVertexNumbers) | |||
6237 | { | |||
6238 | PetscInt vStart, vEnd, vMax; | |||
6239 | PetscErrorCode ierr; | |||
6240 | ||||
6241 | 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] = 6241; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6242 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6242,__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),6242 ,__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),6242,__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),6242,__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); | |||
6243 | ierr = DMPlexGetDepthStratum(dm, 0, &vStart, &vEnd);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 = 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),6244,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6245 | if (vMax >= 0 && !includeHybrid) vEnd = PetscMin(vEnd, vMax)(((vEnd)<(vMax)) ? (vEnd) : (vMax)); | |||
6246 | 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),6246,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6247 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6248 | } | |||
6249 | ||||
6250 | /*@ | |||
6251 | DMPlexGetVertexNumbering - Get a global certex numbering for all vertices on this process | |||
6252 | ||||
6253 | Input Parameter: | |||
6254 | . dm - The DMPlex object | |||
6255 | ||||
6256 | Output Parameter: | |||
6257 | . globalVertexNumbers - Global vertex numbers for all vertices on this process | |||
6258 | ||||
6259 | Level: developer | |||
6260 | ||||
6261 | .seealso DMPlexGetCellNumbering() | |||
6262 | @*/ | |||
6263 | PetscErrorCode DMPlexGetVertexNumbering(DM dm, IS *globalVertexNumbers) | |||
6264 | { | |||
6265 | DM_Plex *mesh = (DM_Plex*) dm->data; | |||
6266 | PetscErrorCode ierr; | |||
6267 | ||||
6268 | 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] = 6268; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6269 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6269,__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),6269 ,__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),6269,__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),6269,__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); | |||
6270 | if (!mesh->globalVertexNumbers) {ierr = DMPlexCreateVertexNumbering_Internal(dm, PETSC_FALSE, &mesh->globalVertexNumbers);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6270,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
6271 | *globalVertexNumbers = mesh->globalVertexNumbers; | |||
6272 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6273 | } | |||
6274 | ||||
6275 | /*@ | |||
6276 | DMPlexCreatePointNumbering - Create a global numbering for all points on this process | |||
6277 | ||||
6278 | Input Parameter: | |||
6279 | . dm - The DMPlex object | |||
6280 | ||||
6281 | Output Parameter: | |||
6282 | . globalPointNumbers - Global numbers for all points on this process | |||
6283 | ||||
6284 | Level: developer | |||
6285 | ||||
6286 | .seealso DMPlexGetCellNumbering() | |||
6287 | @*/ | |||
6288 | PetscErrorCode DMPlexCreatePointNumbering(DM dm, IS *globalPointNumbers) | |||
6289 | { | |||
6290 | IS nums[4]; | |||
6291 | PetscInt depths[4], gdepths[4], starts[4]; | |||
6292 | PetscInt depth, d, shift = 0; | |||
6293 | PetscErrorCode ierr; | |||
6294 | ||||
6295 | 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] = 6295; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6296 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6296,__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),6296 ,__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),6296,__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),6296,__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); | |||
6297 | ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6297,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6298 | /* For unstratified meshes use dim instead of depth */ | |||
6299 | if (depth < 0) {ierr = DMGetDimension(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6299,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
6300 | for (d = 0; d <= depth; ++d) { | |||
6301 | PetscInt end; | |||
6302 | ||||
6303 | depths[d] = depth-d; | |||
6304 | ierr = DMPlexGetDepthStratum(dm, depths[d], &starts[d], &end);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6304,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6305 | if (!(starts[d]-end)) { starts[d] = depths[d] = -1; } | |||
6306 | } | |||
6307 | ierr = PetscSortIntWithArray(depth+1, starts, depths);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6307,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6308 | ierr = MPIU_Allreduce(depths, gdepths, depth+1, MPIU_INT, MPI_MAX, PetscObjectComm((PetscObject) dm))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject) dm) ,depth+1,6308,__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),6308,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6309 | for (d = 0; d <= depth; ++d) { | |||
6310 | 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),6310,__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]); | |||
6311 | } | |||
6312 | for (d = 0; d <= depth; ++d) { | |||
6313 | PetscInt pStart, pEnd, gsize; | |||
6314 | ||||
6315 | ierr = DMPlexGetDepthStratum(dm, gdepths[d], &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6315,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6316 | 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),6316,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6317 | shift += gsize; | |||
6318 | } | |||
6319 | ierr = ISConcatenate(PetscObjectComm((PetscObject) dm), depth+1, nums, globalPointNumbers);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6319,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6320 | for (d = 0; d <= depth; ++d) {ierr = ISDestroy(&nums[d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6320,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
6321 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6322 | } | |||
6323 | ||||
6324 | ||||
6325 | /*@ | |||
6326 | DMPlexCreateRankField - Create a cell field whose value is the rank of the owner | |||
6327 | ||||
6328 | Input Parameter: | |||
6329 | . dm - The DMPlex object | |||
6330 | ||||
6331 | Output Parameter: | |||
6332 | . ranks - The rank field | |||
6333 | ||||
6334 | Options Database Keys: | |||
6335 | . -dm_partition_view - Adds the rank field into the DM output from -dm_view using the same viewer | |||
6336 | ||||
6337 | Level: intermediate | |||
6338 | ||||
6339 | .seealso: DMView() | |||
6340 | @*/ | |||
6341 | PetscErrorCode DMPlexCreateRankField(DM dm, Vec *ranks) | |||
6342 | { | |||
6343 | DM rdm; | |||
6344 | PetscFE fe; | |||
6345 | PetscScalar *r; | |||
6346 | PetscMPIInt rank; | |||
6347 | PetscInt dim, cStart, cEnd, c; | |||
6348 | PetscErrorCode ierr; | |||
6349 | ||||
6350 | 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] = 6350; petscstack-> petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6351 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6351,__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),6351 ,__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),6351,__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),6351,__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); | |||
6352 | PetscValidPointer(ranks, 2)do { if (!ranks) return PetscError(((MPI_Comm)0x44000001),6352 ,__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),6352,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); | |||
6353 | ierr = MPI_Comm_rank(PetscObjectComm((PetscObject) dm), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6353,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6354 | ierr = DMClone(dm, &rdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6354,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6355 | ierr = DMGetDimension(rdm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6355,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6356 | 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),6356,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6357 | ierr = PetscObjectSetName((PetscObject) fe, "rank");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6357,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6358 | ierr = DMSetField(rdm, 0, NULL((void*)0), (PetscObject) fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6358,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6359 | ierr = PetscFEDestroy(&fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6359,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6360 | ierr = DMCreateDS(rdm);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 | ierr = DMPlexGetHeightStratum(rdm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6361,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6362 | ierr = DMCreateGlobalVector(rdm, ranks);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6362,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6363 | ierr = PetscObjectSetName((PetscObject) *ranks, "partition");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6363,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6364 | ierr = VecGetArray(*ranks, &r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6364,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6365 | for (c = cStart; c < cEnd; ++c) { | |||
6366 | PetscScalar *lr; | |||
6367 | ||||
6368 | ierr = DMPlexPointGlobalRef(rdm, c, r, &lr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6368,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6369 | *lr = rank; | |||
6370 | } | |||
6371 | ierr = VecRestoreArray(*ranks, &r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6371,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6372 | ierr = DMDestroy(&rdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6372,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6373 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6374 | } | |||
6375 | ||||
6376 | /*@ | |||
6377 | DMPlexCreateLabelField - Create a cell field whose value is the label value for that cell | |||
6378 | ||||
6379 | Input Parameters: | |||
6380 | + dm - The DMPlex | |||
6381 | - label - The DMLabel | |||
6382 | ||||
6383 | Output Parameter: | |||
6384 | . val - The label value field | |||
6385 | ||||
6386 | Options Database Keys: | |||
6387 | . -dm_label_view - Adds the label value field into the DM output from -dm_view using the same viewer | |||
6388 | ||||
6389 | Level: intermediate | |||
6390 | ||||
6391 | .seealso: DMView() | |||
6392 | @*/ | |||
6393 | PetscErrorCode DMPlexCreateLabelField(DM dm, DMLabel label, Vec *val) | |||
6394 | { | |||
6395 | DM rdm; | |||
6396 | PetscFE fe; | |||
6397 | PetscScalar *v; | |||
6398 | PetscInt dim, cStart, cEnd, c; | |||
6399 | PetscErrorCode ierr; | |||
6400 | ||||
6401 | 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] = 6401; petscstack-> petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6402 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6402,__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),6402 ,__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),6402,__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),6402,__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); | |||
6403 | PetscValidPointer(label, 2)do { if (!label) return PetscError(((MPI_Comm)0x44000001),6403 ,__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),6403,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); | |||
6404 | PetscValidPointer(val, 3)do { if (!val) return PetscError(((MPI_Comm)0x44000001),6404, __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),6404,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); | |||
6405 | ierr = DMClone(dm, &rdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6405,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6406 | ierr = DMGetDimension(rdm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6406,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6407 | 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),6407,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6408 | ierr = PetscObjectSetName((PetscObject) fe, "label_value");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6408,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6409 | ierr = DMSetField(rdm, 0, NULL((void*)0), (PetscObject) fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6409,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6410 | ierr = PetscFEDestroy(&fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6410,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6411 | ierr = DMCreateDS(rdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6411,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6412 | ierr = DMPlexGetHeightStratum(rdm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6412,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6413 | ierr = DMCreateGlobalVector(rdm, val);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6413,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6414 | ierr = PetscObjectSetName((PetscObject) *val, "label_value");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6414,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6415 | ierr = VecGetArray(*val, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6415,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6416 | for (c = cStart; c < cEnd; ++c) { | |||
6417 | PetscScalar *lv; | |||
6418 | PetscInt cval; | |||
6419 | ||||
6420 | ierr = DMPlexPointGlobalRef(rdm, c, v, &lv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6420,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6421 | ierr = DMLabelGetValue(label, c, &cval);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6421,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6422 | *lv = cval; | |||
6423 | } | |||
6424 | ierr = VecRestoreArray(*val, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6424,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6425 | ierr = DMDestroy(&rdm);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 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6427 | } | |||
6428 | ||||
6429 | /*@ | |||
6430 | DMPlexCheckSymmetry - Check that the adjacency information in the mesh is symmetric. | |||
6431 | ||||
6432 | Input Parameter: | |||
6433 | . dm - The DMPlex object | |||
6434 | ||||
6435 | Note: This is a useful diagnostic when creating meshes programmatically. | |||
6436 | ||||
6437 | Level: developer | |||
6438 | ||||
6439 | .seealso: DMCreate(), DMPlexCheckSkeleton(), DMPlexCheckFaces() | |||
6440 | @*/ | |||
6441 | PetscErrorCode DMPlexCheckSymmetry(DM dm) | |||
6442 | { | |||
6443 | PetscSection coneSection, supportSection; | |||
6444 | const PetscInt *cone, *support; | |||
6445 | PetscInt coneSize, c, supportSize, s; | |||
6446 | PetscInt pStart, pEnd, p, pp, csize, ssize; | |||
6447 | PetscBool storagecheck = PETSC_TRUE; | |||
6448 | PetscErrorCode ierr; | |||
6449 | ||||
6450 | 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] = 6450; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6451 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6451,__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),6451 ,__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),6451,__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),6451,__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); | |||
6452 | ierr = DMPlexGetConeSection(dm, &coneSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6452,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6453 | ierr = DMPlexGetSupportSection(dm, &supportSection);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 | /* Check that point p is found in the support of its cone points, and vice versa */ | |||
6455 | ierr = DMPlexGetChart(dm, &pStart, &pEnd);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 | for (p = pStart; p < pEnd; ++p) { | |||
6457 | ierr = DMPlexGetConeSize(dm, p, &coneSize);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 | ierr = DMPlexGetCone(dm, p, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6458,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6459 | for (c = 0; c < coneSize; ++c) { | |||
6460 | PetscBool dup = PETSC_FALSE; | |||
6461 | PetscInt d; | |||
6462 | for (d = c-1; d >= 0; --d) { | |||
6463 | if (cone[c] == cone[d]) {dup = PETSC_TRUE; break;} | |||
6464 | } | |||
6465 | ierr = DMPlexGetSupportSize(dm, cone[c], &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6465,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6466 | ierr = DMPlexGetSupport(dm, cone[c], &support);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6466,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6467 | for (s = 0; s < supportSize; ++s) { | |||
6468 | if (support[s] == p) break; | |||
6469 | } | |||
6470 | if ((s >= supportSize) || (dup && (support[s+1] != p))) { | |||
6471 | 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),6471,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6472 | for (s = 0; s < coneSize; ++s) { | |||
6473 | ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "%D, ", cone[s]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6473,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6474 | } | |||
6475 | ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6475,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6476 | 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),6476,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6477 | for (s = 0; s < supportSize; ++s) { | |||
6478 | ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "%D, ", support[s]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6478,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6479 | } | |||
6480 | ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6480,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6481 | 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),6481,__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]); | |||
6482 | 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),6482,__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]); | |||
6483 | } | |||
6484 | } | |||
6485 | ierr = DMPlexGetTreeParent(dm, p, &pp, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6485,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6486 | if (p != pp) { storagecheck = PETSC_FALSE; continue; } | |||
6487 | ierr = DMPlexGetSupportSize(dm, p, &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6487,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6488 | ierr = DMPlexGetSupport(dm, p, &support);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6488,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6489 | for (s = 0; s < supportSize; ++s) { | |||
6490 | ierr = DMPlexGetConeSize(dm, support[s], &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6490,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6491 | ierr = DMPlexGetCone(dm, support[s], &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6491,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6492 | for (c = 0; c < coneSize; ++c) { | |||
6493 | ierr = DMPlexGetTreeParent(dm, cone[c], &pp, NULL((void*)0));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 | if (cone[c] != pp) { c = 0; break; } | |||
6495 | if (cone[c] == p) break; | |||
6496 | } | |||
6497 | if (c >= coneSize) { | |||
6498 | 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),6498,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6499 | for (c = 0; c < supportSize; ++c) { | |||
6500 | ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "%D, ", support[c]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6500,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6501 | } | |||
6502 | ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6502,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6503 | 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),6503,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6504 | for (c = 0; c < coneSize; ++c) { | |||
6505 | ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "%D, ", cone[c]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6505,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6506 | } | |||
6507 | ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6507,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6508 | 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),6508,__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]); | |||
6509 | } | |||
6510 | } | |||
6511 | } | |||
6512 | if (storagecheck) { | |||
6513 | ierr = PetscSectionGetStorageSize(coneSection, &csize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6513,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6514 | ierr = PetscSectionGetStorageSize(supportSection, &ssize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6514,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6515 | 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),6515,__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); | |||
6516 | } | |||
6517 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6518 | } | |||
6519 | ||||
6520 | /*@ | |||
6521 | DMPlexCheckSkeleton - Check that each cell has the correct number of vertices | |||
6522 | ||||
6523 | Input Parameters: | |||
6524 | + dm - The DMPlex object | |||
6525 | . isSimplex - Are the cells simplices or tensor products | |||
6526 | - cellHeight - Normally 0 | |||
6527 | ||||
6528 | Note: This is a useful diagnostic when creating meshes programmatically. | |||
6529 | ||||
6530 | Level: developer | |||
6531 | ||||
6532 | .seealso: DMCreate(), DMPlexCheckSymmetry(), DMPlexCheckFaces() | |||
6533 | @*/ | |||
6534 | PetscErrorCode DMPlexCheckSkeleton(DM dm, PetscBool isSimplex, PetscInt cellHeight) | |||
6535 | { | |||
6536 | PetscInt dim, numCorners, numHybridCorners, vStart, vEnd, cStart, cEnd, cMax, c; | |||
6537 | PetscErrorCode ierr; | |||
6538 | ||||
6539 | 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] = 6539; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6540 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6540,__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),6540 ,__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),6540,__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),6540,__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); | |||
6541 | ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6541,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6542 | switch (dim) { | |||
6543 | case 1: numCorners = isSimplex ? 2 : 2; numHybridCorners = isSimplex ? 2 : 2; break; | |||
6544 | case 2: numCorners = isSimplex ? 3 : 4; numHybridCorners = isSimplex ? 4 : 4; break; | |||
6545 | case 3: numCorners = isSimplex ? 4 : 8; numHybridCorners = isSimplex ? 6 : 8; break; | |||
6546 | default: | |||
6547 | SETERRQ1(PetscObjectComm((PetscObject) dm), PETSC_ERR_ARG_OUTOFRANGE, "Cannot handle meshes of dimension %D", dim)return PetscError(PetscObjectComm((PetscObject) dm),6547,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63, PETSC_ERROR_INITIAL,"Cannot handle meshes of dimension %D",dim ); | |||
6548 | } | |||
6549 | ierr = DMPlexGetDepthStratum(dm, 0, &vStart, &vEnd);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 | ierr = DMPlexGetHeightStratum(dm, cellHeight, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6550,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6551 | 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),6551,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6552 | cMax = cMax >= 0 ? cMax : cEnd; | |||
6553 | for (c = cStart; c < cMax; ++c) { | |||
6554 | PetscInt *closure = NULL((void*)0), closureSize, cl, coneSize = 0; | |||
6555 | ||||
6556 | ierr = DMPlexGetTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6556,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6557 | for (cl = 0; cl < closureSize*2; cl += 2) { | |||
6558 | const PetscInt p = closure[cl]; | |||
6559 | if ((p >= vStart) && (p < vEnd)) ++coneSize; | |||
6560 | } | |||
6561 | ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6561,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6562 | 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),6562,__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); | |||
6563 | } | |||
6564 | for (c = cMax; c < cEnd; ++c) { | |||
6565 | PetscInt *closure = NULL((void*)0), closureSize, cl, coneSize = 0; | |||
6566 | ||||
6567 | ierr = DMPlexGetTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6567,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6568 | for (cl = 0; cl < closureSize*2; cl += 2) { | |||
6569 | const PetscInt p = closure[cl]; | |||
6570 | if ((p >= vStart) && (p < vEnd)) ++coneSize; | |||
6571 | } | |||
6572 | ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6572,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6573 | 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),6573,__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); | |||
6574 | } | |||
6575 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6576 | } | |||
6577 | ||||
6578 | /*@ | |||
6579 | DMPlexCheckFaces - Check that the faces of each cell give a vertex order this is consistent with what we expect from the cell type | |||
6580 | ||||
6581 | Input Parameters: | |||
6582 | + dm - The DMPlex object | |||
6583 | . isSimplex - Are the cells simplices or tensor products | |||
6584 | - cellHeight - Normally 0 | |||
6585 | ||||
6586 | Note: This is a useful diagnostic when creating meshes programmatically. | |||
6587 | ||||
6588 | Level: developer | |||
6589 | ||||
6590 | .seealso: DMCreate(), DMPlexCheckSymmetry(), DMPlexCheckSkeleton() | |||
6591 | @*/ | |||
6592 | PetscErrorCode DMPlexCheckFaces(DM dm, PetscBool isSimplex, PetscInt cellHeight) | |||
6593 | { | |||
6594 | PetscInt pMax[4]; | |||
6595 | PetscInt dim, depth, vStart, vEnd, cStart, cEnd, c, h; | |||
6596 | PetscErrorCode ierr; | |||
6597 | ||||
6598 | 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] = 6598; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6599 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6599,__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),6599 ,__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),6599,__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),6599,__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); | |||
6600 | ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6600,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6601 | ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6601,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6602 | ierr = DMPlexGetDepthStratum(dm, 0, &vStart, &vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6602,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6603 | 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),6603,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6604 | for (h = cellHeight; h < PetscMin(depth, dim)(((depth)<(dim)) ? (depth) : (dim)); ++h) { | |||
6605 | ierr = DMPlexGetHeightStratum(dm, h, &cStart, &cEnd);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 | for (c = cStart; c < cEnd; ++c) { | |||
6607 | const PetscInt *cone, *ornt, *faces; | |||
6608 | PetscInt numFaces, faceSize, coneSize,f; | |||
6609 | PetscInt *closure = NULL((void*)0), closureSize, cl, numCorners = 0; | |||
6610 | ||||
6611 | if (pMax[dim-h] >= 0 && c >= pMax[dim-h]) continue; | |||
6612 | ierr = DMPlexGetConeSize(dm, c, &coneSize);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 = DMPlexGetCone(dm, c, &cone);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 = DMPlexGetConeOrientation(dm, c, &ornt);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 | ierr = DMPlexGetTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6615,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6616 | for (cl = 0; cl < closureSize*2; cl += 2) { | |||
6617 | const PetscInt p = closure[cl]; | |||
6618 | if ((p >= vStart) && (p < vEnd)) closure[numCorners++] = p; | |||
6619 | } | |||
6620 | ierr = DMPlexGetRawFaces_Internal(dm, dim-h, numCorners, closure, &numFaces, &faceSize, &faces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6620,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6621 | 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),6621,__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); | |||
6622 | for (f = 0; f < numFaces; ++f) { | |||
6623 | PetscInt *fclosure = NULL((void*)0), fclosureSize, cl, fnumCorners = 0, v; | |||
6624 | ||||
6625 | 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),6625,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6626 | for (cl = 0; cl < fclosureSize*2; cl += 2) { | |||
6627 | const PetscInt p = fclosure[cl]; | |||
6628 | if ((p >= vStart) && (p < vEnd)) fclosure[fnumCorners++] = p; | |||
6629 | } | |||
6630 | 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),6630,__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); | |||
6631 | for (v = 0; v < fnumCorners; ++v) { | |||
6632 | 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),6632,__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]); | |||
6633 | } | |||
6634 | ierr = DMPlexRestoreTransitiveClosure(dm, cone[f], PETSC_TRUE, &fclosureSize, &fclosure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6634,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6635 | } | |||
6636 | ierr = DMPlexRestoreFaces_Internal(dm, dim, c, &numFaces, &faceSize, &faces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6636,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6637 | ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6637,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6638 | } | |||
6639 | } | |||
6640 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6641 | } | |||
6642 | ||||
6643 | /*@ | |||
6644 | DMPlexCheckGeometry - Check the geometry of mesh cells | |||
6645 | ||||
6646 | Input Parameter: | |||
6647 | . dm - The DMPlex object | |||
6648 | ||||
6649 | Note: This is a useful diagnostic when creating meshes programmatically. | |||
6650 | ||||
6651 | Level: developer | |||
6652 | ||||
6653 | .seealso: DMCreate(), DMCheckSymmetry(), DMCheckSkeleton(), DMCheckFaces() | |||
6654 | @*/ | |||
6655 | PetscErrorCode DMPlexCheckGeometry(DM dm) | |||
6656 | { | |||
6657 | PetscReal detJ, J[9], refVol = 1.0; | |||
6658 | PetscReal vol; | |||
6659 | PetscInt dim, depth, d, cStart, cEnd, c; | |||
6660 | PetscErrorCode ierr; | |||
6661 | ||||
6662 | 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] = 6662; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6663 | ierr = DMGetDimension(dm, &dim);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 = DMPlexGetDepth(dm, &depth);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 | for (d = 0; d < dim; ++d) refVol *= 2.0; | |||
6666 | ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6666,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6667 | for (c = cStart; c < cEnd; ++c) { | |||
6668 | 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),6668,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6669 | 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),6669,__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); | |||
6670 | 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),6670,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6671 | if (depth > 1) { | |||
6672 | ierr = DMPlexComputeCellGeometryFVM(dm, c, &vol, NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6672,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6673 | 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),6673,__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); | |||
6674 | 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),6674,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6675 | } | |||
6676 | } | |||
6677 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6678 | } | |||
6679 | ||||
6680 | static PetscErrorCode DMPlexAreAllConePointsInArray_Private(DM dm, PetscInt p, PetscInt npoints, const PetscInt *points, PetscInt *missingPoint) | |||
6681 | { | |||
6682 | PetscInt i,l,n; | |||
6683 | const PetscInt *cone; | |||
6684 | PetscErrorCode ierr; | |||
6685 | ||||
6686 | 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] = 6686; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6687 | *missingPoint = -1; | |||
6688 | ierr = DMPlexGetConeSize(dm, p, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6688,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6689 | ierr = DMPlexGetCone(dm, p, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6689,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6690 | for (i=0; i<n; i++) { | |||
6691 | ierr = PetscFindInt(cone[i], npoints, points, &l);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6691,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6692 | if (l < 0) { | |||
6693 | *missingPoint = cone[i]; | |||
6694 | break; | |||
6695 | } | |||
6696 | } | |||
6697 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6698 | } | |||
6699 | ||||
6700 | /*@ | |||
6701 | DMPlexCheckPointSF - Check that several sufficient conditions are met for the point SF of this plex. | |||
6702 | ||||
6703 | Input Parameters: | |||
6704 | . dm - The DMPlex object | |||
6705 | ||||
6706 | Note: This is mainly intended for debugging/testing purposes. | |||
6707 | ||||
6708 | Level: developer | |||
6709 | ||||
6710 | .seealso: DMGetPointSF(), DMPlexCheckSymmetry(), DMPlexCheckSkeleton(), DMPlexCheckFaces() | |||
6711 | @*/ | |||
6712 | PetscErrorCode DMPlexCheckPointSF(DM dm) | |||
6713 | { | |||
6714 | PetscSF sf; | |||
6715 | PetscInt d,depth,i,nleaves,p,plo,phi,missingPoint; | |||
6716 | const PetscInt *locals; | |||
6717 | PetscErrorCode ierr; | |||
6718 | ||||
6719 | 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] = 6719; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6720 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6720,__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),6720 ,__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),6720,__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),6720,__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); | |||
6721 | ierr = DMPlexGetDepth(dm, &depth);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 | ierr = DMGetPointSF(dm, &sf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6722,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6723 | ierr = PetscSFGetGraph(sf, NULL((void*)0), &nleaves, &locals, NULL((void*)0));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 | /* 1) check there are no faces in 2D, cells in 3D, in interface */ | |||
6726 | ierr = DMPlexGetVTKCellHeight(dm, &d);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 | ierr = DMPlexGetHeightStratum(dm, d, &plo, &phi);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6727,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6728 | for (i=0; i<nleaves; i++) { | |||
6729 | p = locals[i]; | |||
6730 | 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),6730,__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); | |||
6731 | } | |||
6732 | ||||
6733 | /* 2) if some point is in interface, then all its cone points must be also in interface */ | |||
6734 | for (i=0; i<nleaves; i++) { | |||
6735 | p = locals[i]; | |||
6736 | ierr = DMPlexAreAllConePointsInArray_Private(dm, p, nleaves, locals, &missingPoint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6736,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6737 | 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),6737,__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); | |||
6738 | } | |||
6739 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6740 | } | |||
6741 | ||||
6742 | typedef struct cell_stats | |||
6743 | { | |||
6744 | PetscReal min, max, sum, squaresum; | |||
6745 | PetscInt count; | |||
6746 | } cell_stats_t; | |||
6747 | ||||
6748 | static void cell_stats_reduce(void *a, void *b, int * len, MPI_Datatype *datatype) | |||
6749 | { | |||
6750 | PetscInt i, N = *len; | |||
6751 | ||||
6752 | for (i = 0; i < N; i++) { | |||
6753 | cell_stats_t *A = (cell_stats_t *) a; | |||
6754 | cell_stats_t *B = (cell_stats_t *) b; | |||
6755 | ||||
6756 | B->min = PetscMin(A->min,B->min)(((A->min)<(B->min)) ? (A->min) : (B->min)); | |||
6757 | B->max = PetscMax(A->max,B->max)(((A->max)<(B->max)) ? (B->max) : (A->max)); | |||
6758 | B->sum += A->sum; | |||
6759 | B->squaresum += A->squaresum; | |||
6760 | B->count += A->count; | |||
6761 | } | |||
6762 | } | |||
6763 | ||||
6764 | /*@ | |||
6765 | DMPlexCheckCellShape - Checks the Jacobian of the mapping and computes some minimal statistics. | |||
6766 | ||||
6767 | Input Parameters: | |||
6768 | + dm - The DMPlex object | |||
6769 | - output - If true, statistics will be displayed on stdout | |||
6770 | ||||
6771 | Note: This is mainly intended for debugging/testing purposes. | |||
6772 | ||||
6773 | Level: developer | |||
6774 | ||||
6775 | .seealso: DMPlexCheckSymmetry(), DMPlexCheckSkeleton(), DMPlexCheckFaces() | |||
6776 | @*/ | |||
6777 | PetscErrorCode DMPlexCheckCellShape(DM dm, PetscBool output) | |||
6778 | { | |||
6779 | PetscMPIInt rank,size; | |||
6780 | PetscInt dim, c, cStart, cEnd, cMax, count = 0; | |||
6781 | cell_stats_t stats, globalStats; | |||
6782 | PetscReal *J, *invJ, min = 0, max = 0, mean = 0, stdev = 0; | |||
6783 | MPI_Comm comm = PetscObjectComm((PetscObject)dm); | |||
6784 | DM dmCoarse; | |||
6785 | PetscErrorCode ierr; | |||
6786 | ||||
6787 | 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] = 6787; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6788 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6788,__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),6788 ,__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),6788,__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),6788,__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); | |||
6789 | stats.min = PETSC_MAX_REAL1.7976931348623157e+308; | |||
6790 | stats.max = PETSC_MIN_REAL(-1.7976931348623157e+308); | |||
6791 | stats.sum = stats.squaresum = 0.; | |||
6792 | stats.count = 0; | |||
6793 | ||||
6794 | ierr = DMGetCoordinateDim(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6794,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6795 | ierr = PetscMalloc2(dim * dim, &J, dim * dim, &invJ)PetscMallocA(2,PETSC_FALSE,6795,__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),6795,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6796 | ierr = DMPlexGetHeightStratum(dm,0,&cStart,&cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6796,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6797 | 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),6797,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6798 | cMax = cMax < 0 ? cEnd : cMax; | |||
6799 | for (c = cStart; c < cMax; c++) { | |||
6800 | PetscInt i; | |||
6801 | PetscReal frobJ = 0., frobInvJ = 0., cond2, cond, detJ; | |||
6802 | ||||
6803 | ierr = DMPlexComputeCellGeometryAffineFEM(dm,c,NULL((void*)0),J,invJ,&detJ);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6803,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6804 | if (detJ < 0.0) SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Mesh cell %D is inverted", c)return PetscError(((MPI_Comm)0x44000001),6804,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,62,PETSC_ERROR_INITIAL,"Mesh cell %D is inverted",c); | |||
6805 | for (i = 0; i < dim * dim; i++) { | |||
6806 | frobJ += J[i] * J[i]; | |||
6807 | frobInvJ += invJ[i] * invJ[i]; | |||
6808 | } | |||
6809 | cond2 = frobJ * frobInvJ; | |||
6810 | cond = PetscSqrtReal(cond2)sqrt(cond2); | |||
6811 | ||||
6812 | stats.min = PetscMin(stats.min,cond)(((stats.min)<(cond)) ? (stats.min) : (cond)); | |||
6813 | stats.max = PetscMax(stats.max,cond)(((stats.max)<(cond)) ? (cond) : (stats.max)); | |||
6814 | stats.sum += cond; | |||
6815 | stats.squaresum += cond2; | |||
6816 | stats.count++; | |||
6817 | } | |||
6818 | ||||
6819 | ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6819,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6820 | if (size > 1) { | |||
6821 | PetscMPIInt blockLengths[2] = {4,1}; | |||
6822 | 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)}; | |||
6823 | MPI_Datatype blockTypes[2] = {MPIU_REAL((MPI_Datatype)0x4c00080b),MPIU_INT((MPI_Datatype)0x4c000405)}, statType; | |||
6824 | MPI_Op statReduce; | |||
6825 | ||||
6826 | ierr = MPI_Type_create_struct(2,blockLengths,blockOffsets,blockTypes,&statType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6826,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6827 | ierr = MPI_Type_commit(&statType);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 | ierr = MPI_Op_create(cell_stats_reduce, PETSC_TRUE, &statReduce);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6828,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6829 | ierr = MPI_Reduce(&stats,&globalStats,1,statType,statReduce,0,comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6829,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6830 | ierr = MPI_Op_free(&statReduce);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6830,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6831 | ierr = MPI_Type_free(&statType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6831,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6832 | } else { | |||
6833 | ierr = PetscMemcpy(&globalStats,&stats,sizeof(stats));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6833,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6834 | } | |||
6835 | ||||
6836 | ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6836,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6837 | if (!rank) { | |||
6838 | count = globalStats.count; | |||
6839 | min = globalStats.min; | |||
6840 | max = globalStats.max; | |||
6841 | mean = globalStats.sum / globalStats.count; | |||
6842 | 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; | |||
6843 | } | |||
6844 | ||||
6845 | if (output) { | |||
6846 | 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),6846,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6847 | } | |||
6848 | ierr = PetscFree2(J,invJ)PetscFreeA(2,6848,__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),6848,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6849 | ||||
6850 | ierr = DMGetCoarseDM(dm,&dmCoarse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6850,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6851 | if (dmCoarse) { | |||
6852 | PetscBool isplex; | |||
6853 | ||||
6854 | ierr = PetscObjectTypeCompare((PetscObject)dmCoarse,DMPLEX"plex",&isplex);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 | if (isplex) { | |||
6856 | ierr = DMPlexCheckCellShape(dmCoarse,output);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 | } | |||
6858 | } | |||
6859 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6860 | } | |||
6861 | ||||
6862 | /* Pointwise interpolation | |||
6863 | Just code FEM for now | |||
6864 | u^f = I u^c | |||
6865 | sum_k u^f_k phi^f_k = I sum_j u^c_j phi^c_j | |||
6866 | u^f_i = sum_j psi^f_i I phi^c_j u^c_j | |||
6867 | I_{ij} = psi^f_i phi^c_j | |||
6868 | */ | |||
6869 | PetscErrorCode DMCreateInterpolation_Plex(DM dmCoarse, DM dmFine, Mat *interpolation, Vec *scaling) | |||
6870 | { | |||
6871 | PetscSection gsc, gsf; | |||
6872 | PetscInt m, n; | |||
6873 | void *ctx; | |||
6874 | DM cdm; | |||
6875 | PetscBool regular, ismatis; | |||
6876 | PetscErrorCode ierr; | |||
6877 | ||||
6878 | 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] = 6878; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6879 | ierr = DMGetGlobalSection(dmFine, &gsf);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 | ierr = PetscSectionGetConstrainedStorageSize(gsf, &m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6880,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6881 | ierr = DMGetGlobalSection(dmCoarse, &gsc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6881,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6882 | ierr = PetscSectionGetConstrainedStorageSize(gsc, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6882,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6883 | ||||
6884 | ierr = PetscStrcmp(dmCoarse->mattype, MATIS"is", &ismatis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6884,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6885 | ierr = MatCreate(PetscObjectComm((PetscObject) dmCoarse), interpolation);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6885,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6886 | ierr = MatSetSizes(*interpolation, m, n, PETSC_DETERMINE-1, PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6886,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6887 | ierr = MatSetType(*interpolation, ismatis ? MATAIJ"aij" : dmCoarse->mattype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6887,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6888 | ierr = DMGetApplicationContext(dmFine, &ctx);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 = DMGetCoarseDM(dmFine, &cdm);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 = DMPlexGetRegularRefinement(dmFine, ®ular);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 | if (regular && cdm == dmCoarse) {ierr = DMPlexComputeInterpolatorNested(dmCoarse, dmFine, *interpolation, ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6892,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
6893 | else {ierr = DMPlexComputeInterpolatorGeneral(dmCoarse, dmFine, *interpolation, ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6893,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
6894 | ierr = MatViewFromOptions(*interpolation, NULL((void*)0), "-interp_mat_view");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6894,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6895 | if (scaling) { | |||
6896 | /* Use naive scaling */ | |||
6897 | ierr = DMCreateInterpolationScale(dmCoarse, dmFine, *interpolation, scaling);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6897,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6898 | } | |||
6899 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6900 | } | |||
6901 | ||||
6902 | PetscErrorCode DMCreateInjection_Plex(DM dmCoarse, DM dmFine, Mat *mat) | |||
6903 | { | |||
6904 | PetscErrorCode ierr; | |||
6905 | VecScatter ctx; | |||
6906 | ||||
6907 | 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] = 6907; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6908 | ierr = DMPlexComputeInjectorFEM(dmCoarse, dmFine, &ctx, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6908,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6909 | ierr = MatCreateScatter(PetscObjectComm((PetscObject)ctx), ctx, mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6909,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6910 | ierr = VecScatterDestroy(&ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6910,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6911 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6912 | } | |||
6913 | ||||
6914 | PetscErrorCode DMCreateMassMatrix_Plex(DM dmCoarse, DM dmFine, Mat *mass) | |||
6915 | { | |||
6916 | PetscSection gsc, gsf; | |||
6917 | PetscInt m, n; | |||
6918 | void *ctx; | |||
6919 | DM cdm; | |||
6920 | PetscBool regular; | |||
6921 | PetscErrorCode ierr; | |||
6922 | ||||
6923 | 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] = 6923; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6924 | ierr = DMGetGlobalSection(dmFine, &gsf);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 | ierr = PetscSectionGetConstrainedStorageSize(gsf, &m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6925,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6926 | ierr = DMGetGlobalSection(dmCoarse, &gsc);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 | ierr = PetscSectionGetConstrainedStorageSize(gsc, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6927,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6928 | ||||
6929 | ierr = MatCreate(PetscObjectComm((PetscObject) dmCoarse), mass);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6929,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6930 | ierr = MatSetSizes(*mass, m, n, PETSC_DETERMINE-1, PETSC_DETERMINE-1);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 | ierr = MatSetType(*mass, dmCoarse->mattype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6931,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6932 | ierr = DMGetApplicationContext(dmFine, &ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6932,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6933 | ||||
6934 | ierr = DMGetCoarseDM(dmFine, &cdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6934,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6935 | ierr = DMPlexGetRegularRefinement(dmFine, ®ular);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6935,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6936 | if (regular && cdm == dmCoarse) {ierr = DMPlexComputeMassMatrixNested(dmCoarse, dmFine, *mass, ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6936,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
6937 | else {ierr = DMPlexComputeMassMatrixGeneral(dmCoarse, dmFine, *mass, ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6937,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
6938 | ierr = MatViewFromOptions(*mass, NULL((void*)0), "-mass_mat_view");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),6938,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
6939 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6940 | } | |||
6941 | ||||
6942 | /*@ | |||
6943 | DMPlexGetRegularRefinement - Get the flag indicating that this mesh was obtained by regular refinement from its coarse mesh | |||
6944 | ||||
6945 | Input Parameter: | |||
6946 | . dm - The DMPlex object | |||
6947 | ||||
6948 | Output Parameter: | |||
6949 | . regular - The flag | |||
6950 | ||||
6951 | Level: intermediate | |||
6952 | ||||
6953 | .seealso: DMPlexSetRegularRefinement() | |||
6954 | @*/ | |||
6955 | PetscErrorCode DMPlexGetRegularRefinement(DM dm, PetscBool *regular) | |||
6956 | { | |||
6957 | 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] = 6957; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6958 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6958,__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),6958 ,__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),6958,__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),6958,__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); | |||
6959 | PetscValidPointer(regular, 2)do { if (!regular) return PetscError(((MPI_Comm)0x44000001),6959 ,__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),6959,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); | |||
6960 | *regular = ((DM_Plex *) dm->data)->regularRefinement; | |||
6961 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6962 | } | |||
6963 | ||||
6964 | /*@ | |||
6965 | DMPlexSetRegularRefinement - Set the flag indicating that this mesh was obtained by regular refinement from its coarse mesh | |||
6966 | ||||
6967 | Input Parameters: | |||
6968 | + dm - The DMPlex object | |||
6969 | - regular - The flag | |||
6970 | ||||
6971 | Level: intermediate | |||
6972 | ||||
6973 | .seealso: DMPlexGetRegularRefinement() | |||
6974 | @*/ | |||
6975 | PetscErrorCode DMPlexSetRegularRefinement(DM dm, PetscBool regular) | |||
6976 | { | |||
6977 | 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] = 6977; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
6978 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6978,__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),6978 ,__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),6978,__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),6978,__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); | |||
6979 | ((DM_Plex *) dm->data)->regularRefinement = regular; | |||
6980 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
6981 | } | |||
6982 | ||||
6983 | /* anchors */ | |||
6984 | /*@ | |||
6985 | DMPlexGetAnchors - Get the layout of the anchor (point-to-point) constraints. Typically, the user will not have to | |||
6986 | call DMPlexGetAnchors() directly: if there are anchors, then DMPlexGetAnchors() is called during DMGetConstraints(). | |||
6987 | ||||
6988 | not collective | |||
6989 | ||||
6990 | Input Parameters: | |||
6991 | . dm - The DMPlex object | |||
6992 | ||||
6993 | Output Parameters: | |||
6994 | + anchorSection - If not NULL, set to the section describing which points anchor the constrained points. | |||
6995 | - anchorIS - If not NULL, set to the list of anchors indexed by anchorSection | |||
6996 | ||||
6997 | ||||
6998 | Level: intermediate | |||
6999 | ||||
7000 | .seealso: DMPlexSetAnchors(), DMGetConstraints(), DMSetConstraints() | |||
7001 | @*/ | |||
7002 | PetscErrorCode DMPlexGetAnchors(DM dm, PetscSection *anchorSection, IS *anchorIS) | |||
7003 | { | |||
7004 | DM_Plex *plex = (DM_Plex *)dm->data; | |||
7005 | PetscErrorCode ierr; | |||
7006 | ||||
7007 | 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] = 7007; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
7008 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),7008,__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),7008 ,__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),7008,__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),7008,__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); | |||
7009 | if (!plex->anchorSection && !plex->anchorIS && plex->createanchors) {ierr = (*plex->createanchors)(dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7009,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
7010 | if (anchorSection) *anchorSection = plex->anchorSection; | |||
7011 | if (anchorIS) *anchorIS = plex->anchorIS; | |||
7012 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
7013 | } | |||
7014 | ||||
7015 | /*@ | |||
7016 | DMPlexSetAnchors - Set the layout of the local anchor (point-to-point) constraints. Unlike boundary conditions, | |||
7017 | when a point's degrees of freedom in a section are constrained to an outside value, the anchor constraints set a | |||
7018 | point's degrees of freedom to be a linear combination of other points' degrees of freedom. | |||
7019 | ||||
7020 | After specifying the layout of constraints with DMPlexSetAnchors(), one specifies the constraints by calling | |||
7021 | DMGetConstraints() and filling in the entries in the constraint matrix. | |||
7022 | ||||
7023 | collective on dm | |||
7024 | ||||
7025 | Input Parameters: | |||
7026 | + dm - The DMPlex object | |||
7027 | . 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). | |||
7028 | - anchorIS - The list of all anchor points. Must have a local communicator (PETSC_COMM_SELF or derivative). | |||
7029 | ||||
7030 | The reference counts of anchorSection and anchorIS are incremented. | |||
7031 | ||||
7032 | Level: intermediate | |||
7033 | ||||
7034 | .seealso: DMPlexGetAnchors(), DMGetConstraints(), DMSetConstraints() | |||
7035 | @*/ | |||
7036 | PetscErrorCode DMPlexSetAnchors(DM dm, PetscSection anchorSection, IS anchorIS) | |||
7037 | { | |||
7038 | DM_Plex *plex = (DM_Plex *)dm->data; | |||
7039 | PetscMPIInt result; | |||
7040 | PetscErrorCode ierr; | |||
7041 | ||||
7042 | 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] = 7042; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
7043 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),7043,__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),7043 ,__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),7043,__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),7043,__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); | |||
7044 | if (anchorSection) { | |||
7045 | PetscValidHeaderSpecific(anchorSection,PETSC_SECTION_CLASSID,2)do { if (!anchorSection) return PetscError(((MPI_Comm)0x44000001 ),7045,__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),7045,__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),7045,__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),7045,__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); | |||
7046 | 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),7046,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7047 | 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),7047,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,80,PETSC_ERROR_INITIAL,"anchor section must have local communicator" ); | |||
7048 | } | |||
7049 | if (anchorIS) { | |||
7050 | PetscValidHeaderSpecific(anchorIS,IS_CLASSID,3)do { if (!anchorIS) return PetscError(((MPI_Comm)0x44000001), 7050,__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),7050,__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),7050,__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),7050,__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); | |||
7051 | 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),7051,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7052 | 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),7052,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,80,PETSC_ERROR_INITIAL,"anchor IS must have local communicator" ); | |||
7053 | } | |||
7054 | ||||
7055 | ierr = PetscObjectReference((PetscObject)anchorSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7055,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7056 | ierr = PetscSectionDestroy(&plex->anchorSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7056,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7057 | plex->anchorSection = anchorSection; | |||
7058 | ||||
7059 | ierr = PetscObjectReference((PetscObject)anchorIS);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 | ierr = ISDestroy(&plex->anchorIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7060,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7061 | plex->anchorIS = anchorIS; | |||
7062 | ||||
7063 | #if defined(PETSC_USE_DEBUG1) | |||
7064 | if (anchorIS && anchorSection) { | |||
7065 | PetscInt size, a, pStart, pEnd; | |||
7066 | const PetscInt *anchors; | |||
7067 | ||||
7068 | ierr = PetscSectionGetChart(anchorSection,&pStart,&pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7068,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7069 | ierr = ISGetLocalSize(anchorIS,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7069,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7070 | ierr = ISGetIndices(anchorIS,&anchors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7070,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7071 | for (a = 0; a < size; a++) { | |||
7072 | PetscInt p; | |||
7073 | ||||
7074 | p = anchors[a]; | |||
7075 | if (p >= pStart && p < pEnd) { | |||
7076 | PetscInt dof; | |||
7077 | ||||
7078 | ierr = PetscSectionGetDof(anchorSection,p,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7078,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7079 | if (dof) { | |||
7080 | PetscErrorCode ierr2; | |||
7081 | ||||
7082 | ierr2 = ISRestoreIndices(anchorIS,&anchors);CHKERRQ(ierr2)do {if (__builtin_expect(!!(ierr2),0)) return PetscError(((MPI_Comm )0x44000001),7082,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr2,PETSC_ERROR_REPEAT," ");} while (0); | |||
7083 | SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Point %D cannot be constrained and an anchor",p)return PetscError(((MPI_Comm)0x44000001),7083,__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); | |||
7084 | } | |||
7085 | } | |||
7086 | } | |||
7087 | ierr = ISRestoreIndices(anchorIS,&anchors);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 | } | |||
7089 | #endif | |||
7090 | /* reset the generic constraints */ | |||
7091 | ierr = DMSetDefaultConstraints(dm,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7091,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7092 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
7093 | } | |||
7094 | ||||
7095 | static PetscErrorCode DMPlexCreateConstraintSection_Anchors(DM dm, PetscSection section, PetscSection *cSec) | |||
7096 | { | |||
7097 | PetscSection anchorSection; | |||
7098 | PetscInt pStart, pEnd, sStart, sEnd, p, dof, numFields, f; | |||
7099 | PetscErrorCode ierr; | |||
7100 | ||||
7101 | 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] = 7101; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
7102 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),7102,__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),7102 ,__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),7102,__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),7102,__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); | |||
7103 | ierr = DMPlexGetAnchors(dm,&anchorSection,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7103,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7104 | ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),cSec);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 | ierr = PetscSectionGetNumFields(section,&numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7105,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7106 | if (numFields) { | |||
7107 | PetscInt f; | |||
7108 | ierr = PetscSectionSetNumFields(*cSec,numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7108,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7109 | ||||
7110 | for (f = 0; f < numFields; f++) { | |||
7111 | PetscInt numComp; | |||
7112 | ||||
7113 | ierr = PetscSectionGetFieldComponents(section,f,&numComp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7113,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7114 | ierr = PetscSectionSetFieldComponents(*cSec,f,numComp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7114,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7115 | } | |||
7116 | } | |||
7117 | ierr = PetscSectionGetChart(anchorSection,&pStart,&pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7117,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7118 | ierr = PetscSectionGetChart(section,&sStart,&sEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7118,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7119 | pStart = PetscMax(pStart,sStart)(((pStart)<(sStart)) ? (sStart) : (pStart)); | |||
7120 | pEnd = PetscMin(pEnd,sEnd)(((pEnd)<(sEnd)) ? (pEnd) : (sEnd)); | |||
7121 | pEnd = PetscMax(pStart,pEnd)(((pStart)<(pEnd)) ? (pEnd) : (pStart)); | |||
7122 | ierr = PetscSectionSetChart(*cSec,pStart,pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7122,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7123 | for (p = pStart; p < pEnd; p++) { | |||
7124 | ierr = PetscSectionGetDof(anchorSection,p,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7124,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7125 | if (dof) { | |||
7126 | ierr = PetscSectionGetDof(section,p,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7126,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7127 | ierr = PetscSectionSetDof(*cSec,p,dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7127,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7128 | for (f = 0; f < numFields; f++) { | |||
7129 | ierr = PetscSectionGetFieldDof(section,p,f,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7129,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7130 | ierr = PetscSectionSetFieldDof(*cSec,p,f,dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7130,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7131 | } | |||
7132 | } | |||
7133 | } | |||
7134 | ierr = PetscSectionSetUp(*cSec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7134,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7135 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
7136 | } | |||
7137 | ||||
7138 | static PetscErrorCode DMPlexCreateConstraintMatrix_Anchors(DM dm, PetscSection section, PetscSection cSec, Mat *cMat) | |||
7139 | { | |||
7140 | PetscSection aSec; | |||
7141 | PetscInt pStart, pEnd, p, dof, aDof, aOff, off, nnz, annz, m, n, q, a, offset, *i, *j; | |||
7142 | const PetscInt *anchors; | |||
7143 | PetscInt numFields, f; | |||
7144 | IS aIS; | |||
7145 | PetscErrorCode ierr; | |||
7146 | ||||
7147 | 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] = 7147; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
7148 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),7148,__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),7148 ,__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),7148,__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),7148,__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); | |||
7149 | ierr = PetscSectionGetStorageSize(cSec, &m);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 = PetscSectionGetStorageSize(section, &n);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 | ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),cMat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7151,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7152 | ierr = MatSetSizes(*cMat,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7152,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7153 | ierr = MatSetType(*cMat,MATSEQAIJ"seqaij");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 | ierr = DMPlexGetAnchors(dm,&aSec,&aIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7154,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7155 | ierr = ISGetIndices(aIS,&anchors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7155,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7156 | /* cSec will be a subset of aSec and section */ | |||
7157 | ierr = PetscSectionGetChart(cSec,&pStart,&pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7157,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7158 | ierr = PetscMalloc1(m+1,&i)PetscMallocA(1,PETSC_FALSE,7158,__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),7158,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7159 | i[0] = 0; | |||
7160 | ierr = PetscSectionGetNumFields(section,&numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7160,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7161 | for (p = pStart; p < pEnd; p++) { | |||
7162 | PetscInt rDof, rOff, r; | |||
7163 | ||||
7164 | ierr = PetscSectionGetDof(aSec,p,&rDof);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 | if (!rDof) continue; | |||
7166 | ierr = PetscSectionGetOffset(aSec,p,&rOff);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 | if (numFields) { | |||
7168 | for (f = 0; f < numFields; f++) { | |||
7169 | annz = 0; | |||
7170 | for (r = 0; r < rDof; r++) { | |||
7171 | a = anchors[rOff + r]; | |||
7172 | ierr = PetscSectionGetFieldDof(section,a,f,&aDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7172,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7173 | annz += aDof; | |||
7174 | } | |||
7175 | ierr = PetscSectionGetFieldDof(cSec,p,f,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7175,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7176 | ierr = PetscSectionGetFieldOffset(cSec,p,f,&off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7176,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7177 | for (q = 0; q < dof; q++) { | |||
7178 | i[off + q + 1] = i[off + q] + annz; | |||
7179 | } | |||
7180 | } | |||
7181 | } | |||
7182 | else { | |||
7183 | annz = 0; | |||
7184 | for (q = 0; q < dof; q++) { | |||
7185 | a = anchors[off + q]; | |||
7186 | ierr = PetscSectionGetDof(section,a,&aDof);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 | annz += aDof; | |||
7188 | } | |||
7189 | ierr = PetscSectionGetDof(cSec,p,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7189,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7190 | ierr = PetscSectionGetOffset(cSec,p,&off);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 | for (q = 0; q < dof; q++) { | |||
7192 | i[off + q + 1] = i[off + q] + annz; | |||
7193 | } | |||
7194 | } | |||
7195 | } | |||
7196 | nnz = i[m]; | |||
7197 | ierr = PetscMalloc1(nnz,&j)PetscMallocA(1,PETSC_FALSE,7197,__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),7197,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7198 | offset = 0; | |||
7199 | for (p = pStart; p < pEnd; p++) { | |||
7200 | if (numFields) { | |||
7201 | for (f = 0; f < numFields; f++) { | |||
7202 | ierr = PetscSectionGetFieldDof(cSec,p,f,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7202,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7203 | for (q = 0; q < dof; q++) { | |||
7204 | PetscInt rDof, rOff, r; | |||
7205 | ierr = PetscSectionGetDof(aSec,p,&rDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7205,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7206 | ierr = PetscSectionGetOffset(aSec,p,&rOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7206,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7207 | for (r = 0; r < rDof; r++) { | |||
7208 | PetscInt s; | |||
7209 | ||||
7210 | a = anchors[rOff + r]; | |||
7211 | ierr = PetscSectionGetFieldDof(section,a,f,&aDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7211,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7212 | ierr = PetscSectionGetFieldOffset(section,a,f,&aOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7212,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7213 | for (s = 0; s < aDof; s++) { | |||
7214 | j[offset++] = aOff + s; | |||
7215 | } | |||
7216 | } | |||
7217 | } | |||
7218 | } | |||
7219 | } | |||
7220 | else { | |||
7221 | ierr = PetscSectionGetDof(cSec,p,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7221,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7222 | for (q = 0; q < dof; q++) { | |||
7223 | PetscInt rDof, rOff, r; | |||
7224 | ierr = PetscSectionGetDof(aSec,p,&rDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7224,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7225 | ierr = PetscSectionGetOffset(aSec,p,&rOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7225,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7226 | for (r = 0; r < rDof; r++) { | |||
7227 | PetscInt s; | |||
7228 | ||||
7229 | a = anchors[rOff + r]; | |||
7230 | ierr = PetscSectionGetDof(section,a,&aDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7230,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7231 | ierr = PetscSectionGetOffset(section,a,&aOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7231,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7232 | for (s = 0; s < aDof; s++) { | |||
7233 | j[offset++] = aOff + s; | |||
7234 | } | |||
7235 | } | |||
7236 | } | |||
7237 | } | |||
7238 | } | |||
7239 | ierr = MatSeqAIJSetPreallocationCSR(*cMat,i,j,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7239,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7240 | ierr = PetscFree(i)((*PetscTrFree)((void*)(i),7240,__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),7240,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7241 | ierr = PetscFree(j)((*PetscTrFree)((void*)(j),7241,__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),7241,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7242 | ierr = ISRestoreIndices(aIS,&anchors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7242,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7243 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
7244 | } | |||
7245 | ||||
7246 | PetscErrorCode DMCreateDefaultConstraints_Plex(DM dm) | |||
7247 | { | |||
7248 | DM_Plex *plex = (DM_Plex *)dm->data; | |||
7249 | PetscSection anchorSection, section, cSec; | |||
7250 | Mat cMat; | |||
7251 | PetscErrorCode ierr; | |||
7252 | ||||
7253 | 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] = 7253; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
7254 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),7254,__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),7254 ,__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),7254,__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),7254,__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); | |||
7255 | ierr = DMPlexGetAnchors(dm,&anchorSection,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7255,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7256 | if (anchorSection) { | |||
7257 | PetscInt Nf; | |||
7258 | ||||
7259 | ierr = DMGetSection(dm,§ion);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7259,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7260 | ierr = DMPlexCreateConstraintSection_Anchors(dm,section,&cSec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7260,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7261 | ierr = DMPlexCreateConstraintMatrix_Anchors(dm,section,cSec,&cMat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7261,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7262 | ierr = DMGetNumFields(dm,&Nf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7262,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7263 | if (Nf && plex->computeanchormatrix) {ierr = (*plex->computeanchormatrix)(dm,section,cSec,cMat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7263,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
7264 | ierr = DMSetDefaultConstraints(dm,cSec,cMat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7264,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7265 | ierr = PetscSectionDestroy(&cSec);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 | ierr = MatDestroy(&cMat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7266,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7267 | } | |||
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 | PetscErrorCode DMCreateSubDomainDM_Plex(DM dm, DMLabel label, PetscInt value, IS *is, DM *subdm) | |||
7272 | { | |||
7273 | IS subis; | |||
7274 | PetscSection section, subsection; | |||
7275 | PetscErrorCode ierr; | |||
7276 | ||||
7277 | 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] = 7277; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
7278 | ierr = DMGetDefaultSection(dm, §ion);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7278,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7279 | if (!section) SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_ARG_WRONG, "Must set default section for DM before splitting subdomain")return PetscError(PetscObjectComm((PetscObject) dm),7279,__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" ); | |||
7280 | if (!subdm) SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_ARG_WRONG, "Must set output subDM for splitting subdomain")return PetscError(PetscObjectComm((PetscObject) dm),7280,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62, PETSC_ERROR_INITIAL,"Must set output subDM for splitting subdomain" ); | |||
7281 | /* Create subdomain */ | |||
7282 | ierr = DMPlexFilter(dm, label, value, subdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7282,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7283 | /* Create submodel */ | |||
7284 | ierr = DMPlexCreateSubpointIS(*subdm, &subis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7284,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7285 | ierr = PetscSectionCreateSubmeshSection(section, subis, &subsection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7285,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7286 | ierr = ISDestroy(&subis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7286,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7287 | ierr = DMSetDefaultSection(*subdm, subsection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7287,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7288 | ierr = PetscSectionDestroy(&subsection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7288,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7289 | ierr = DMCopyDisc(dm, *subdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7289,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7290 | /* Create map from submodel to global model */ | |||
7291 | if (is) { | |||
7292 | PetscSection sectionGlobal, subsectionGlobal; | |||
7293 | IS spIS; | |||
7294 | const PetscInt *spmap; | |||
7295 | PetscInt *subIndices; | |||
7296 | PetscInt subSize = 0, subOff = 0, pStart, pEnd, p; | |||
7297 | PetscInt Nf, f, bs = -1, bsLocal[2], bsMinMax[2]; | |||
7298 | ||||
7299 | ierr = DMPlexCreateSubpointIS(*subdm, &spIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7299,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7300 | ierr = ISGetIndices(spIS, &spmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7300,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7301 | ierr = PetscSectionGetNumFields(section, &Nf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7301,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7302 | ierr = DMGetDefaultGlobalSection(dm, §ionGlobal);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 | ierr = DMGetDefaultGlobalSection(*subdm, &subsectionGlobal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7303,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7304 | ierr = PetscSectionGetChart(subsection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7304,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7305 | for (p = pStart; p < pEnd; ++p) { | |||
7306 | PetscInt gdof, pSubSize = 0; | |||
7307 | ||||
7308 | ierr = PetscSectionGetDof(sectionGlobal, p, &gdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7308,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7309 | if (gdof > 0) { | |||
7310 | for (f = 0; f < Nf; ++f) { | |||
7311 | PetscInt fdof, fcdof; | |||
7312 | ||||
7313 | ierr = PetscSectionGetFieldDof(subsection, p, f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7313,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7314 | ierr = PetscSectionGetFieldConstraintDof(subsection, p, f, &fcdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7314,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7315 | pSubSize += fdof-fcdof; | |||
7316 | } | |||
7317 | subSize += pSubSize; | |||
7318 | if (pSubSize) { | |||
7319 | if (bs < 0) { | |||
7320 | bs = pSubSize; | |||
7321 | } else if (bs != pSubSize) { | |||
7322 | /* Layout does not admit a pointwise block size */ | |||
7323 | bs = 1; | |||
7324 | } | |||
7325 | } | |||
7326 | } | |||
7327 | } | |||
7328 | /* Must have same blocksize on all procs (some might have no points) */ | |||
7329 | bsLocal[0] = bs < 0 ? PETSC_MAX_INT2147483647 : bs; bsLocal[1] = bs; | |||
7330 | ierr = PetscGlobalMinMaxInt(PetscObjectComm((PetscObject) dm), bsLocal, bsMinMax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7330,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7331 | if (bsMinMax[0] != bsMinMax[1]) {bs = 1;} | |||
7332 | else {bs = bsMinMax[0];} | |||
7333 | ierr = PetscMalloc1(subSize, &subIndices)PetscMallocA(1,PETSC_FALSE,7333,__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),7333,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7334 | for (p = pStart; p < pEnd; ++p) { | |||
7335 | PetscInt gdof, goff; | |||
7336 | ||||
7337 | ierr = PetscSectionGetDof(subsectionGlobal, p, &gdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7337,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7338 | if (gdof > 0) { | |||
7339 | const PetscInt point = spmap[p]; | |||
7340 | ||||
7341 | ierr = PetscSectionGetOffset(sectionGlobal, point, &goff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7341,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7342 | for (f = 0; f < Nf; ++f) { | |||
7343 | PetscInt fdof, fcdof, fc, f2, poff = 0; | |||
7344 | ||||
7345 | /* Can get rid of this loop by storing field information in the global section */ | |||
7346 | for (f2 = 0; f2 < f; ++f2) { | |||
7347 | ierr = PetscSectionGetFieldDof(section, p, f2, &fdof);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 | ierr = PetscSectionGetFieldConstraintDof(section, p, f2, &fcdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7348,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7349 | poff += fdof-fcdof; | |||
7350 | } | |||
7351 | ierr = PetscSectionGetFieldDof(section, p, f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7351,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7352 | ierr = PetscSectionGetFieldConstraintDof(section, p, f, &fcdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7352,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7353 | for (fc = 0; fc < fdof-fcdof; ++fc, ++subOff) { | |||
7354 | subIndices[subOff] = goff+poff+fc; | |||
7355 | } | |||
7356 | } | |||
7357 | } | |||
7358 | } | |||
7359 | ierr = ISRestoreIndices(spIS, &spmap);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 = ISDestroy(&spIS);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 = ISCreateGeneral(PetscObjectComm((PetscObject)dm), subSize, subIndices, PETSC_OWN_POINTER, is);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 (bs > 1) { | |||
7363 | /* We need to check that the block size does not come from non-contiguous fields */ | |||
7364 | PetscInt i, j, set = 1; | |||
7365 | for (i = 0; i < subSize; i += bs) { | |||
7366 | for (j = 0; j < bs; ++j) { | |||
7367 | if (subIndices[i+j] != subIndices[i]+j) {set = 0; break;} | |||
7368 | } | |||
7369 | } | |||
7370 | if (set) {ierr = ISSetBlockSize(*is, bs);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 | /* Attach nullspace */ | |||
7373 | for (f = 0; f < Nf; ++f) { | |||
7374 | (*subdm)->nullspaceConstructors[f] = dm->nullspaceConstructors[f]; | |||
7375 | if ((*subdm)->nullspaceConstructors[f]) break; | |||
7376 | } | |||
7377 | if (f < Nf) { | |||
7378 | MatNullSpace nullSpace; | |||
7379 | ||||
7380 | ierr = (*(*subdm)->nullspaceConstructors[f])(*subdm, f, &nullSpace);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 | ierr = PetscObjectCompose((PetscObject) *is, "nullspace", (PetscObject) nullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),7381,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
7382 | ierr = MatNullSpaceDestroy(&nullSpace);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 | } | |||
7384 | } | |||
7385 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
7386 | } |