| /petsc/src/binding/petsc4py/demo/legacy/perftest/ |
| H A D | App.f90 | 5 integer(kind=C_INT), intent(in) :: nx, ny, nz local 7 real(kind=C_DOUBLE), intent(in) :: x(nx,ny,nz), xdot(nx,ny,nz) 8 real(kind=C_DOUBLE), intent(inout) :: f(nx,ny,nz) 9 call formfunction_f(nx, ny, nz, h, t, x, xdot, f) 16 integer(kind=C_INT), intent(in) :: nx, ny, nz local 18 real(kind=C_DOUBLE), intent(inout) :: x(nx,ny,nz) 19 call forminitial_f(nx, ny, nz, h, t, x) 45 integer, intent(in) :: nx, ny, nz local 47 real(kind=8), intent(inout) :: x(nx,ny,nz) 54 integer, intent(in) :: nx, ny, nz local [all …]
|
| H A D | App.pyf | 6 subroutine formFunction(nx, ny, nz, h, t, x, xdot, f) 8 integer, intent(in), intent(hide) :: nx = shape(x,0) 12 real(kind=8), intent(in) :: x(nx,ny,nz), xdot(nx,ny,nz) 13 real(kind=8), intent(inout) :: f(nx,ny,nz) 16 subroutine formInitial(nx, ny, nz, h, t, x) 18 integer, intent(in), intent(hide) :: nx = shape(x,0) 22 real(kind=8), intent(inout) :: x(nx,ny,nz)
|
| H A D | driver.py | 19 def __init__(self, nx, ny, nz): argument 20 self.n = np.array([nx, ny, nz], dtype='i') 40 nx, ny, nz = self.n 43 U = x.getArray(readonly=1).reshape(nx,ny,nz, order='f') 45 X, Y = mgrid[0:1:1j*nx,0:1:1j*ny] 56 X, Y = mgrid[0:1:1j*nx,0:1:1j*nz] 68 Z = U[nx//2,:,:] 79 def run_test(nx,ny,nz,samples,plot=False): argument 90 x = PETSc.Vec().createSeq(nx*ny*nz) 92 app = AppCtx(nx, ny, nz) [all …]
|
| H A D | driver.c | 11 PetscInt nx,ny,nz; member 23 formInitial(&app->nx,&app->ny,&app->nz,app->h,&t,x); in FormInitial() 41 formFunction(&app->nx,&app->ny,&app->nz,app->h,&t,x,xdot,f); in FormFunction() 49 PetscErrorCode RunTest(int nx, int ny, int nz, int loops, double *wt) in RunTest() argument 57 app->nx = nx; app->h[0] = 1./(nx-1); in RunTest() 62 PetscCall(VecSetSizes(x,nx*ny*nz,nx*ny*nz)); in RunTest() 125 int nx=n+1, ny=n+1, nz=n+1; in main() local 126 PetscCall(RunTest(nx,ny,nz,samples,&wt)); in main() 127 …PetscCall(PetscPrintf(PETSC_COMM_SELF,"Grid %3d x %3d x %3d -> %f seconds (%2d samples)\n",nx,ny,… in main()
|
| /petsc/src/binding/petsc4py/demo/legacy/bratu2d/ |
| H A D | bratu2d.py | 12 def __init__(self, nx, ny, alpha, impl='python'): argument 13 self.nx = nx # x grid size 28 nx, ny = self.nx, self.ny 31 x = X.getArray(readonly=1).reshape(nx, ny, order=order) 32 f = F.getArray(readonly=0).reshape(nx, ny, order=order) 39 nx = OptDB.getInt('nx', 32) variable 40 ny = OptDB.getInt('ny', nx) 46 appc = Bratu2D(nx, ny, alpha, impl) 51 f = PETSc.Vec().createSeq(nx*ny) 66 da = PETSc.DMDA().create([nx,ny]) [all …]
|
| H A D | bratu2dnpy.py | 13 nx, ny = x.shape 14 hx = 1.0/(nx-1) # x grid spacing
|
| /petsc/src/tao/unconstrained/tutorials/ |
| H A D | eptorsion3.c | 207 PetscInt i, j, k, nx = user->mx, ny = user->my; in FormInitialGuess() local 213 for (i = 0; i < nx; i++) { in FormInitialGuess() 214 k = nx * j + i; in FormInitialGuess() 215 val = PetscMin((PetscMin(i + 1, nx - i)) * hx, temp); in FormInitialGuess() 264 PetscInt nx = user->mx, ny = user->my, i, j, k; in FormFunction() local 272 for (i = -1; i < nx; i++) { in FormFunction() 273 k = nx * j + i; in FormFunction() 278 if (i < nx - 1 && j > -1) vr = x[k + 1]; in FormFunction() 279 if (i > -1 && j < ny - 1) vt = x[k + nx]; in FormFunction() 289 for (i = 0; i <= nx; i++) { in FormFunction() [all …]
|
| H A D | eptorsion1.c | 191 PetscInt i, j, k, nx = user->mx, ny = user->my; in FormInitialGuess() local 197 for (i = 0; i < nx; i++) { in FormInitialGuess() 198 k = nx * j + i; in FormInitialGuess() 199 val = PetscMin((PetscMin(i + 1, nx - i)) * hx, temp); in FormInitialGuess() 248 PetscInt nx = user->mx, ny = user->my, i, j, k; in FormFunction() local 256 for (i = -1; i < nx; i++) { in FormFunction() 257 k = nx * j + i; in FormFunction() 262 if (i < nx - 1 && j > -1) vr = x[k + 1]; in FormFunction() 263 if (i > -1 && j < ny - 1) vt = x[k + nx]; in FormFunction() 273 for (i = 0; i <= nx; i++) { in FormFunction() [all …]
|
| /petsc/src/dm/impls/stag/tests/ |
| H A D | ex19.c | 32 PetscInt i, j, startx, starty, nx, ny, extrax, extray; in main() local 35 …PetscCall(DMStagGetCorners(dmCoarse, &startx, &starty, NULL, &nx, &ny, NULL, &extrax, &extray, NUL… in main() 41 for (i = startx; i < startx + nx + extrax; ++i) { in main() 42 arr[j][i][vy] = (i < startx + nx) ? 10.0 : -1; in main() 44 arr[j][i][p] = (i < startx + nx) && (j < starty + ny) ? 30.0 : -1; in main() 53 PetscInt i, j, startx, starty, nx, ny, extrax, extray; in main() local 56 … PetscCall(DMStagGetCorners(dm, &startx, &starty, NULL, &nx, &ny, NULL, &extrax, &extray, NULL)); in main() 62 for (i = startx; i < startx + nx + extrax; ++i) { in main() 63 const PetscScalar expected_vy = (i < startx + nx) ? 10.0 : -1; in main() 65 const PetscScalar expected_p = (i < startx + nx) && (j < starty + ny) ? 30.0 : -1; in main()
|
| H A D | ex8.c | 20 PetscInt startx, starty, startz, nx, ny, nz, ex, ey, ez, nExtrax, nExtray, nExtraz; in main() local 44 …PetscCall(DMStagGetCorners(dmSol, &startx, &starty, &startz, &nx, &ny, &nz, &nExtrax, &nExtray, &n… in main() 54 for (ex = startx; ex < startx + nx + nExtrax; ++ex) { in main() 61 if (ex < startx + nx && ey < starty + ny && ez < startz + nz) { in main() 125 …PetscInt startx, starty, startz, nx, ny, nz, nExtrax, nExtray, nExtraz, ex, ey, ez, idxP, i… in ApplyOperator() local 134 …PetscCall(DMStagGetCorners(dm, &startx, &starty, &startz, &nx, &ny, &nz, &nExtrax, &nExtray, &nExt… in ApplyOperator() 153 … ey < starty + ny + nExtray; ++ey) arrIn[ez][ey][startx + nx][idxP] = arrIn[ez][ey][startx + nx - … in ApplyOperator() 158 …for (ex = startx; ex < startx + nx + nExtrax; ++ex) arrIn[ez][-1][ex][idxP] = arrIn[ez][0][ex][idx… in ApplyOperator() 163 …for (ex = startx; ex < startx + nx + nExtrax; ++ex) arrIn[ez][starty + ny][ex][idxP] = arrIn[ez][s… in ApplyOperator() 169 …for (ex = startx; ex < startx + nx + nExtrax; ++ex) arrIn[-1][ey][ex][idxP] = arrIn[0][ey][ex][idx… in ApplyOperator() [all …]
|
| H A D | ex11.c | 20 PetscInt startx, starty, nx, ny, ex, ey, nExtrax, nExtray; in main() local 44 …PetscCall(DMStagGetCorners(dmSol, &startx, &starty, NULL, &nx, &ny, NULL, &nExtrax, &nExtray, NULL… in main() 52 for (ex = startx; ex < startx + nx + nExtrax; ++ex) { in main() 57 if (ex < startx + nx && ey < starty + ny) { in main() 120 …PetscInt startx, starty, nx, ny, nExtrax, nExtray, ex, ey, idxP, idxUx, idxUy, startGhostx, … in ApplyOperator() local 129 PetscCall(DMStagGetCorners(dm, &startx, &starty, NULL, &nx, &ny, NULL, &nExtrax, &nExtray, NULL)); in ApplyOperator() 144 …tarty; ey < starty + ny + nExtray; ++ey) arrIn[ey][startx + nx][idxP] = arrIn[ey][startx + nx - 1]… in ApplyOperator() 147 for (ex = startx; ex < startx + nx + nExtrax; ++ex) arrIn[-1][ex][idxP] = arrIn[0][ex][idxP]; in ApplyOperator() 150 …for (ex = startx; ex < startx + nx + nExtrax; ++ex) arrIn[starty + ny][ex][idxP] = arrIn[starty + … in ApplyOperator() 155 for (ex = startx; ex < startx + nx + nExtrax; ++ex) { in ApplyOperator() [all …]
|
| H A D | ex13.c | 138 PetscInt i, startx, nx, nExtrax, dof0, dof1, c, idxLeft, idxElement; in Test2_1d() local 145 PetscCall(DMStagGetCorners(dm, &startx, NULL, NULL, &nx, NULL, NULL, &nExtrax, NULL, NULL)); in Test2_1d() 150 for (i = startx; i < startx + nx + nExtrax; ++i) { in Test2_1d() 155 if (i < startx + nx) { in Test2_1d() 169 for (i = startx; i < startx + nx + nExtrax; ++i) { in Test2_1d() 175 if (i < startx + nx) { in Test2_1d() 199 …PetscInt i, j, startx, starty, nx, ny, nExtrax, nExtray, dof0, dof1, dof2, c, idxLeft, idxDo… in Test2_2d() local 206 PetscCall(DMStagGetCorners(dm, &startx, &starty, NULL, &nx, &ny, NULL, &nExtrax, &nExtray, NULL)); in Test2_2d() 216 for (i = startx; i < startx + nx + nExtrax; ++i) { in Test2_2d() 227 if (i < startx + nx) { in Test2_2d() [all …]
|
| H A D | ex9.c | 10 …PetscInt startx, starty, startz, nx, ny, nz, i, j, k, d, is, js, ks, dof0, dof1, dof2, dof3,… in main() local 38 PetscCall(DMStagGetCorners(dm, &startx, &starty, &startz, &nx, &ny, &nz, NULL, NULL, NULL)); in main() 43 for (i = startx; i < startx + nx; ++i) { in main() 65 …ilWidth * stencilWidth * stencilWidth - 4 * stencilWidth * stencilWidth * (nx + ny + nz)) * dofTot… in main() 71 for (i = 0; i < nz * ny * nx * dofTotal; ++i) { in main()
|
| H A D | ex12.c | 10 …PetscInt startx, starty, nx, ny, i, j, d, is, js, dof0, dof1, dof2, dofTotal, stencilWidth, … in main() local 37 PetscCall(DMStagGetCorners(dm, &startx, &starty, NULL, &nx, &ny, NULL, NULL, NULL, NULL)); in main() 41 for (i = startx; i < startx + nx; ++i) { in main() 67 for (i = 0; i < ny * nx * dofTotal; ++i) { in main()
|
| /petsc/src/snes/tutorials/ |
| H A D | ex70.c | 55 PetscInt nx, ny; /* nb of cells in x- and y-direction */ member 132 for (i = 0; i < s->nx; i++) { in StokesWriteSolution() 133 n = j * s->nx + i; in StokesWriteSolution() 134 …rt(array[n]), (double)PetscRealPart(array[n + s->nx * s->ny]), (double)PetscRealPart(array[n + 2 *… in StokesWriteSolution() 156 PetscCall(VecSetSizes(s->x, PETSC_DECIDE, 3 * s->nx * s->ny)); in StokesSetupVectors() 175 n = row % (s->nx * s->ny); in StokesGetPosition() 176 *i = n % s->nx; in StokesGetPosition() 177 *j = (n - (*i)) / s->nx; in StokesGetPosition() 193 if (row < s->nx * s->ny) { in StokesExactSolution() 230 if (row < s->nx * s->ny) { in StokesRhs() [all …]
|
| /petsc/src/vec/vec/tutorials/ |
| H A D | ex44.c | 10 PetscInt i, j, nx, shift, x_size, y_size, *idx; in main() local 16 PetscCall(PetscOptionsGetInt(NULL, NULL, "-nx", &nx, &flg)); in main() 17 if (!flg) nx = 3; in main() 21 PetscCall(PetscMalloc1(nx, &x)); in main() 22 for (i = 0; i < nx; i++) { in main() 60 PetscCall(VecConcatenate(nx, (const Vec *)x, &y_test, &x_is)); in main() 74 PetscCall(VecConcatenate(nx, (const Vec *)x, &y_test, NULL)); in main() 87 for (i = 0; i < nx; i++) { in main() 103 for (i = 0; i < nx; i++) { in main() 125 for (i = 0; i < nx; i++) { in main() [all …]
|
| /petsc/src/dm/tutorials/ |
| H A D | ex20.c | 92 PetscInt cells_per_dim[2], nx[2]; in pic_insert_DMPLEX_with_cell_list() local 102 nx[0] = cells_per_dim[0] + 1; in pic_insert_DMPLEX_with_cell_list() 103 nx[1] = cells_per_dim[1] + 1; in pic_insert_DMPLEX_with_cell_list() 104 n_trivert = nx[0] * nx[1]; in pic_insert_DMPLEX_with_cell_list() 107 PetscCall(PetscMalloc1(nx[0] * nx[1] * 2, &trivert)); in pic_insert_DMPLEX_with_cell_list() 113 for (jj = 0; jj < nx[1]; jj++) { in pic_insert_DMPLEX_with_cell_list() 114 for (ii = 0; ii < nx[0]; ii++) { in pic_insert_DMPLEX_with_cell_list() 127 idx = (ii) + (jj)*nx[0]; in pic_insert_DMPLEX_with_cell_list() 130 idx2 = idx1 + nx[0]; in pic_insert_DMPLEX_with_cell_list() 131 idx3 = idx0 + nx[0]; in pic_insert_DMPLEX_with_cell_list()
|
| /petsc/src/dm/impls/da/ |
| H A D | fdda.c | 261 PetscInt xs, ys, nx, ny, i, j, ii, gxs, gys, gnx, gny, m, n, M, N, dim, s, k, nc, col; in DMCreateColoring_DA_2d_MPIAIJ() local 277 PetscCall(DMDAGetCorners(da, &xs, &ys, NULL, &nx, &ny, NULL)); in DMCreateColoring_DA_2d_MPIAIJ() 287 PetscCall(PetscMalloc1(nc * nx * ny, &colors)); in DMCreateColoring_DA_2d_MPIAIJ() 290 for (i = xs; i < xs + nx; i++) { in DMCreateColoring_DA_2d_MPIAIJ() 295 …PetscCall(ISColoringCreate(comm, ncolors, nc * nx * ny, colors, PETSC_OWN_POINTER, &dd->localcolor… in DMCreateColoring_DA_2d_MPIAIJ() 325 …PetscInt xs, ys, nx, ny, i, j, gxs, gys, gnx, gny, m, n, p, dim, s, k, nc, col, zs, gzs, i… in DMCreateColoring_DA_3d_MPIAIJ() local 344 PetscCall(DMDAGetCorners(da, &xs, &ys, &zs, &nx, &ny, &nz)); in DMCreateColoring_DA_3d_MPIAIJ() 351 PetscCall(PetscMalloc1(nc * nx * ny * nz, &colors)); in DMCreateColoring_DA_3d_MPIAIJ() 355 for (i = xs; i < xs + nx; i++) { in DMCreateColoring_DA_3d_MPIAIJ() 361 …PetscCall(ISColoringCreate(comm, ncolors, nc * nx * ny * nz, colors, PETSC_OWN_POINTER, &dd->local… in DMCreateColoring_DA_3d_MPIAIJ() [all …]
|
| /petsc/src/dm/tests/ |
| H A D | ex5.c | 9 PetscInt nx = 6, ny = 6, nz = 6, dim = 1, dof = 2; in main() local 20 PetscCall(DMDACreate1d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE, nx, dof, 1, NULL, &da)); in main() 23 …d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_STAR, nx, ny, PETSC_DECIDE, P… in main() 26 …D, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_BOX, nx, ny, nz, PETSC_DECID… in main()
|
| H A D | ex45.c | 17 PetscInt nx = 2; in main() local 25 …ARY_PERIODIC, DM_BOUNDARY_PERIODIC, DM_BOUNDARY_GHOSTED, DMDA_STENCIL_BOX, nx, ny, nz, PETSC_DECID… in main()
|
| /petsc/src/ts/tutorials/ |
| H A D | ex10.c | 146 static void RDDiffusionCoefficient(RD rd, PetscBool limit, RDNode *n, RDNode *nx, PetscScalar *D_R,… in RDDiffusionCoefficient() argument 152 denom = 3. * rd->rho * sigma_R + (int)limit * PetscAbsScalar(nx->E) / n->E; in RDDiffusionCoefficient() 153 ddenom.E = -(int)limit * PetscAbsScalar(nx->E) / PetscSqr(n->E); in RDDiffusionCoefficient() 155 dxdenom.E = (int)limit * (PetscRealPart(nx->E) < 0 ? -1. : 1.) / n->E; in RDDiffusionCoefficient() 349 RDNode n, nx; in RDIFunction_FD() local 353 nx.E = ((1. - bcTheta) * (x0[1].E - x0[0].E) + bcTheta * (x[1].E - x[0].E)) / hx; in RDIFunction_FD() 354 nx.T = ((1. - bcTheta) * (x0[1].T - x0[0].T) + bcTheta * (x[1].T - x[0].T)) / hx; in RDIFunction_FD() 357 RDDiffusionCoefficient(rd, rd->bclimit, &n, &nx, &D_R, 0, 0); in RDIFunction_FD() 358 f[0].E = hx * (n.E - 2. * D_R * nx.E - rd->Eapplied); in RDIFunction_FD() 433 RDNode n, nx; in RDIJacobian_FD() local [all …]
|
| /petsc/src/tao/bound/tutorials/ |
| H A D | jbearing2.c | 32 PetscInt nx, ny; /* discretization in x, y directions */ member 66 user.nx = 50; in main() 73 PetscCall(PetscOptionsGetInt(NULL, NULL, "-mx", &user.nx, &flg)); in main() 80 …ORLD, "mx: %" PetscInt_FMT ", my: %" PetscInt_FMT ", ecc: %g \n\n", user.nx, user.ny, (double)us… in main() 91 …SC_COMM_WORLD, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_STAR, user.nx, user.ny, Nx, Ny, 1,… in main() 175 PetscInt nx, ny, xs, xm, gxs, gxm, ys, ym, gys, gym; in ComputeB() local 182 nx = user->nx; in ComputeB() 184 hx = two * pi / (nx + 1.0); in ComputeB() 212 PetscInt col[5], row, nx, ny, xs, xm, gxs, gxm, ys, ym, gys, gym; in FormFunctionGradient() local 223 nx = user->nx; in FormFunctionGradient() [all …]
|
| /petsc/src/dm/impls/da/hypre/ |
| H A D | mhyp.c | 54 index[0] = (HYPRE_Int)(ex->xs + (row % ex->nx)); in MatSetValuesLocal_HYPREStruct_3d() 55 index[1] = (HYPRE_Int)(ex->ys + ((row / ex->nx) % ex->ny)); in MatSetValuesLocal_HYPREStruct_3d() 77 index[0] = (HYPRE_Int)(ex->xs + (row % ex->nx)); in MatZeroRowsLocal_HYPREStruct_3d() 78 index[1] = (HYPRE_Int)(ex->ys + ((row / ex->nx) % ex->ny)); in MatZeroRowsLocal_HYPREStruct_3d() 103 PetscInt dim, dof, psw, Nx, Ny, Nz, nx, ny, nz, ilower[3], iupper[3], ssize, i; in MatSetUp_HYPREStruct() local 203 PetscCall(DMDAGetCorners(da, 0, 0, 0, &nx, &ny, &nz)); in MatSetUp_HYPREStruct() 204 PetscCall(MatSetSizes(mat, dof * nx * ny * nz, dof * nx * ny * nz, PETSC_DECIDE, PETSC_DECIDE)); in MatSetUp_HYPREStruct() 224 PetscCall(DMDAGetCorners(ex->da, &ex->xs, &ex->ys, &ex->zs, &ex->nx, &ex->ny, 0)); in MatSetUp_HYPREStruct() 225 ex->nxny = ex->nx * ex->ny; in MatSetUp_HYPREStruct() 390 index[0] = (HYPRE_Int)(ex->xs + (row % ex->nx)); in MatSetValuesLocal_HYPRESStruct_3d() [all …]
|
| H A D | mhyp.h | 24 PetscInt rstart, gnx, gnxgny, xs, ys, zs, nx, ny, nxny; member 45 PetscInt rstart, gnx, gnxgny, gnxgnygnz, xs, ys, zs, nx, ny, nz, nxny, nxnynz; member
|
| /petsc/src/binding/petsc4py/demo/legacy/bratu3d/ |
| H A D | makefile | 17 ${MPIEXEC} ${PYTHON} bratu3d.py -fd -nx 7 -ny 8 -nz 9 21 ${MPIEXEC} ${PYTHON} bratu3d.py -mf -nx 9 -ny 8 -nz 7
|