File: | dm/impls/plex/plexglvis.c |
Warning: | line 511, column 17 Value stored to 'vpc' is never read |
[?] Use j/k keys for keyboard navigation
1 | #include <petsc/private/glvisviewerimpl.h> |
2 | #include <petsc/private/petscimpl.h> |
3 | #include <petsc/private/dmpleximpl.h> |
4 | #include <petscbt.h> |
5 | #include <petscdmplex.h> |
6 | #include <petscsf.h> |
7 | #include <petscds.h> |
8 | |
9 | typedef struct { |
10 | PetscInt nf; |
11 | VecScatter *scctx; |
12 | } GLVisViewerCtx; |
13 | |
14 | static PetscErrorCode DestroyGLVisViewerCtx_Private(void *vctx) |
15 | { |
16 | GLVisViewerCtx *ctx = (GLVisViewerCtx*)vctx; |
17 | PetscInt i; |
18 | PetscErrorCode ierr; |
19 | |
20 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ; petscstack->line[petscstack->currentsize] = 20; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
21 | for (i=0;i<ctx->nf;i++) { |
22 | ierr = VecScatterDestroy(&ctx->scctx[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),22,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
23 | } |
24 | ierr = PetscFree(ctx->scctx)((*PetscTrFree)((void*)(ctx->scctx),24,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ) || ((ctx->scctx) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),24,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
25 | ierr = PetscFree(vctx)((*PetscTrFree)((void*)(vctx),25,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ) || ((vctx) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),25,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
26 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
27 | } |
28 | |
29 | static PetscErrorCode DMPlexSampleGLVisFields_Private(PetscObject oX, PetscInt nf, PetscObject oXfield[], void *vctx) |
30 | { |
31 | GLVisViewerCtx *ctx = (GLVisViewerCtx*)vctx; |
32 | PetscInt f; |
33 | PetscErrorCode ierr; |
34 | |
35 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ; petscstack->line[petscstack->currentsize] = 35; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
36 | for (f=0;f<nf;f++) { |
37 | ierr = VecScatterBegin(ctx->scctx[f],(Vec)oX,(Vec)oXfield[f],INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),37,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
38 | ierr = VecScatterEnd(ctx->scctx[f],(Vec)oX,(Vec)oXfield[f],INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),38,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
39 | } |
40 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
41 | } |
42 | |
43 | /* for FEM, it works for H1 fields only and extracts dofs at cell vertices, discarding any other dof */ |
44 | PetscErrorCode DMSetUpGLVisViewer_Plex(PetscObject odm, PetscViewer viewer) |
45 | { |
46 | DM dm = (DM)odm; |
47 | Vec xlocal,xfield,*Ufield; |
48 | PetscDS ds; |
49 | IS globalNum,isfield; |
50 | PetscBT vown; |
51 | char **fieldname = NULL((void*)0),**fec_type = NULL((void*)0); |
52 | const PetscInt *gNum; |
53 | PetscInt *nlocal,*bs,*idxs,*dims; |
54 | PetscInt f,maxfields,nfields,c,totc,totdofs,Nv,cum,i; |
55 | PetscInt dim,cStart,cEnd,vStart,vEnd; |
56 | GLVisViewerCtx *ctx; |
57 | PetscSection s; |
58 | PetscErrorCode ierr; |
59 | |
60 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ; petscstack->line[petscstack->currentsize] = 60; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
61 | ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),61,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
62 | ierr = DMPlexGetDepthStratum(dm,0,&vStart,&vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),62,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
63 | ierr = DMPlexGetHeightStratum(dm,0,&cStart,&cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),63,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
64 | ierr = PetscObjectQuery((PetscObject)dm,"_glvis_plex_gnum",(PetscObject*)&globalNum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),64,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
65 | if (!globalNum) { |
66 | ierr = DMPlexCreateCellNumbering_Internal(dm,PETSC_TRUE,&globalNum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),66,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
67 | ierr = PetscObjectCompose((PetscObject)dm,"_glvis_plex_gnum",(PetscObject)globalNum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),67,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
68 | ierr = PetscObjectDereference((PetscObject)globalNum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),68,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
69 | } |
70 | ierr = ISGetIndices(globalNum,&gNum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),70,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
71 | ierr = PetscBTCreate(vEnd-vStart,&vown);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),71,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
72 | for (c = cStart, totc = 0; c < cEnd; c++) { |
73 | if (gNum[c-cStart] >= 0) { |
74 | PetscInt i,numPoints,*points = NULL((void*)0); |
75 | |
76 | totc++; |
77 | ierr = DMPlexGetTransitiveClosure(dm,c,PETSC_TRUE,&numPoints,&points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),77,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
78 | for (i=0;i<numPoints*2;i+= 2) { |
79 | if ((points[i] >= vStart) && (points[i] < vEnd)) { |
80 | ierr = PetscBTSet(vown,points[i]-vStart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),80,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
81 | } |
82 | } |
83 | ierr = DMPlexRestoreTransitiveClosure(dm,c,PETSC_TRUE,&numPoints,&points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),83,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
84 | } |
85 | } |
86 | for (f=0,Nv=0;f<vEnd-vStart;f++) if (PetscLikely(PetscBTLookup(vown,f))__builtin_expect(!!(PetscBTLookup(vown,f)),1)) Nv++; |
87 | |
88 | ierr = DMCreateLocalVector(dm,&xlocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),88,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
89 | ierr = VecGetLocalSize(xlocal,&totdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),89,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
90 | ierr = DMGetSection(dm,&s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),90,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
91 | ierr = PetscSectionGetNumFields(s,&nfields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),91,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
92 | for (f=0,maxfields=0;f<nfields;f++) { |
93 | PetscInt bs; |
94 | |
95 | ierr = PetscSectionGetFieldComponents(s,f,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),95,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
96 | maxfields += bs; |
97 | } |
98 | ierr = PetscCalloc7(maxfields,&fieldname,maxfields,&nlocal,maxfields,&bs,maxfields,&dims,maxfields,&fec_type,totdofs,&idxs,maxfields,&Ufield)PetscMallocA(7,PETSC_TRUE,98,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,(size_t)(maxfields)*sizeof(**(&fieldname)),(&fieldname ),(size_t)(maxfields)*sizeof(**(&nlocal)),(&nlocal),( size_t)(maxfields)*sizeof(**(&bs)),(&bs),(size_t)(maxfields )*sizeof(**(&dims)),(&dims),(size_t)(maxfields)*sizeof (**(&fec_type)),(&fec_type),(size_t)(totdofs)*sizeof( **(&idxs)),(&idxs),(size_t)(maxfields)*sizeof(**(& Ufield)),(&Ufield));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),98,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
99 | ierr = PetscNew(&ctx)PetscMallocA(1,PETSC_TRUE,99,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,(size_t)(1)*sizeof(**((&ctx))),((&ctx)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),99,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
100 | ierr = PetscCalloc1(maxfields,&ctx->scctx)PetscMallocA(1,PETSC_TRUE,100,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,(size_t)(maxfields)*sizeof(**(&ctx->scctx)),(&ctx ->scctx));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),100,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
101 | ierr = DMGetDS(dm,&ds);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),101,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
102 | if (ds) { |
103 | for (f=0;f<nfields;f++) { |
104 | const char* fname; |
105 | char name[256]; |
106 | PetscObject disc; |
107 | size_t len; |
108 | |
109 | ierr = PetscSectionGetFieldName(s,f,&fname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),109,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
110 | ierr = PetscStrlen(fname,&len);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),110,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
111 | if (len) { |
112 | ierr = PetscStrcpy(name,fname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),112,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
113 | } else { |
114 | ierr = PetscSNPrintf(name,256,"Field%D",f);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),114,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
115 | } |
116 | ierr = PetscDSGetDiscretization(ds,f,&disc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),116,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
117 | if (disc) { |
118 | PetscClassId id; |
119 | PetscInt Nc; |
120 | char fec[64]; |
121 | |
122 | ierr = PetscObjectGetClassId(disc, &id);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),122,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
123 | if (id == PETSCFE_CLASSID) { |
124 | PetscFE fem = (PetscFE)disc; |
125 | PetscDualSpace sp; |
126 | PetscDualSpaceType spname; |
127 | PetscInt order; |
128 | PetscBool islag,continuous,H1 = PETSC_TRUE; |
129 | |
130 | ierr = PetscFEGetNumComponents(fem,&Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),130,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
131 | ierr = PetscFEGetDualSpace(fem,&sp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),131,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
132 | ierr = PetscDualSpaceGetType(sp,&spname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),132,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
133 | ierr = PetscStrcmp(spname,PETSCDUALSPACELAGRANGE"lagrange",&islag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),133,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
134 | if (!islag) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Unsupported dual space")return PetscError(PetscObjectComm((PetscObject)dm),134,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 56,PETSC_ERROR_INITIAL,"Unsupported dual space"); |
135 | ierr = PetscDualSpaceLagrangeGetContinuity(sp,&continuous);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),135,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
136 | if (!continuous) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Discontinuous space visualization currently unsupported")return PetscError(PetscObjectComm((PetscObject)dm),136,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 56,PETSC_ERROR_INITIAL,"Discontinuous space visualization currently unsupported" ); |
137 | ierr = PetscDualSpaceGetOrder(sp,&order);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),137,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
138 | if (continuous && order > 0) { |
139 | ierr = PetscSNPrintf(fec,64,"FiniteElementCollection: H1_%DD_P1",dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),139,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
140 | } else { |
141 | H1 = PETSC_FALSE; |
142 | ierr = PetscSNPrintf(fec,64,"FiniteElementCollection: L2_%DD_P%D",dim,order);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),142,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
143 | } |
144 | ierr = PetscStrallocpy(name,&fieldname[ctx->nf]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),144,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
145 | bs[ctx->nf] = Nc; |
146 | dims[ctx->nf] = dim; |
147 | if (H1) { |
148 | nlocal[ctx->nf] = Nc * Nv; |
149 | ierr = PetscStrallocpy(fec,&fec_type[ctx->nf]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),149,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
150 | ierr = VecCreateSeq(PETSC_COMM_SELF((MPI_Comm)0x44000001),Nv*Nc,&xfield);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),150,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
151 | for (i=0,cum=0;i<vEnd-vStart;i++) { |
152 | PetscInt j,off; |
153 | |
154 | if (PetscUnlikely(!PetscBTLookup(vown,i))__builtin_expect(!!(!PetscBTLookup(vown,i)),0)) continue; |
155 | ierr = PetscSectionGetFieldOffset(s,i+vStart,f,&off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),155,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
156 | for (j=0;j<Nc;j++) idxs[cum++] = off + j; |
157 | } |
158 | ierr = ISCreateGeneral(PetscObjectComm((PetscObject)xlocal),Nv*Nc,idxs,PETSC_USE_POINTER,&isfield);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),158,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
159 | } else { |
160 | nlocal[ctx->nf] = Nc * totc; |
161 | ierr = PetscStrallocpy(fec,&fec_type[ctx->nf]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),161,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
162 | ierr = VecCreateSeq(PETSC_COMM_SELF((MPI_Comm)0x44000001),Nc*totc,&xfield);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),162,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
163 | for (i=0,cum=0;i<cEnd-cStart;i++) { |
164 | PetscInt j,off; |
165 | |
166 | if (PetscUnlikely(gNum[i] < 0)__builtin_expect(!!(gNum[i] < 0),0)) continue; |
167 | ierr = PetscSectionGetFieldOffset(s,i+cStart,f,&off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),167,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
168 | for (j=0;j<Nc;j++) idxs[cum++] = off + j; |
169 | } |
170 | ierr = ISCreateGeneral(PetscObjectComm((PetscObject)xlocal),totc*Nc,idxs,PETSC_USE_POINTER,&isfield);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),170,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
171 | } |
172 | ierr = VecScatterCreate(xlocal,isfield,xfield,NULL((void*)0),&ctx->scctx[ctx->nf]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),172,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
173 | ierr = VecDestroy(&xfield);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),173,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
174 | ierr = ISDestroy(&isfield);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),174,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
175 | ctx->nf++; |
176 | } else if (id == PETSCFV_CLASSID) { |
177 | PetscInt c; |
178 | |
179 | ierr = PetscFVGetNumComponents((PetscFV)disc,&Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),179,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
180 | ierr = PetscSNPrintf(fec,64,"FiniteElementCollection: L2_%DD_P0",dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),180,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
181 | for (c = 0; c < Nc; c++) { |
182 | char comp[256]; |
183 | ierr = PetscSNPrintf(comp,256,"%s-Comp%D",name,c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),183,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
184 | ierr = PetscStrallocpy(comp,&fieldname[ctx->nf]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),184,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
185 | bs[ctx->nf] = 1; /* Does PetscFV support components with different block size? */ |
186 | nlocal[ctx->nf] = totc; |
187 | dims[ctx->nf] = dim; |
188 | ierr = PetscStrallocpy(fec,&fec_type[ctx->nf]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),188,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
189 | ierr = VecCreateSeq(PETSC_COMM_SELF((MPI_Comm)0x44000001),totc,&xfield);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),189,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
190 | for (i=0,cum=0;i<cEnd-cStart;i++) { |
191 | PetscInt off; |
192 | |
193 | if (PetscUnlikely(gNum[i])__builtin_expect(!!(gNum[i]),0)<0) continue; |
194 | ierr = PetscSectionGetFieldOffset(s,i+cStart,f,&off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),194,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
195 | idxs[cum++] = off + c; |
196 | } |
197 | ierr = ISCreateGeneral(PetscObjectComm((PetscObject)xlocal),totc,idxs,PETSC_USE_POINTER,&isfield);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),197,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
198 | ierr = VecScatterCreate(xlocal,isfield,xfield,NULL((void*)0),&ctx->scctx[ctx->nf]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),198,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
199 | ierr = VecDestroy(&xfield);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),199,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
200 | ierr = ISDestroy(&isfield);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),200,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
201 | ctx->nf++; |
202 | } |
203 | } else SETERRQ1(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONG,"Unknown discretization type for field %D",f)return PetscError(PetscObjectComm((PetscObject)dm),203,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 62,PETSC_ERROR_INITIAL,"Unknown discretization type for field %D" ,f); |
204 | } else SETERRQ1(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Missing discretization for field %D",f)return PetscError(PetscObjectComm((PetscObject)dm),204,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 56,PETSC_ERROR_INITIAL,"Missing discretization for field %D", f); |
205 | } |
206 | } else SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Needs a DS attached to the DM")return PetscError(PetscObjectComm((PetscObject)dm),206,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 56,PETSC_ERROR_INITIAL,"Needs a DS attached to the DM"); |
207 | ierr = PetscBTDestroy(&vown);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),207,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
208 | ierr = VecDestroy(&xlocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),208,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
209 | ierr = ISRestoreIndices(globalNum,&gNum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),209,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
210 | |
211 | /* create work vectors */ |
212 | for (f=0;f<ctx->nf;f++) { |
213 | ierr = VecCreateMPI(PetscObjectComm((PetscObject)dm),nlocal[f],PETSC_DECIDE-1,&Ufield[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),213,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
214 | ierr = PetscObjectSetName((PetscObject)Ufield[f],fieldname[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),214,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
215 | ierr = VecSetBlockSize(Ufield[f],bs[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),215,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
216 | ierr = VecSetDM(Ufield[f],dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),216,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
217 | } |
218 | |
219 | /* customize the viewer */ |
220 | ierr = PetscViewerGLVisSetFields(viewer,ctx->nf,(const char**)fec_type,dims,DMPlexSampleGLVisFields_Private,(PetscObject*)Ufield,ctx,DestroyGLVisViewerCtx_Private);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),220,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
221 | for (f=0;f<ctx->nf;f++) { |
222 | ierr = PetscFree(fieldname[f])((*PetscTrFree)((void*)(fieldname[f]),222,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ) || ((fieldname[f]) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),222,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
223 | ierr = PetscFree(fec_type[f])((*PetscTrFree)((void*)(fec_type[f]),223,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ) || ((fec_type[f]) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),223,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
224 | ierr = VecDestroy(&Ufield[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),224,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
225 | } |
226 | ierr = PetscFree7(fieldname,nlocal,bs,dims,fec_type,idxs,Ufield)PetscFreeA(7,226,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,&(fieldname),&(nlocal),&(bs),&(dims),&(fec_type ),&(idxs),&(Ufield));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),226,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
227 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
228 | } |
229 | |
230 | typedef enum {MFEM_POINT=0,MFEM_SEGMENT,MFEM_TRIANGLE,MFEM_SQUARE,MFEM_TETRAHEDRON,MFEM_CUBE,MFEM_PRISM,MFEM_UNDEF} MFEM_cid; |
231 | |
232 | MFEM_cid mfem_table_cid[4][7] = { {MFEM_POINT,MFEM_UNDEF,MFEM_UNDEF ,MFEM_UNDEF ,MFEM_UNDEF ,MFEM_UNDEF,MFEM_UNDEF}, |
233 | {MFEM_POINT,MFEM_UNDEF,MFEM_SEGMENT,MFEM_UNDEF ,MFEM_UNDEF ,MFEM_UNDEF,MFEM_UNDEF}, |
234 | {MFEM_POINT,MFEM_UNDEF,MFEM_SEGMENT,MFEM_TRIANGLE,MFEM_SQUARE ,MFEM_UNDEF,MFEM_UNDEF}, |
235 | {MFEM_POINT,MFEM_UNDEF,MFEM_SEGMENT,MFEM_UNDEF ,MFEM_TETRAHEDRON,MFEM_PRISM,MFEM_CUBE } }; |
236 | |
237 | MFEM_cid mfem_table_cid_unint[4][9] = { {MFEM_POINT,MFEM_UNDEF,MFEM_UNDEF ,MFEM_UNDEF ,MFEM_UNDEF ,MFEM_UNDEF,MFEM_PRISM,MFEM_UNDEF,MFEM_UNDEF}, |
238 | {MFEM_POINT,MFEM_UNDEF,MFEM_SEGMENT,MFEM_UNDEF ,MFEM_UNDEF ,MFEM_UNDEF,MFEM_PRISM,MFEM_UNDEF,MFEM_UNDEF}, |
239 | {MFEM_POINT,MFEM_UNDEF,MFEM_SEGMENT,MFEM_TRIANGLE,MFEM_SQUARE ,MFEM_UNDEF,MFEM_PRISM,MFEM_UNDEF,MFEM_UNDEF}, |
240 | {MFEM_POINT,MFEM_UNDEF,MFEM_SEGMENT,MFEM_UNDEF ,MFEM_TETRAHEDRON,MFEM_UNDEF,MFEM_PRISM,MFEM_UNDEF,MFEM_CUBE } }; |
241 | |
242 | static PetscErrorCode DMPlexGetPointMFEMCellID_Internal(DM dm, DMLabel label, PetscInt minl, PetscInt p, PetscInt *mid, PetscInt *cid) |
243 | { |
244 | DMLabel dlabel; |
245 | PetscInt depth,csize,pdepth,dim; |
246 | PetscErrorCode ierr; |
247 | |
248 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ; petscstack->line[petscstack->currentsize] = 248; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
249 | ierr = DMPlexGetDepthLabel(dm,&dlabel);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),249,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
250 | ierr = DMLabelGetValue(dlabel,p,&pdepth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),250,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
251 | ierr = DMPlexGetConeSize(dm,p,&csize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),251,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
252 | ierr = DMPlexGetDepth(dm,&depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),252,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
253 | ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),253,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
254 | if (label) { |
255 | ierr = DMLabelGetValue(label,p,mid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),255,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
256 | *mid = *mid - minl + 1; /* MFEM does not like negative markers */ |
257 | } else *mid = 1; |
258 | if (depth >=0 && dim != depth) { /* not interpolated, it assumes cell-vertex mesh */ |
259 | #if defined PETSC_USE_DEBUG1 |
260 | if (dim < 0 || dim > 3) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Dimension %D",dim)return PetscError(((MPI_Comm)0x44000001),260,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Dimension %D",dim); |
261 | if (csize > 8) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_SUP,"Found cone size %D for point %D",csize,p)return PetscError(((MPI_Comm)0x44000001),261,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Found cone size %D for point %D",csize ,p); |
262 | if (depth != 1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_SUP,"Found depth %D for point %D. You should interpolate the mesh first",depth,p)return PetscError(((MPI_Comm)0x44000001),262,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Found depth %D for point %D. You should interpolate the mesh first" ,depth,p); |
263 | #endif |
264 | *cid = mfem_table_cid_unint[dim][csize]; |
265 | } else { |
266 | #if defined PETSC_USE_DEBUG1 |
267 | if (csize > 6) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_SUP,"Cone size %D for point %D",csize,p)return PetscError(((MPI_Comm)0x44000001),267,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Cone size %D for point %D",csize,p); |
268 | if (pdepth < 0 || pdepth > 3) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_SUP,"Depth %D for point %D",csize,p)return PetscError(((MPI_Comm)0x44000001),268,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Depth %D for point %D",csize,p); |
269 | #endif |
270 | *cid = mfem_table_cid[pdepth][csize]; |
271 | } |
272 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
273 | } |
274 | |
275 | static PetscErrorCode DMPlexGetPointMFEMVertexIDs_Internal(DM dm, PetscInt p, PetscSection csec, PetscInt *nv, int vids[]) |
276 | { |
277 | PetscInt dim,sdim,dof = 0,off = 0,i,q,vStart,vEnd,numPoints,*points = NULL((void*)0); |
278 | PetscErrorCode ierr; |
279 | |
280 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ; petscstack->line[petscstack->currentsize] = 280; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
281 | ierr = DMPlexGetDepthStratum(dm,0,&vStart,&vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),281,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
282 | ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),282,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
283 | sdim = dim; |
284 | if (csec) { |
285 | PetscInt sStart,sEnd; |
286 | |
287 | ierr = DMGetCoordinateDim(dm,&sdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),287,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
288 | ierr = PetscSectionGetChart(csec,&sStart,&sEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),288,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
289 | ierr = PetscSectionGetOffset(csec,vStart,&off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),289,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
290 | off = off/sdim; |
291 | if (p >= sStart && p < sEnd) { |
292 | ierr = PetscSectionGetDof(csec,p,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),292,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
293 | } |
294 | } |
295 | if (!dof) { |
296 | ierr = DMPlexGetTransitiveClosure(dm,p,PETSC_TRUE,&numPoints,&points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),296,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
297 | for (i=0,q=0;i<numPoints*2;i+= 2) |
298 | if ((points[i] >= vStart) && (points[i] < vEnd)) |
299 | vids[q++] = (int)(points[i]-vStart+off); |
300 | ierr = DMPlexRestoreTransitiveClosure(dm,p,PETSC_TRUE,&numPoints,&points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),300,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
301 | } else { |
302 | ierr = PetscSectionGetOffset(csec,p,&off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),302,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
303 | ierr = PetscSectionGetDof(csec,p,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),303,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
304 | for (q=0;q<dof/sdim;q++) vids[q] = (int)(off/sdim + q); |
305 | } |
306 | *nv = q; |
307 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
308 | } |
309 | |
310 | static PetscErrorCode DMPlexGlvisInvertHybrid(PetscInt cid,int vids[]) |
311 | { |
312 | int tmp; |
313 | |
314 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ; petscstack->line[petscstack->currentsize] = 314; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
315 | if (cid == MFEM_SQUARE) { /* PETSc stores hybrid quads not as counter-clockwise quad */ |
316 | tmp = vids[2]; |
317 | vids[2] = vids[3]; |
318 | vids[3] = tmp; |
319 | } else if (cid == MFEM_PRISM) { /* MFEM uses a different orientation for the base and top triangles of the wedge */ |
320 | tmp = vids[1]; |
321 | vids[1] = vids[2]; |
322 | vids[2] = tmp; |
323 | tmp = vids[4]; |
324 | vids[4] = vids[5]; |
325 | vids[5] = tmp; |
326 | } |
327 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
328 | } |
329 | |
330 | /* |
331 | ASCII visualization/dump: full support for simplices and tensor product cells. It supports AMR |
332 | Higher order meshes are also supported |
333 | */ |
334 | static PetscErrorCode DMPlexView_GLVis_ASCII(DM dm, PetscViewer viewer) |
335 | { |
336 | DMLabel label; |
337 | PetscSection coordSection,parentSection; |
338 | Vec coordinates,hovec; |
339 | const PetscScalar *array; |
340 | PetscInt bf,p,sdim,dim,depth,novl,minl; |
341 | PetscInt cStart,cEnd,cEndInterior,vStart,vEnd,nvert; |
342 | PetscMPIInt size; |
343 | PetscBool localized,isascii; |
344 | PetscBool enable_mfem,enable_boundary,enable_ncmesh; |
345 | PetscBT pown,vown; |
346 | PetscErrorCode ierr; |
347 | PetscContainer glvis_container; |
348 | PetscBool cellvertex = PETSC_FALSE, periodic, enabled = PETSC_TRUE; |
349 | PetscBool enable_emark,enable_bmark; |
350 | const char *fmt; |
351 | char emark[64] = "",bmark[64] = ""; |
352 | |
353 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ; petscstack->line[petscstack->currentsize] = 353; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
354 | PetscValidHeaderSpecific(dm,DM_CLASSID,1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),354,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),354,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.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),354,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),354,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); |
355 | PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2)do { if (!viewer) return PetscError(((MPI_Comm)0x44000001),355 ,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if ( !PetscCheckPointer(viewer,PETSC_OBJECT)) return PetscError((( MPI_Comm)0x44000001),355,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.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),355,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,2); else return PetscError(((MPI_Comm)0x44000001),355,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,2); } } while (0); |
356 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII"ascii",&isascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),356,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
357 | if (!isascii) SETERRQ(PetscObjectComm((PetscObject)viewer),PETSC_ERR_SUP,"Viewer must be of type VIEWERASCII")return PetscError(PetscObjectComm((PetscObject)viewer),357,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 56,PETSC_ERROR_INITIAL,"Viewer must be of type VIEWERASCII"); |
358 | ierr = MPI_Comm_size(PetscObjectComm((PetscObject)viewer),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),358,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
359 | if (size > 1) SETERRQ(PetscObjectComm((PetscObject)viewer),PETSC_ERR_SUP,"Use single sequential viewers for parallel visualization")return PetscError(PetscObjectComm((PetscObject)viewer),359,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 56,PETSC_ERROR_INITIAL,"Use single sequential viewers for parallel visualization" ); |
360 | ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),360,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
361 | |
362 | /* get container: determines if a process visualizes is portion of the data or not */ |
363 | ierr = PetscObjectQuery((PetscObject)viewer,"_glvis_info_container",(PetscObject*)&glvis_container);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),363,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
364 | if (!glvis_container) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_PLIB,"Missing GLVis container")return PetscError(PetscObjectComm((PetscObject)dm),364,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 77,PETSC_ERROR_INITIAL,"Missing GLVis container"); |
365 | { |
366 | PetscViewerGLVisInfo glvis_info; |
367 | ierr = PetscContainerGetPointer(glvis_container,(void**)&glvis_info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),367,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
368 | enabled = glvis_info->enabled; |
369 | fmt = glvis_info->fmt; |
370 | } |
371 | |
372 | /* Users can attach a coordinate vector to the DM in case they have a higher-order mesh |
373 | DMPlex does not currently support HO meshes, so there's no API for this */ |
374 | ierr = PetscObjectQuery((PetscObject)dm,"_glvis_mesh_coords",(PetscObject*)&hovec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),374,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
375 | |
376 | 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),376,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
377 | ierr = DMPlexGetHeightStratum(dm,0,&cStart,&cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),377,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
378 | cEndInterior = cEndInterior < 0 ? cEnd : cEndInterior; |
379 | ierr = DMPlexGetDepthStratum(dm,0,&vStart,&vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),379,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
380 | ierr = DMGetPeriodicity(dm,&periodic,NULL((void*)0),NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),380,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
381 | ierr = DMGetCoordinatesLocalized(dm,&localized);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),381,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
382 | if (periodic && !localized && !hovec) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Coordinates need to be localized")return PetscError(PetscObjectComm((PetscObject)dm),382,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 56,PETSC_ERROR_INITIAL,"Coordinates need to be localized"); |
383 | ierr = DMGetCoordinateSection(dm,&coordSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),383,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
384 | ierr = DMGetCoordinateDim(dm,&sdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),384,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
385 | ierr = DMGetCoordinatesLocal(dm,&coordinates);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),385,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
386 | if (!coordinates && !hovec) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Missing local coordinates vector")return PetscError(PetscObjectComm((PetscObject)dm),386,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 56,PETSC_ERROR_INITIAL,"Missing local coordinates vector"); |
387 | |
388 | /* |
389 | a couple of sections of the mesh specification are disabled |
390 | - boundary: the boundary is not needed for proper mesh visualization unless we want to visualize boundary attributes or we have high-order coordinates in 3D (topologically) |
391 | - vertex_parents: used for non-conforming meshes only when we want to use MFEM as a discretization package |
392 | and be able to derefine the mesh (MFEM does not currently have to ability to read ncmeshes in parallel) |
393 | */ |
394 | enable_boundary = PETSC_FALSE; |
395 | enable_ncmesh = PETSC_FALSE; |
396 | enable_mfem = PETSC_FALSE; |
397 | enable_emark = PETSC_FALSE; |
398 | enable_bmark = PETSC_FALSE; |
399 | /* I'm tired of problems with negative values in the markers, disable them */ |
400 | ierr = PetscOptionsBegin(PetscObjectComm((PetscObject)dm),((PetscObject)dm)->prefix,"GLVis PetscViewer DMPlex Options","PetscViewer")0; do { PetscOptionItems PetscOptionsObjectBase; PetscOptionItems *PetscOptionsObject = &PetscOptionsObjectBase; PetscMemzero (PetscOptionsObject,sizeof(PetscOptionItems)); for (PetscOptionsObject ->count=(PetscOptionsPublish?-1:1); PetscOptionsObject-> count<2; PetscOptionsObject->count++) { PetscErrorCode _5_ierr = PetscOptionsBegin_Private(PetscOptionsObject,PetscObjectComm ((PetscObject)dm),((PetscObject)dm)->prefix,"GLVis PetscViewer DMPlex Options" ,"PetscViewer");do {if (__builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm)0x44000001),400,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),400,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
401 | ierr = PetscOptionsBool("-viewer_glvis_dm_plex_enable_boundary","Enable boundary section in mesh representation",NULL,enable_boundary,&enable_boundary,NULL)PetscOptionsBool_Private(PetscOptionsObject,"-viewer_glvis_dm_plex_enable_boundary" ,"Enable boundary section in mesh representation",((void*)0), enable_boundary,&enable_boundary,((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),401,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
402 | ierr = PetscOptionsBool("-viewer_glvis_dm_plex_enable_ncmesh","Enable vertex_parents section in mesh representation (allows derefinement)",NULL,enable_ncmesh,&enable_ncmesh,NULL)PetscOptionsBool_Private(PetscOptionsObject,"-viewer_glvis_dm_plex_enable_ncmesh" ,"Enable vertex_parents section in mesh representation (allows derefinement)" ,((void*)0),enable_ncmesh,&enable_ncmesh,((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),402,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
403 | ierr = PetscOptionsBool("-viewer_glvis_dm_plex_enable_mfem","Dump a mesh that can be used with MFEM's FiniteElementSpaces",NULL,enable_mfem,&enable_mfem,NULL)PetscOptionsBool_Private(PetscOptionsObject,"-viewer_glvis_dm_plex_enable_mfem" ,"Dump a mesh that can be used with MFEM's FiniteElementSpaces" ,((void*)0),enable_mfem,&enable_mfem,((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),403,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
404 | ierr = PetscOptionsString("-viewer_glvis_dm_plex_emarker","String for the material id label",NULL,emark,emark,sizeof(emark),&enable_emark)PetscOptionsString_Private(PetscOptionsObject,"-viewer_glvis_dm_plex_emarker" ,"String for the material id label",((void*)0),emark,emark,sizeof (emark),&enable_emark);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),404,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
405 | ierr = PetscOptionsString("-viewer_glvis_dm_plex_bmarker","String for the boundary id label",NULL,bmark,bmark,sizeof(bmark),&enable_bmark)PetscOptionsString_Private(PetscOptionsObject,"-viewer_glvis_dm_plex_bmarker" ,"String for the boundary id label",((void*)0),bmark,bmark,sizeof (bmark),&enable_bmark);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),405,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
406 | ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if ( __builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm )0x44000001),406,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);}} while (0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),406,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
407 | if (enable_bmark) enable_boundary = PETSC_TRUE; |
408 | |
409 | ierr = MPI_Comm_size(PetscObjectComm((PetscObject)dm),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),409,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
410 | if (enable_ncmesh && size > 1) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Not supported in parallel")return PetscError(PetscObjectComm((PetscObject)dm),410,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 56,PETSC_ERROR_INITIAL,"Not supported in parallel"); |
411 | ierr = DMPlexGetDepth(dm,&depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),411,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
412 | if (enable_boundary && depth >= 0 && dim != depth) SETERRQ(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONG, "Mesh must be interpolated. "return PetscError(PetscObjectComm((PetscObject)dm),413,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 62,PETSC_ERROR_INITIAL,"Mesh must be interpolated. " "Alternatively, run with -viewer_glvis_dm_plex_enable_boundary 0" ) |
413 | "Alternatively, run with -viewer_glvis_dm_plex_enable_boundary 0")return PetscError(PetscObjectComm((PetscObject)dm),413,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 62,PETSC_ERROR_INITIAL,"Mesh must be interpolated. " "Alternatively, run with -viewer_glvis_dm_plex_enable_boundary 0" ); |
414 | if (enable_ncmesh && depth >= 0 && dim != depth) SETERRQ(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONG, "Mesh must be interpolated. "return PetscError(PetscObjectComm((PetscObject)dm),415,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 62,PETSC_ERROR_INITIAL,"Mesh must be interpolated. " "Alternatively, run with -viewer_glvis_dm_plex_enable_ncmesh 0" ) |
415 | "Alternatively, run with -viewer_glvis_dm_plex_enable_ncmesh 0")return PetscError(PetscObjectComm((PetscObject)dm),415,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 62,PETSC_ERROR_INITIAL,"Mesh must be interpolated. " "Alternatively, run with -viewer_glvis_dm_plex_enable_ncmesh 0" ); |
416 | if (depth >=0 && dim != depth) { /* not interpolated, it assumes cell-vertex mesh */ |
417 | if (depth != 1) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported depth %D. You should interpolate the mesh first",depth)return PetscError(((MPI_Comm)0x44000001),417,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Unsupported depth %D. You should interpolate the mesh first" ,depth); |
418 | cellvertex = PETSC_TRUE; |
419 | } |
420 | |
421 | /* Identify possible cells in the overlap */ |
422 | novl = 0; |
423 | pown = NULL((void*)0); |
424 | if (size > 1) { |
425 | IS globalNum = NULL((void*)0); |
426 | const PetscInt *gNum; |
427 | PetscBool ovl = PETSC_FALSE; |
428 | |
429 | ierr = PetscObjectQuery((PetscObject)dm,"_glvis_plex_gnum",(PetscObject*)&globalNum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),429,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
430 | if (!globalNum) { |
431 | ierr = DMPlexCreateCellNumbering_Internal(dm,PETSC_TRUE,&globalNum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),431,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
432 | ierr = PetscObjectCompose((PetscObject)dm,"_glvis_plex_gnum",(PetscObject)globalNum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),432,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
433 | ierr = PetscObjectDereference((PetscObject)globalNum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),433,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
434 | } |
435 | ierr = ISGetIndices(globalNum,&gNum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),435,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
436 | for (p=cStart; p<cEnd; p++) { |
437 | if (gNum[p-cStart] < 0) { |
438 | ovl = PETSC_TRUE; |
439 | novl++; |
440 | } |
441 | } |
442 | if (ovl) { |
443 | /* it may happen that pown get not destroyed, if the user closes the window while this function is running. |
444 | TODO: garbage collector? attach pown to dm? */ |
445 | ierr = PetscBTCreate(cEnd-cStart,&pown);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),445,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
446 | for (p=cStart; p<cEnd; p++) { |
447 | if (gNum[p-cStart] < 0) continue; |
448 | else { |
449 | ierr = PetscBTSet(pown,p-cStart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),449,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
450 | } |
451 | } |
452 | } |
453 | ierr = ISRestoreIndices(globalNum,&gNum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),453,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
454 | } |
455 | |
456 | /* return if this process is disabled */ |
457 | if (!enabled) { |
458 | ierr = PetscViewerASCIIPrintf(viewer,"MFEM mesh v1.1\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),458,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
459 | ierr = PetscViewerASCIIPrintf(viewer,"\ndimension\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),459,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
460 | ierr = PetscViewerASCIIPrintf(viewer,"%D\n",dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),460,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
461 | ierr = PetscViewerASCIIPrintf(viewer,"\nelements\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),461,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
462 | ierr = PetscViewerASCIIPrintf(viewer,"%D\n",0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),462,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
463 | ierr = PetscViewerASCIIPrintf(viewer,"\nboundary\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),463,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
464 | ierr = PetscViewerASCIIPrintf(viewer,"%D\n",0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),464,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
465 | ierr = PetscViewerASCIIPrintf(viewer,"\nvertices\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),465,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
466 | ierr = PetscViewerASCIIPrintf(viewer,"%D\n",0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),466,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
467 | ierr = PetscViewerASCIIPrintf(viewer,"%D\n",sdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),467,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
468 | ierr = PetscBTDestroy(&pown);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),468,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
469 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
470 | } |
471 | |
472 | if (enable_mfem) { |
473 | if (periodic && !hovec) { /* we need to generate a vector of L2 coordinates, as this is how MFEM handles periodic meshes */ |
474 | PetscInt vpc = 0; |
475 | char fec[64]; |
476 | int vids[8] = {0,1,2,3,4,5,6,7}; |
477 | int hexv[8] = {0,1,3,2,4,5,7,6}, tetv[4] = {0,1,2,3}; |
478 | int quadv[8] = {0,1,3,2}, triv[3] = {0,1,2}; |
479 | int *dof = NULL((void*)0); |
480 | PetscScalar *array,*ptr; |
481 | |
482 | ierr = PetscSNPrintf(fec,sizeof(fec),"FiniteElementCollection: L2_T1_%DD_P1",dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),482,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
483 | if (cEndInterior < cEnd) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Support for hybrid meshed not currently implemented")return PetscError(((MPI_Comm)0x44000001),483,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Support for hybrid meshed not currently implemented" ); |
484 | if (cEnd-cStart) { |
485 | PetscInt fpc; |
486 | |
487 | ierr = DMPlexGetConeSize(dm,cStart,&fpc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),487,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
488 | switch(dim) { |
489 | case 1: |
490 | vpc = 2; |
491 | dof = hexv; |
492 | break; |
493 | case 2: |
494 | switch (fpc) { |
495 | case 3: |
496 | vpc = 3; |
497 | dof = triv; |
498 | break; |
499 | case 4: |
500 | vpc = 4; |
501 | dof = quadv; |
502 | break; |
503 | default: |
504 | SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unhandled case: faces per cell %D",fpc)return PetscError(((MPI_Comm)0x44000001),504,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Unhandled case: faces per cell %D",fpc ); |
505 | break; |
506 | } |
507 | break; |
508 | case 3: |
509 | switch (fpc) { |
510 | case 4: /* TODO: still need to understand L2 ordering for tets */ |
511 | vpc = 4; |
Value stored to 'vpc' is never read | |
512 | dof = tetv; |
513 | SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unhandled tethraedral case")return PetscError(((MPI_Comm)0x44000001),513,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Unhandled tethraedral case"); |
514 | break; |
515 | case 6: |
516 | if (cellvertex) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unhandled case: vertices per cell %D",fpc)return PetscError(((MPI_Comm)0x44000001),516,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Unhandled case: vertices per cell %D" ,fpc); |
517 | vpc = 8; |
518 | dof = hexv; |
519 | break; |
520 | case 8: |
521 | if (!cellvertex) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unhandled case: faces per cell %D",fpc)return PetscError(((MPI_Comm)0x44000001),521,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Unhandled case: faces per cell %D",fpc ); |
522 | vpc = 8; |
523 | dof = hexv; |
524 | break; |
525 | default: |
526 | SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unhandled case: faces per cell %D",fpc)return PetscError(((MPI_Comm)0x44000001),526,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Unhandled case: faces per cell %D",fpc ); |
527 | break; |
528 | } |
529 | break; |
530 | default: |
531 | SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Unhandled dim")return PetscError(PetscObjectComm((PetscObject)dm),531,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 56,PETSC_ERROR_INITIAL,"Unhandled dim"); |
532 | break; |
533 | } |
534 | ierr = DMPlexInvertCell(dim,vpc,vids);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),534,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
535 | } |
536 | if (!dof) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_PLIB,"Missing dofs")return PetscError(PetscObjectComm((PetscObject)dm),536,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 77,PETSC_ERROR_INITIAL,"Missing dofs"); |
537 | ierr = VecCreateSeq(PETSC_COMM_SELF((MPI_Comm)0x44000001),(cEnd-cStart-novl)*vpc*sdim,&hovec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),537,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
538 | ierr = PetscObjectCompose((PetscObject)dm,"_glvis_mesh_coords",(PetscObject)hovec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),538,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
539 | ierr = PetscObjectDereference((PetscObject)hovec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),539,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
540 | ierr = PetscObjectSetName((PetscObject)hovec,fec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),540,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
541 | ierr = VecGetArray(hovec,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),541,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
542 | ptr = array; |
543 | for (p=cStart;p<cEnd;p++) { |
544 | PetscInt csize,v,d; |
545 | PetscScalar *vals = NULL((void*)0); |
546 | |
547 | if (PetscUnlikely(pown && !PetscBTLookup(pown,p-cStart))__builtin_expect(!!(pown && !PetscBTLookup(pown,p-cStart )),0)) continue; |
548 | ierr = DMPlexVecGetClosure(dm,coordSection,coordinates,p,&csize,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),548,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
549 | if (csize != vpc*sdim && csize != vpc*sdim*2) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported closure size %D (vpc %D, sdim %D)",csize,vpc,sdim)return PetscError(((MPI_Comm)0x44000001),549,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Unsupported closure size %D (vpc %D, sdim %D)" ,csize,vpc,sdim); |
550 | for (v=0;v<vpc;v++) { |
551 | for (d=0;d<sdim;d++) { |
552 | ptr[sdim*dof[v]+d] = vals[sdim*vids[v]+d]; |
553 | } |
554 | } |
555 | ptr += vpc*sdim; |
556 | ierr = DMPlexVecRestoreClosure(dm,coordSection,coordinates,p,&csize,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),556,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
557 | } |
558 | ierr = VecRestoreArray(hovec,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),558,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
559 | } |
560 | } |
561 | /* if we have high-order coordinates in 3D, we need to specify the boundary */ |
562 | if (hovec && dim == 3) enable_boundary = PETSC_TRUE; |
563 | |
564 | /* header */ |
565 | ierr = PetscViewerASCIIPrintf(viewer,"MFEM mesh v1.1\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),565,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
566 | |
567 | /* topological dimension */ |
568 | ierr = PetscViewerASCIIPrintf(viewer,"\ndimension\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),568,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
569 | ierr = PetscViewerASCIIPrintf(viewer,"%D\n",dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),569,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
570 | |
571 | /* elements */ |
572 | minl = 1; |
573 | label = NULL((void*)0); |
574 | if (enable_emark) { |
575 | PetscInt lminl = PETSC_MAX_INT2147483647; |
576 | |
577 | ierr = DMGetLabel(dm,emark,&label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),577,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
578 | if (label) { |
579 | IS vals; |
580 | PetscInt ldef; |
581 | |
582 | ierr = DMLabelGetDefaultValue(label,&ldef);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),582,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
583 | ierr = DMLabelGetValueIS(label,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),583,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
584 | ierr = ISGetMinMax(vals,&lminl,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),584,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
585 | ierr = ISDestroy(&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),585,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
586 | lminl = PetscMin(ldef,lminl)(((ldef)<(lminl)) ? (ldef) : (lminl)); |
587 | } |
588 | ierr = MPIU_Allreduce(&lminl,&minl,1,MPIU_INT,MPI_MIN,PetscObjectComm((PetscObject)dm))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)dm), 1,588,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)dm))),0) || MPI_Allreduce((&lminl),(&minl ),(1),(((MPI_Datatype)0x4c000405)),((MPI_Op)(0x58000002)),(PetscObjectComm ((PetscObject)dm)))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),588,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
589 | if (minl == PETSC_MAX_INT2147483647) minl = 1; |
590 | } |
591 | ierr = PetscViewerASCIIPrintf(viewer,"\nelements\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),591,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
592 | ierr = PetscViewerASCIIPrintf(viewer,"%D\n",cEnd-cStart-novl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),592,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
593 | for (p=cStart;p<cEnd;p++) { |
594 | int vids[8]; |
595 | PetscInt i,nv = 0,cid = -1,mid = 1; |
596 | |
597 | if (PetscUnlikely(pown && !PetscBTLookup(pown,p-cStart))__builtin_expect(!!(pown && !PetscBTLookup(pown,p-cStart )),0)) continue; |
598 | ierr = DMPlexGetPointMFEMCellID_Internal(dm,label,minl,p,&mid,&cid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),598,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
599 | ierr = DMPlexGetPointMFEMVertexIDs_Internal(dm,p,(localized && !hovec) ? coordSection : NULL((void*)0),&nv,vids);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),599,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
600 | ierr = DMPlexInvertCell(dim,nv,vids);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),600,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
601 | if (p >= cEndInterior) { |
602 | ierr = DMPlexGlvisInvertHybrid(cid,vids);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),602,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
603 | } |
604 | ierr = PetscViewerASCIIPrintf(viewer,"%D %D",mid,cid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),604,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
605 | for (i=0;i<nv;i++) { |
606 | ierr = PetscViewerASCIIPrintf(viewer," %D",(PetscInt)vids[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),606,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
607 | } |
608 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),608,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
609 | } |
610 | |
611 | /* boundary */ |
612 | ierr = PetscViewerASCIIPrintf(viewer,"\nboundary\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),612,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
613 | if (!enable_boundary) { |
614 | ierr = PetscViewerASCIIPrintf(viewer,"%D\n",0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),614,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
615 | } else { |
616 | DMLabel perLabel; |
617 | PetscBT bfaces; |
618 | PetscInt fStart,fEnd,*fcells; |
619 | PetscInt *faces = NULL((void*)0),fpc = 0,vpf = 0, vpc = 0; |
620 | PetscInt *facesH = NULL((void*)0),fpcH = 0,vpfH = 0, vpcH = 0; |
621 | PetscInt fv1[] = {0,1}, |
622 | fv2tri[] = {0,1, |
623 | 1,2, |
624 | 2,0}, |
625 | fv2quad[] = {0,1, |
626 | 1,2, |
627 | 2,3, |
628 | 3,0}, |
629 | fv2quadH[] = {0,1, |
630 | 2,3, |
631 | 0,2, |
632 | 1,3}, |
633 | fv3tet[] = {0,1,2, |
634 | 0,3,1, |
635 | 0,2,3, |
636 | 2,1,3}, |
637 | fv3wedge[] = {0,1,2,-1, |
638 | 3,4,5,-1, |
639 | 0,1,3,4, |
640 | 1,2,4,5, |
641 | 2,0,5,3}, |
642 | fv3hex[] = {0,1,2,3, |
643 | 4,5,6,7, |
644 | 0,3,5,4, |
645 | 2,1,7,6, |
646 | 3,2,6,5, |
647 | 0,4,7,1}; |
648 | |
649 | /* determine orientation of boundary mesh */ |
650 | if (cEnd-cStart) { |
651 | if (cEndInterior < cEnd) { |
652 | ierr = DMPlexGetConeSize(dm,cEndInterior,&fpcH);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),652,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
653 | } |
654 | if (cEndInterior > cStart) { |
655 | ierr = DMPlexGetConeSize(dm,cStart,&fpc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),655,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
656 | } |
657 | switch(dim) { |
658 | case 1: |
659 | if (fpc != 2) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unhandled case faces per cell %D",fpc)return PetscError(((MPI_Comm)0x44000001),659,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Unhandled case faces per cell %D",fpc ); |
660 | faces = fv1; |
661 | vpf = 1; |
662 | vpc = 2; |
663 | break; |
664 | case 2: |
665 | switch (fpc) { |
666 | case 0: |
667 | case 3: |
668 | faces = fv2tri; |
669 | vpf = 2; |
670 | vpc = 3; |
671 | if (fpcH == 4) { |
672 | facesH = fv2quadH; |
673 | vpfH = 2; |
674 | vpcH = 4; |
675 | } else if (fpcH) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unhandled case hybrid faces per cell %D",fpcH)return PetscError(((MPI_Comm)0x44000001),675,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Unhandled case hybrid faces per cell %D" ,fpcH); |
676 | break; |
677 | case 4: |
678 | faces = fv2quad; |
679 | vpf = 2; |
680 | vpc = 4; |
681 | if (fpcH) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unhandled case hybrid faces per cell %D",fpcH)return PetscError(((MPI_Comm)0x44000001),681,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Unhandled case hybrid faces per cell %D" ,fpcH); |
682 | break; |
683 | default: |
684 | SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unhandled case: faces per cell %D",fpc)return PetscError(((MPI_Comm)0x44000001),684,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Unhandled case: faces per cell %D",fpc ); |
685 | break; |
686 | } |
687 | break; |
688 | case 3: |
689 | switch (fpc) { |
690 | case 0: |
691 | case 4: |
692 | faces = fv3tet; |
693 | vpf = 3; |
694 | vpc = 4; |
695 | if (fpcH == 5) { |
696 | facesH = fv3wedge; |
697 | vpfH = -4; |
698 | vpcH = 6; |
699 | } else if (fpcH) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unhandled case hybrid faces per cell %D",fpcH)return PetscError(((MPI_Comm)0x44000001),699,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Unhandled case hybrid faces per cell %D" ,fpcH); |
700 | break; |
701 | case 6: |
702 | faces = fv3hex; |
703 | vpf = 4; |
704 | vpc = 8; |
705 | if (fpcH) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unhandled case hybrid faces per cell %D",fpcH)return PetscError(((MPI_Comm)0x44000001),705,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Unhandled case hybrid faces per cell %D" ,fpcH); |
706 | break; |
707 | default: |
708 | SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unhandled case: faces per cell %D",fpc)return PetscError(((MPI_Comm)0x44000001),708,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Unhandled case: faces per cell %D",fpc ); |
709 | break; |
710 | } |
711 | break; |
712 | default: |
713 | SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Unhandled dim")return PetscError(PetscObjectComm((PetscObject)dm),713,__func__ ,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c", 56,PETSC_ERROR_INITIAL,"Unhandled dim"); |
714 | break; |
715 | } |
716 | } |
717 | ierr = DMPlexGetHeightStratum(dm,1,&fStart,&fEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),717,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
718 | ierr = PetscBTCreate(fEnd-fStart,&bfaces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),718,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
719 | ierr = DMPlexGetMaxSizes(dm,NULL((void*)0),&p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),719,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
720 | ierr = PetscMalloc1(p,&fcells)PetscMallocA(1,PETSC_FALSE,720,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,(size_t)(p)*sizeof(**(&fcells)),(&fcells));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),720,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
721 | ierr = DMGetLabel(dm,"glvis_periodic_cut",&perLabel);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),721,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
722 | if (!perLabel && localized) { /* this periodic cut can be moved up to DMPlex setup */ |
723 | ierr = DMCreateLabel(dm,"glvis_periodic_cut");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),723,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
724 | ierr = DMGetLabel(dm,"glvis_periodic_cut",&perLabel);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),724,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
725 | ierr = DMLabelSetDefaultValue(perLabel,1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),725,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
726 | for (p=cStart;p<cEnd;p++) { |
727 | PetscInt dof, uvpc; |
728 | |
729 | ierr = PetscSectionGetDof(coordSection,p,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),729,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
730 | if (dof) { |
731 | PetscInt v,csize,cellClosureSize,*cellClosure = NULL((void*)0),*vidxs = NULL((void*)0); |
732 | PetscScalar *vals = NULL((void*)0); |
733 | if (p < cEndInterior) uvpc = vpc; |
734 | else uvpc = vpcH; |
735 | if (dof%sdim) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_USER,"Incompatible number of cell dofs %D and space dimension %D",dof,sdim)return PetscError(((MPI_Comm)0x44000001),735,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,83,PETSC_ERROR_INITIAL,"Incompatible number of cell dofs %D and space dimension %D" ,dof,sdim); |
736 | if (dof/sdim != uvpc) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_SUP,"Incompatible number of cell dofs %D, vertices %D and space dim %D",dof/sdim,uvpc,sdim)return PetscError(((MPI_Comm)0x44000001),736,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Incompatible number of cell dofs %D, vertices %D and space dim %D" ,dof/sdim,uvpc,sdim); |
737 | ierr = DMPlexVecGetClosure(dm,coordSection,coordinates,p,&csize,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),737,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
738 | ierr = DMPlexGetTransitiveClosure(dm,p,PETSC_TRUE,&cellClosureSize,&cellClosure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),738,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
739 | for (v=0;v<cellClosureSize;v++) |
740 | if (cellClosure[2*v] >= vStart && cellClosure[2*v] < vEnd) { |
741 | vidxs = cellClosure + 2*v; |
742 | break; |
743 | } |
744 | if (!vidxs) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Missing vertices")return PetscError(((MPI_Comm)0x44000001),744,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,77,PETSC_ERROR_INITIAL,"Missing vertices"); |
745 | for (v=0;v<uvpc;v++) { |
746 | PetscInt s; |
747 | |
748 | for (s=0;s<sdim;s++) { |
749 | if (PetscAbsScalar(vals[v*sdim+s]-vals[v*sdim+s+uvpc*sdim])>PETSC_MACHINE_EPSILON2.2204460492503131e-16) { |
750 | ierr = DMLabelSetValue(perLabel,vidxs[2*v],2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),750,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
751 | } |
752 | } |
753 | } |
754 | ierr = DMPlexRestoreTransitiveClosure(dm,p,PETSC_TRUE,&cellClosureSize,&cellClosure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),754,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
755 | ierr = DMPlexVecRestoreClosure(dm,coordSection,coordinates,p,&csize,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),755,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
756 | } |
757 | } |
758 | if (dim > 1) { |
759 | PetscInt eEnd,eStart; |
760 | |
761 | ierr = DMPlexGetDepthStratum(dm,1,&eStart,&eEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),761,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
762 | for (p=eStart;p<eEnd;p++) { |
763 | const PetscInt *cone; |
764 | PetscInt coneSize,i; |
765 | PetscBool ispe = PETSC_TRUE; |
766 | |
767 | ierr = DMPlexGetCone(dm,p,&cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),767,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
768 | ierr = DMPlexGetConeSize(dm,p,&coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),768,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
769 | for (i=0;i<coneSize;i++) { |
770 | PetscInt v; |
771 | |
772 | ierr = DMLabelGetValue(perLabel,cone[i],&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),772,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
773 | ispe = (PetscBool)(ispe && (v==2)); |
774 | } |
775 | if (ispe && coneSize) { |
776 | PetscInt ch, numChildren; |
777 | const PetscInt *children; |
778 | |
779 | ierr = DMLabelSetValue(perLabel,p,2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),779,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
780 | ierr = DMPlexGetTreeChildren(dm,p,&numChildren,&children);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),780,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
781 | for (ch = 0; ch < numChildren; ch++) { |
782 | ierr = DMLabelSetValue(perLabel,children[ch],2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),782,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
783 | } |
784 | } |
785 | } |
786 | if (dim > 2) { |
787 | for (p=fStart;p<fEnd;p++) { |
788 | const PetscInt *cone; |
789 | PetscInt coneSize,i; |
790 | PetscBool ispe = PETSC_TRUE; |
791 | |
792 | ierr = DMPlexGetCone(dm,p,&cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),792,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
793 | ierr = DMPlexGetConeSize(dm,p,&coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),793,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
794 | for (i=0;i<coneSize;i++) { |
795 | PetscInt v; |
796 | |
797 | ierr = DMLabelGetValue(perLabel,cone[i],&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),797,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
798 | ispe = (PetscBool)(ispe && (v==2)); |
799 | } |
800 | if (ispe && coneSize) { |
801 | PetscInt ch, numChildren; |
802 | const PetscInt *children; |
803 | |
804 | ierr = DMLabelSetValue(perLabel,p,2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),804,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
805 | ierr = DMPlexGetTreeChildren(dm,p,&numChildren,&children);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),805,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
806 | for (ch = 0; ch < numChildren; ch++) { |
807 | ierr = DMLabelSetValue(perLabel,children[ch],2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),807,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
808 | } |
809 | } |
810 | } |
811 | } |
812 | } |
813 | } |
814 | for (p=fStart;p<fEnd;p++) { |
815 | const PetscInt *support; |
816 | PetscInt supportSize; |
817 | PetscBool isbf = PETSC_FALSE; |
818 | |
819 | ierr = DMPlexGetSupportSize(dm,p,&supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),819,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
820 | if (pown) { |
821 | PetscBool has_owned = PETSC_FALSE, has_ghost = PETSC_FALSE; |
822 | PetscInt i; |
823 | |
824 | ierr = DMPlexGetSupport(dm,p,&support);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),824,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
825 | for (i=0;i<supportSize;i++) { |
826 | if (PetscLikely(PetscBTLookup(pown,support[i]-cStart))__builtin_expect(!!(PetscBTLookup(pown,support[i]-cStart)),1)) has_owned = PETSC_TRUE; |
827 | else has_ghost = PETSC_TRUE; |
828 | } |
829 | isbf = (PetscBool)((supportSize == 1 && has_owned) || (supportSize > 1 && has_owned && has_ghost)); |
830 | } else { |
831 | isbf = (PetscBool)(supportSize == 1); |
832 | } |
833 | if (!isbf && perLabel) { |
834 | const PetscInt *cone; |
835 | PetscInt coneSize,i; |
836 | |
837 | ierr = DMPlexGetCone(dm,p,&cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),837,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
838 | ierr = DMPlexGetConeSize(dm,p,&coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),838,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
839 | isbf = PETSC_TRUE; |
840 | for (i=0;i<coneSize;i++) { |
841 | PetscInt v,d; |
842 | |
843 | ierr = DMLabelGetValue(perLabel,cone[i],&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),843,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
844 | ierr = DMLabelGetDefaultValue(perLabel,&d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),844,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
845 | isbf = (PetscBool)(isbf && v != d); |
846 | } |
847 | } |
848 | if (isbf) { |
849 | ierr = PetscBTSet(bfaces,p-fStart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),849,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
850 | } |
851 | } |
852 | /* count boundary faces */ |
853 | for (p=fStart,bf=0;p<fEnd;p++) { |
854 | if (PetscUnlikely(PetscBTLookup(bfaces,p-fStart))__builtin_expect(!!(PetscBTLookup(bfaces,p-fStart)),0)) { |
855 | const PetscInt *support; |
856 | PetscInt supportSize,c; |
857 | |
858 | ierr = DMPlexGetSupportSize(dm,p,&supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),858,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
859 | ierr = DMPlexGetSupport(dm,p,&support);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),859,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
860 | for (c=0;c<supportSize;c++) { |
861 | const PetscInt *cone; |
862 | PetscInt cell,cl,coneSize; |
863 | |
864 | cell = support[c]; |
865 | if (pown && PetscUnlikely(!PetscBTLookup(pown,cell-cStart))__builtin_expect(!!(!PetscBTLookup(pown,cell-cStart)),0)) continue; |
866 | ierr = DMPlexGetCone(dm,cell,&cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),866,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
867 | ierr = DMPlexGetConeSize(dm,cell,&coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),867,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
868 | for (cl=0;cl<coneSize;cl++) { |
869 | if (cone[cl] == p) { |
870 | bf += 1; |
871 | break; |
872 | } |
873 | } |
874 | } |
875 | } |
876 | } |
877 | minl = 1; |
878 | label = NULL((void*)0); |
879 | if (enable_bmark) { |
880 | PetscInt lminl = PETSC_MAX_INT2147483647; |
881 | |
882 | ierr = DMGetLabel(dm,bmark,&label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),882,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
883 | if (label) { |
884 | IS vals; |
885 | PetscInt ldef; |
886 | |
887 | ierr = DMLabelGetDefaultValue(label,&ldef);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),887,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
888 | ierr = DMLabelGetValueIS(label,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),888,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
889 | ierr = ISGetMinMax(vals,&lminl,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),889,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
890 | ierr = ISDestroy(&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),890,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
891 | lminl = PetscMin(ldef,lminl)(((ldef)<(lminl)) ? (ldef) : (lminl)); |
892 | } |
893 | ierr = MPIU_Allreduce(&lminl,&minl,1,MPIU_INT,MPI_MIN,PetscObjectComm((PetscObject)dm))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)dm), 1,893,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)dm))),0) || MPI_Allreduce((&lminl),(&minl ),(1),(((MPI_Datatype)0x4c000405)),((MPI_Op)(0x58000002)),(PetscObjectComm ((PetscObject)dm)))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),893,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
894 | if (minl == PETSC_MAX_INT2147483647) minl = 1; |
895 | } |
896 | ierr = PetscViewerASCIIPrintf(viewer,"%D\n",bf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),896,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
897 | for (p=fStart;p<fEnd;p++) { |
898 | if (PetscUnlikely(PetscBTLookup(bfaces,p-fStart))__builtin_expect(!!(PetscBTLookup(bfaces,p-fStart)),0)) { |
899 | const PetscInt *support; |
900 | PetscInt supportSize,c,nc = 0; |
901 | |
902 | ierr = DMPlexGetSupportSize(dm,p,&supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),902,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
903 | ierr = DMPlexGetSupport(dm,p,&support);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),903,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
904 | if (pown) { |
905 | for (c=0;c<supportSize;c++) { |
906 | if (PetscLikely(PetscBTLookup(pown,support[c]-cStart))__builtin_expect(!!(PetscBTLookup(pown,support[c]-cStart)),1)) { |
907 | fcells[nc++] = support[c]; |
908 | } |
909 | } |
910 | } else for (c=0;c<supportSize;c++) fcells[nc++] = support[c]; |
911 | for (c=0;c<nc;c++) { |
912 | const PetscInt *cone; |
913 | int vids[8]; |
914 | PetscInt i,coneSize,cell,cl,nv,cid = -1,mid = -1; |
915 | |
916 | cell = fcells[c]; |
917 | ierr = DMPlexGetCone(dm,cell,&cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),917,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
918 | ierr = DMPlexGetConeSize(dm,cell,&coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),918,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
919 | for (cl=0;cl<coneSize;cl++) |
920 | if (cone[cl] == p) |
921 | break; |
922 | if (cl == coneSize) continue; |
923 | |
924 | /* face material id and type */ |
925 | ierr = DMPlexGetPointMFEMCellID_Internal(dm,label,minl,p,&mid,&cid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),925,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
926 | ierr = PetscViewerASCIIPrintf(viewer,"%D %D",mid,cid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),926,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
927 | /* vertex ids */ |
928 | ierr = DMPlexGetPointMFEMVertexIDs_Internal(dm,cell,(localized && !hovec) ? coordSection : NULL((void*)0),&nv,vids);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),928,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
929 | if (cell >= cEndInterior) { |
930 | PetscInt nv = vpfH, inc = vpfH; |
931 | if (vpfH < 0) { /* Wedge */ |
932 | if (cl == 0 || cl == 1) nv = 3; |
933 | else nv = 4; |
934 | inc = -vpfH; |
935 | } |
936 | for (i=0;i<nv;i++) { |
937 | ierr = PetscViewerASCIIPrintf(viewer," %d",vids[facesH[cl*inc+i]]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),937,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
938 | } |
939 | } else { |
940 | for (i=0;i<vpf;i++) { |
941 | ierr = PetscViewerASCIIPrintf(viewer," %d",vids[faces[cl*vpf+i]]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),941,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
942 | } |
943 | } |
944 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),944,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
945 | bf -= 1; |
946 | } |
947 | } |
948 | } |
949 | if (bf) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Remaining boundary faces %D",bf)return PetscError(((MPI_Comm)0x44000001),949,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,77,PETSC_ERROR_INITIAL,"Remaining boundary faces %D",bf); |
950 | ierr = PetscBTDestroy(&bfaces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),950,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
951 | ierr = PetscFree(fcells)((*PetscTrFree)((void*)(fcells),951,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ) || ((fcells) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),951,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
952 | } |
953 | |
954 | /* mark owned vertices */ |
955 | vown = NULL((void*)0); |
956 | if (pown) { |
957 | ierr = PetscBTCreate(vEnd-vStart,&vown);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),957,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
958 | for (p=cStart;p<cEnd;p++) { |
959 | PetscInt i,closureSize,*closure = NULL((void*)0); |
960 | |
961 | if (PetscUnlikely(!PetscBTLookup(pown,p-cStart))__builtin_expect(!!(!PetscBTLookup(pown,p-cStart)),0)) continue; |
962 | ierr = DMPlexGetTransitiveClosure(dm,p,PETSC_TRUE,&closureSize,&closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),962,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
963 | for (i=0;i<closureSize;i++) { |
964 | const PetscInt pp = closure[2*i]; |
965 | |
966 | if (pp >= vStart && pp < vEnd) { |
967 | ierr = PetscBTSet(vown,pp-vStart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),967,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
968 | } |
969 | } |
970 | ierr = DMPlexRestoreTransitiveClosure(dm,p,PETSC_TRUE,&closureSize,&closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),970,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
971 | } |
972 | } |
973 | |
974 | /* vertex_parents (Non-conforming meshes) */ |
975 | parentSection = NULL((void*)0); |
976 | if (enable_ncmesh) { |
977 | ierr = DMPlexGetTree(dm,&parentSection,NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),977,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
978 | } |
979 | if (parentSection) { |
980 | PetscInt vp,gvp; |
981 | |
982 | for (vp=0,p=vStart;p<vEnd;p++) { |
983 | DMLabel dlabel; |
984 | PetscInt parent,depth; |
985 | |
986 | if (PetscUnlikely(vown && !PetscBTLookup(vown,p-vStart))__builtin_expect(!!(vown && !PetscBTLookup(vown,p-vStart )),0)) continue; |
987 | ierr = DMPlexGetDepthLabel(dm,&dlabel);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),987,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
988 | ierr = DMLabelGetValue(dlabel,p,&depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),988,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
989 | ierr = DMPlexGetTreeParent(dm,p,&parent,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),989,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
990 | if (parent != p) vp++; |
991 | } |
992 | ierr = MPIU_Allreduce(&vp,&gvp,1,MPIU_INT,MPI_SUM,PetscObjectComm((PetscObject)dm))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)dm), 1,992,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)dm))),0) || MPI_Allreduce((&vp),(&gvp), (1),(((MPI_Datatype)0x4c000405)),((MPI_Op)(0x58000003)),(PetscObjectComm ((PetscObject)dm)))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),992,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
993 | if (gvp) { |
994 | PetscInt maxsupp; |
995 | PetscBool *skip = NULL((void*)0); |
996 | |
997 | ierr = PetscViewerASCIIPrintf(viewer,"\nvertex_parents\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),997,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
998 | ierr = PetscViewerASCIIPrintf(viewer,"%D\n",vp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),998,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
999 | ierr = DMPlexGetMaxSizes(dm,NULL((void*)0),&maxsupp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),999,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1000 | ierr = PetscMalloc1(maxsupp,&skip)PetscMallocA(1,PETSC_FALSE,1000,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,(size_t)(maxsupp)*sizeof(**(&skip)),(&skip));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1000,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1001 | for (p=vStart;p<vEnd;p++) { |
1002 | DMLabel dlabel; |
1003 | PetscInt parent; |
1004 | |
1005 | if (PetscUnlikely(vown && !PetscBTLookup(vown,p-vStart))__builtin_expect(!!(vown && !PetscBTLookup(vown,p-vStart )),0)) continue; |
1006 | ierr = DMPlexGetDepthLabel(dm,&dlabel);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1006,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1007 | ierr = DMPlexGetTreeParent(dm,p,&parent,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1007,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1008 | if (parent != p) { |
1009 | int vids[8] = { -1, -1, -1, -1, -1, -1, -1, -1 }; /* silent overzealous clang static analyzer */ |
1010 | PetscInt i,nv,ssize,n,numChildren,depth = -1; |
1011 | const PetscInt *children; |
1012 | |
1013 | ierr = DMPlexGetConeSize(dm,parent,&ssize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1013,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1014 | switch (ssize) { |
1015 | case 2: /* edge */ |
1016 | nv = 0; |
1017 | ierr = DMPlexGetPointMFEMVertexIDs_Internal(dm,parent,localized ? coordSection : NULL((void*)0),&nv,vids);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1017,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1018 | ierr = DMPlexInvertCell(dim,nv,vids);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1018,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1019 | ierr = PetscViewerASCIIPrintf(viewer,"%D",p-vStart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1019,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1020 | for (i=0;i<nv;i++) { |
1021 | ierr = PetscViewerASCIIPrintf(viewer," %D",(PetscInt)vids[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1021,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1022 | } |
1023 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1023,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1024 | vp--; |
1025 | break; |
1026 | case 4: /* face */ |
1027 | ierr = DMPlexGetTreeChildren(dm,parent,&numChildren,&children);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1027,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1028 | for (n=0;n<numChildren;n++) { |
1029 | ierr = DMLabelGetValue(dlabel,children[n],&depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1029,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1030 | if (!depth) { |
1031 | const PetscInt *hvsupp,*hesupp,*cone; |
1032 | PetscInt hvsuppSize,hesuppSize,coneSize; |
1033 | PetscInt hv = children[n],he = -1,f; |
1034 | |
1035 | ierr = PetscArrayzero(skip,maxsupp)PetscMemzero(skip,(maxsupp)*sizeof(*(skip)));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1035,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1036 | ierr = DMPlexGetSupportSize(dm,hv,&hvsuppSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1036,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1037 | ierr = DMPlexGetSupport(dm,hv,&hvsupp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1037,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1038 | for (i=0;i<hvsuppSize;i++) { |
1039 | PetscInt ep; |
1040 | ierr = DMPlexGetTreeParent(dm,hvsupp[i],&ep,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1040,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1041 | if (ep != hvsupp[i]) { |
1042 | he = hvsupp[i]; |
1043 | } else { |
1044 | skip[i] = PETSC_TRUE; |
1045 | } |
1046 | } |
1047 | if (he == -1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_SUP,"Vertex %D support size %D: hanging edge not found",hv,hvsuppSize)return PetscError(((MPI_Comm)0x44000001),1047,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Vertex %D support size %D: hanging edge not found" ,hv,hvsuppSize); |
1048 | ierr = DMPlexGetCone(dm,he,&cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1048,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1049 | vids[0] = (int)((cone[0] == hv) ? cone[1] : cone[0]); |
1050 | ierr = DMPlexGetSupportSize(dm,he,&hesuppSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1050,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1051 | ierr = DMPlexGetSupport(dm,he,&hesupp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1051,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1052 | for (f=0;f<hesuppSize;f++) { |
1053 | PetscInt j; |
1054 | |
1055 | ierr = DMPlexGetCone(dm,hesupp[f],&cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1055,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1056 | ierr = DMPlexGetConeSize(dm,hesupp[f],&coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1056,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1057 | for (j=0;j<coneSize;j++) { |
1058 | PetscInt k; |
1059 | for (k=0;k<hvsuppSize;k++) { |
1060 | if (hvsupp[k] == cone[j]) { |
1061 | skip[k] = PETSC_TRUE; |
1062 | break; |
1063 | } |
1064 | } |
1065 | } |
1066 | } |
1067 | for (i=0;i<hvsuppSize;i++) { |
1068 | if (!skip[i]) { |
1069 | ierr = DMPlexGetCone(dm,hvsupp[i],&cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1069,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1070 | vids[1] = (int)((cone[0] == hv) ? cone[1] : cone[0]); |
1071 | } |
1072 | } |
1073 | ierr = PetscViewerASCIIPrintf(viewer,"%D",hv-vStart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1073,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1074 | for (i=0;i<2;i++) { |
1075 | ierr = PetscViewerASCIIPrintf(viewer," %D",(PetscInt)(vids[i]-vStart));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1075,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1076 | } |
1077 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1077,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1078 | vp--; |
1079 | } |
1080 | } |
1081 | break; |
1082 | default: |
1083 | SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Don't know how to deal with support size %D",ssize)return PetscError(((MPI_Comm)0x44000001),1083,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,56,PETSC_ERROR_INITIAL,"Don't know how to deal with support size %D" ,ssize); |
1084 | } |
1085 | } |
1086 | } |
1087 | ierr = PetscFree(skip)((*PetscTrFree)((void*)(skip),1087,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ) || ((skip) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1087,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1088 | } |
1089 | if (vp) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Unexpected %D hanging vertices",vp)return PetscError(((MPI_Comm)0x44000001),1089,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,77,PETSC_ERROR_INITIAL,"Unexpected %D hanging vertices",vp); |
1090 | } |
1091 | ierr = PetscBTDestroy(&pown);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1091,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1092 | ierr = PetscBTDestroy(&vown);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1092,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1093 | |
1094 | /* vertices */ |
1095 | if (hovec) { /* higher-order meshes */ |
1096 | const char *fec; |
1097 | PetscInt i,n,s; |
1098 | |
1099 | ierr = PetscViewerASCIIPrintf(viewer,"\nvertices\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1099,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1100 | ierr = PetscViewerASCIIPrintf(viewer,"%D\n",vEnd-vStart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1100,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1101 | ierr = PetscViewerASCIIPrintf(viewer,"nodes\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1101,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1102 | ierr = PetscObjectGetName((PetscObject)hovec,&fec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1102,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1103 | ierr = PetscViewerASCIIPrintf(viewer,"FiniteElementSpace\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1103,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1104 | ierr = PetscViewerASCIIPrintf(viewer,"%s\n",fec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1104,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1105 | ierr = PetscViewerASCIIPrintf(viewer,"VDim: %D\n",sdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1105,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1106 | ierr = PetscViewerASCIIPrintf(viewer,"Ordering: 1\n\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1106,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); /*Ordering::byVDIM*/ |
1107 | ierr = VecGetArrayRead(hovec,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1107,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1108 | ierr = VecGetLocalSize(hovec,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1108,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1109 | if (n%sdim) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_USER,"Size of local coordinate vector %D incompatible with space dimension %D",n,sdim)return PetscError(((MPI_Comm)0x44000001),1109,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,83,PETSC_ERROR_INITIAL,"Size of local coordinate vector %D incompatible with space dimension %D" ,n,sdim); |
1110 | for (i=0;i<n/sdim;i++) { |
1111 | for (s=0;s<sdim;s++) { |
1112 | ierr = PetscViewerASCIIPrintf(viewer,fmt,PetscRealPart(array[i*sdim+s])(array[i*sdim+s]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1112,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1113 | } |
1114 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1114,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1115 | } |
1116 | ierr = VecRestoreArrayRead(hovec,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1116,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1117 | } else { |
1118 | ierr = VecGetLocalSize(coordinates,&nvert);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1118,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1119 | ierr = PetscViewerASCIIPrintf(viewer,"\nvertices\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1119,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1120 | ierr = PetscViewerASCIIPrintf(viewer,"%D\n",nvert/sdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1120,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1121 | ierr = PetscViewerASCIIPrintf(viewer,"%D\n",sdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1121,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1122 | ierr = VecGetArrayRead(coordinates,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1122,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1123 | for (p=0;p<nvert/sdim;p++) { |
1124 | PetscInt s; |
1125 | for (s=0;s<sdim;s++) { |
1126 | PetscReal v = PetscRealPart(array[p*sdim+s])(array[p*sdim+s]); |
1127 | |
1128 | ierr = PetscViewerASCIIPrintf(viewer,fmt,PetscIsInfOrNanReal(v) ? 0.0 : v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1128,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1129 | } |
1130 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1130,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1131 | } |
1132 | ierr = VecRestoreArrayRead(coordinates,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1132,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1133 | } |
1134 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1135 | } |
1136 | |
1137 | PetscErrorCode DMPlexView_GLVis(DM dm, PetscViewer viewer) |
1138 | { |
1139 | PetscErrorCode ierr; |
1140 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ; petscstack->line[petscstack->currentsize] = 1140; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1141 | ierr = DMView_GLVis(dm,viewer,DMPlexView_GLVis_ASCII);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1141,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/plex/plexglvis.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1142 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1143 | } |