# petsc

committed 7570185

Fix ex48 for complex, explicitly set the "component" field of MatStencil

(To silence warning from some compilers about not setting all the
fields, despite the standard saying this is fine and they will be set to
zero.)

Hg-commit: ae432121c9207a9726b5e95be8764a4f7f0f0973

# src/snes/examples/tutorials/ex48.c

`   PetscErrorCode ierr;`
`   Node           ***x;`
`   PetscInt       i,j,xs,ys,zs,xm,ym,zm,mx,my,mz;`
`-  PetscReal      umin = 1e100,umax=-1e100,usum=0,gusum;`
`+  PetscReal      umin = 1e100,umax=-1e100;`
`+  PetscScalar    usum=0.0,gusum;`
` `
`   PetscFunctionBegin;`
`   *min = *max = *mean = 0;`
`   ierr = PetscGlobalMin(&umin,min,((PetscObject)da)->comm);CHKERRQ(ierr);`
`   ierr = PetscGlobalMax(&umax,max,((PetscObject)da)->comm);CHKERRQ(ierr);`
`   ierr = PetscGlobalSum(&usum,&gusum,((PetscObject)da)->comm);CHKERRQ(ierr);`
`-  *mean = gusum / (mx*my);`
`+  *mean = PetscRealPart(gusum) / (mx*my);`
`   PetscFunctionReturn(0);`
` }`
` `
`         }`
`       }`
`       {`
`-        const MatStencil rc[4] = {{0,i,j},{0,i+1,j},{0,i+1,j+1},{0,i,j+1}};`
`+        const MatStencil rc[4] = {{0,i,j,0},{0,i+1,j,0},{0,i+1,j+1,0},{0,i,j+1,0}};`
`         ierr = MatSetValuesBlockedStencil(B,4,rc,4,rc,&Ke[0][0],ADD_VALUES);CHKERRQ(ierr);`
`       }`
`     }`
`           }`
`         }`
`         {`
`-          const MatStencil rc[8] = {{i,j,k},{i+1,j,k},{i+1,j+1,k},{i,j+1,k},{i,j,k+1},{i+1,j,k+1},{i+1,j+1,k+1},{i,j+1,k+1}};`
`+          const MatStencil rc[8] = {{i,j,k,0},{i+1,j,k,0},{i+1,j+1,k,0},{i,j+1,k,0},{i,j,k+1,0},{i+1,j,k+1,0},{i+1,j+1,k+1,0},{i,j+1,k+1,0}};`
`           if (amode == THIASSEMBLY_TRIDIAGONAL) {`
`             for (l=0; l<4; l++) { /* Copy out each of the blocks, discarding horizontal coupling */`
`               const PetscInt l4 = l+4;`
`-              const MatStencil rcl[2] = {{rc[l].k,rc[l].j,rc[l].i},{rc[l4].k,rc[l4].j,rc[l4].i}};`
`+              const MatStencil rcl[2] = {{rc[l].k,rc[l].j,rc[l].i,0},{rc[l4].k,rc[l4].j,rc[l4].i,0}};`
` #if defined COMPUTE_LOWER_TRIANGULAR`
`               const PetscScalar Kel[4][4] = {{Ke[2*l+0][2*l+0] ,Ke[2*l+0][2*l+1] ,Ke[2*l+0][2*l4+0] ,Ke[2*l+0][2*l4+1]},`
`                                              {Ke[2*l+1][2*l+0] ,Ke[2*l+1][2*l+1] ,Ke[2*l+1][2*l4+0] ,Ke[2*l+1][2*l4+1]},`
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.