| /petsc/src/ts/tutorials/ ! |
| H A D | ex1.c | 33 PetscInt mx; /* Discretization in x-direction */ member 58 user.mx = 4; in main() 65 PetscCall(PetscOptionsGetInt(NULL, NULL, "-mx", &user.mx, NULL)); in main() 67 N = user.mx * user.my; in main() 68 dt = .5 / PetscMax(user.mx, user.my); in main() 181 PetscInt i, j, row, mx, my; in FormInitialGuess() local 187 mx = user->mx; in FormInitialGuess() 191 hx = one / (PetscReal)(mx - 1); in FormInitialGuess() 198 for (i = 0; i < mx; i++) { in FormInitialGuess() 199 row = i + j * mx; in FormInitialGuess() [all …]
|
| H A D | ex8.py | 15 mx = da.getSizes(); mx = mx[0]; hx = 1.0/mx 25 if lxe == mx: f[mx-1] = xx[mx-1-gxs]/hx; lxe-=1 30 mx = da.getSizes(); mx = mx[0]; hx = 1.0/mx 39 if lxe == mx: P.setValues([mx-1],[mx-1],1.0/hx); lxe-=1
|
| H A D | ex1f.F90 | 34 PetscInt i, j, row, mx, my 44 mx = int(user(lmx)) 48 hx = 1.0/real(mx - 1) 57 do i = 1, mx 58 row = i + (j - 1)*mx 59 if (i == 1 .or. j == 1 .or. i == mx .or. j == my) then 63 ub = xx(row - mx) 65 ut = xx(row + mx) 88 PetscInt i, j, row(1), mx, my 103 mx = int(user(lmx)) [all …]
|
| H A D | ex22f.F90 | 43 PetscInt mx 111 PetscCallA(VecGetSize(X, mx, ierr)) 113 dt = pone*max(ctx%a(1), ctx%a(2))/mx 137 subroutine GetLayout(da, mx, xs, xe, gxs, gxe, ierr) argument 142 PetscInt mx, xs, xe, gxs, gxe 145 …PetscCall(DMDAGetInfo(da, PETSC_NULL_INTEGER, mx, PETSC_NULL_INTEGER, PETSC_NULL_INTEGER, PETSC_NU… 154 subroutine FormIFunctionLocal(mx, xs, xe, gxs, gxe, x, xdot, f, a, k, s, ierr) argument 156 PetscInt mx, xs, xe, gxs, gxe 180 PetscInt mx, xs, xe, gxs, gxe 184 PetscCall(GetLayout(da, mx, xs, xe, gxs, gxe, ierr)) [all …]
|
| H A D | ex22f_mf.F90 | 44 PetscInt mx 105 PetscCallA(GetLayout(da, mx, xs, xe, gxs, gxe, ierr)) 131 PetscCallA(VecGetSize(X, mx, ierr)) 133 dt = pone*max(ctx%a(1), ctx%a(2))/mx 147 PetscCallA(GetLayout(da, mx, xs, xe, gxs, gxe, ierr)) 165 subroutine GetLayout(da, mx, xs, xe, gxs, gxe, ierr) argument 170 PetscInt mx, xs, xe, gxs, gxe 173 …PetscCall(DMDAGetInfo(da, PETSC_NULL_INTEGER, mx, PETSC_NULL_INTEGER, PETSC_NULL_INTEGER, PETSC_NU… 182 subroutine FormIFunctionLocal(mx, xs, xe, gxs, gxe, x, xdot, f, a, k, s, ierr) argument 184 PetscInt mx, xs, xe, gxs, gxe [all …]
|
| /petsc/src/tao/unconstrained/tutorials/ ! |
| H A D | minsurf1.c | 22 PetscInt mx, my; /* discretization in x, y directions */ member 53 user.mx = 4; in main() 57 PetscCall(PetscOptionsGetInt(NULL, NULL, "-mx", &user.mx, &flg)); in main() 61 …intf(PETSC_COMM_SELF, "mx: %" PetscInt_FMT " my: %" PetscInt_FMT " \n\n", user.mx, user.my)); in main() 64 N = user.mx * user.my; in main() 94 …if (ksp) PetscCall(KSPSetTolerances(ksp, PETSC_CURRENT, PETSC_CURRENT, PETSC_CURRENT, user.mx * us… in main() 128 PetscInt mx = user->mx, my = user->my; in FormFunctionGradient() local 129 PetscReal rhx = mx + 1, rhy = my + 1; in FormFunctionGradient() 130 …PetscReal hx = 1.0 / (mx + 1), hy = 1.0 / (my + 1), hydhx = hy / hx, hxdhy = hx / hy, are… in FormFunctionGradient() 145 for (i = 0; i < mx; i++) { in FormFunctionGradient() [all …]
|
| H A D | eptorsion2.c | 51 PetscInt mx, my; /* global discretization in x- and y-directions */ member 78 user.mx = 10; in main() 85 PetscCall(PetscOptionsGetInt(NULL, NULL, "-mx", &user.mx, &flg)); in main() 88 …ntf(PETSC_COMM_WORLD, "mx: %" PetscInt_FMT " my: %" PetscInt_FMT " \n\n", user.mx, user.my)); in main() 91 …SC_COMM_WORLD, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_STAR, user.mx, user.my, Nx, Ny, 1,… in main() 158 PetscInt i, j, k, mx = user->mx, my = user->my; in FormInitialGuess() local 160 PetscReal hx = 1.0 / (mx + 1), hy = 1.0 / (my + 1), temp, val; in FormInitialGuess() 174 val = PetscMin((PetscMin(i + 1, mx - i)) * hx, temp); in FormInitialGuess() 202 PetscInt mx = user->mx, my = user->my; in FormFunctionGradient() local 206 PetscReal hx = 1.0 / (user->mx + 1); in FormFunctionGradient() [all …]
|
| /petsc/src/tao/complementarity/tutorials/ ! |
| H A D | minsurf1.c | 25 PetscInt mx, my; member 54 user.mx = 4; in main() 58 PetscCall(PetscOptionsGetInt(NULL, NULL, "-mx", &user.mx, &flg)); in main() 62 N = user.mx * user.my; in main() 65 …PetscCall(PetscPrintf(PETSC_COMM_SELF, "mx:%" PetscInt_FMT ", my:%" PetscInt_FMT "\n", user.mx, us… in main() 140 PetscInt mx = user->mx, my = user->my; in FormConstraints() local 141 PetscReal hx = 1.0 / (mx + 1), hy = 1.0 / (my + 1), hydhx = hy / hx, hxdhy = hx / hy; in FormConstraints() 157 for (i = 0; i < mx; i++) { in FormConstraints() 158 row = j * mx + i; in FormConstraints() 174 xb = x[row - mx]; in FormConstraints() [all …]
|
| /petsc/src/snes/tests/ ! |
| H A D | ex1f.F90 | 122 PetscInt mx, my 124 common/params/lambda, mx, my, fd_coloring 127 PetscScalar x(mx, my) 138 hx = one/(mx - 1) 144 do i = 1, mx 145 if (i == 1 .or. j == 1 .or. i == mx .or. j == my) then 148 x(i, j) = temp1*sqrt(min(min(i - 1, mx - i)*hx, temp)) 186 PetscInt mx, my 188 common/params/lambda, mx, my, fd_coloring 211 PetscCallA(PetscLogFlops(11.0d0*mx*my, ierr)) [all …]
|
| H A D | ex1.c | 46 PetscInt mx; /* Discretization in x-direction */ member 83 user.mx = 4; in main() 86 PetscCall(PetscOptionsGetInt(NULL, NULL, "-mx", &user.mx, NULL)); in main() 91 N = user.mx * user.my; in main() 316 PetscInt i, j, row, mx, my; in FormInitialGuess() local 321 mx = user->mx; in FormInitialGuess() 325 hx = 1.0 / (PetscReal)(mx - 1); in FormInitialGuess() 339 for (i = 0; i < mx; i++) { in FormInitialGuess() 340 row = i + j * mx; in FormInitialGuess() 341 if (i == 0 || j == 0 || i == mx - 1 || j == my - 1) { in FormInitialGuess() [all …]
|
| /petsc/src/ts/tutorials/eimex/ ! |
| H A D | allen_cahn.c | 18 PetscInt mx; /* Discretization in x-direction */ member 31 PetscInt steps, mx; in main() local 43 user.mx = 400; in main() 57 PetscCall(MatSetSizes(A, PETSC_DECIDE, PETSC_DECIDE, user.mx, user.mx)); in main() 79 PetscCall(VecGetSize(x, &mx)); in main() 110 PetscInt i, mx; in RHSFunction() local 114 mx = user->mx; in RHSFunction() 116 hx = (user->xright - user->xleft) / (mx - 1); in RHSFunction() 120 for (i = 1; i < mx - 1; i++) f[i] = eps * (x[i + 1] - 2. * x[i] + x[i - 1]) / (hx * hx); in RHSFunction() 121 f[mx - 1] = 2. * eps * (x[mx - 2] - x[mx - 1]) / (hx * hx); /*boundary*/ in RHSFunction() [all …]
|
| /petsc/src/ksp/ksp/tests/ ! |
| H A D | ex29.c | 33 PetscInt mx, my; /* number grid points in x and y direction */ member 48 PetscInt mx, my; in main() local 58 fine_ctx.mx = 9; in main() 60 PetscCall(PetscOptionsGetInt(NULL, NULL, "-mx", &mx, &flg)); in main() 61 if (flg) fine_ctx.mx = mx; in main() 64 …_COMM_WORLD, "Fine grid size %" PetscInt_FMT " by %" PetscInt_FMT "\n", fine_ctx.mx, fine_ctx.my)); in main() 65 n = fine_ctx.mx * fine_ctx.my; in main() 71 …OMM_WORLD, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_STAR, fine_ctx.mx, fine_ctx.my, Nx, Ny… in main() 121 PetscInt i, j, row, mx, my, xs, ys, xm, ym, Xs, Ys, Xm, Ym, col[5]; in FormJacobian_Grid() local 127 mx = grid->mx; in FormJacobian_Grid() [all …]
|
| H A D | ex14.c | 62 PetscInt mx, my; /* discretization in x,y directions */ member 105 user.mx = 4; in main() 109 PetscCall(PetscOptionsGetInt(NULL, NULL, "-mx", &user.mx, NULL)); in main() 113 N = user.mx * user.my; in main() 134 …SC_COMM_WORLD, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_STAR, user.mx, user.my, Nx, Ny, 1,… in main() 279 PetscInt i, j, row, mx, my, xs, ys, xm, ym, gxm, gym, gxs, gys; in FormInitialGuess() local 283 mx = user->mx; in FormInitialGuess() 286 hx = one / (PetscReal)(mx - 1); in FormInitialGuess() 316 if (i == 0 || j == 0 || i == mx - 1 || j == my - 1) { in FormInitialGuess() 320 x[row] = temp1 * PetscSqrtReal(PetscMin((PetscReal)(PetscMin(i, mx - i - 1)) * hx, temp)); in FormInitialGuess() [all …]
|
| H A D | ex19.c | 29 PetscInt mx, my; /* number grid points in x and y direction */ member 64 user.coarse.mx = 5; in main() 67 PetscCall(PetscOptionsGetInt(NULL, NULL, "-Mx", &user.coarse.mx, NULL)); in main() 71 user.fine.mx = user.ratio * (user.coarse.mx - 1) + 1; in main() 74 …RLD, "Coarse grid size %" PetscInt_FMT " by %" PetscInt_FMT "\n", user.coarse.mx, user.coarse.my)); in main() 75 …OMM_WORLD, "Fine grid size %" PetscInt_FMT " by %" PetscInt_FMT "\n", user.fine.mx, user.fine.my)); in main() 77 n = user.fine.mx * user.fine.my; in main() 78 N = user.coarse.mx * user.coarse.my; in main() 85 …MM_WORLD, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_STAR, user.fine.mx, user.fine.my, Nx, N… in main() 97 …_WORLD, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_STAR, user.coarse.mx, user.coarse.my, Nx,… in main() [all …]
|
| H A D | ex26.c | 34 PetscInt mx, my; /* number grid points in x and y direction */ member 57 fine_ctx.mx = 9; in main() 59 PetscCall(PetscOptionsGetInt(NULL, NULL, "-mx", &fine_ctx.mx, NULL)); in main() 65 …_COMM_WORLD, "Fine grid size %" PetscInt_FMT " by %" PetscInt_FMT "\n", fine_ctx.mx, fine_ctx.my)); in main() 68 …OMM_WORLD, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_STAR, fine_ctx.mx, fine_ctx.my, Nx, Ny… in main() 97 …PetscCall(MatCreateDense(PETSC_COMM_WORLD, nlocal, PETSC_DECIDE, fine_ctx.mx * fine_ctx.my, nrhs, … in main() 150 PetscInt i, j, row, mx, my, xs, ys, xm, ym, Xs, Ys, Xm, Ym, col[5]; in FormJacobian_Grid() local 157 mx = grid->mx; in FormJacobian_Grid() 159 hx = one / (PetscReal)(mx - 1); in FormJacobian_Grid() 176 if (i > 0 && i < mx - 1 && j > 0 && j < my - 1) { in FormJacobian_Grid() [all …]
|
| /petsc/src/dm/impls/da/ ! |
| H A D | daview.c | 16 mxArray *mx; in DMView_DA_Matlab() local 23 mx = mxCreateStructMatrix(1, 1, 8, (const char **)fnames); in DMView_DA_Matlab() 24 …PetscCheck(mx, PETSC_COMM_SELF, PETSC_ERR_LIB, "Unable to generate MATLAB struct array to hold DMD… in DMView_DA_Matlab() 25 mxSetFieldByNumber(mx, 0, 0, mxCreateDoubleScalar((double)dim)); in DMView_DA_Matlab() 26 mxSetFieldByNumber(mx, 0, 1, mxCreateDoubleScalar((double)m)); in DMView_DA_Matlab() 27 mxSetFieldByNumber(mx, 0, 2, mxCreateDoubleScalar((double)n)); in DMView_DA_Matlab() 28 mxSetFieldByNumber(mx, 0, 3, mxCreateDoubleScalar((double)p)); in DMView_DA_Matlab() 29 mxSetFieldByNumber(mx, 0, 4, mxCreateDoubleScalar((double)dof)); in DMView_DA_Matlab() 30 mxSetFieldByNumber(mx, 0, 5, mxCreateDoubleScalar((double)swidth)); in DMView_DA_Matlab() 31 mxSetFieldByNumber(mx, 0, 6, mxCreateDoubleScalar((double)bx)); in DMView_DA_Matlab() [all …]
|
| /petsc/src/dm/tests/ ! |
| H A D | ex53.c | 18 PetscInt mx = 4, my = 4, mz = 4; /* Dimensions of parent vector */ in main() local 42 PetscCall(PetscOptionsGetInt(NULL, NULL, "-mx", &mx, NULL)); in main() 53 …, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_STAR, mx, my, mz, PETSC_DECID… in main() 57 …d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_STAR, mx, my, PETSC_DECIDE, P… in main() 76 … for (i = ixs; i < ixs + ixm; i++) vecdata3d[k][j][i] = ((i - mx / 2) * (j + mx / 2)) + k * 100; in main() 83 for (i = ixs; i < ixs + ixm; i++) vecdata2d[j][i] = ((i - mx / 2) * (j + mx / 2)); in main() 105 upper.i = mx; in main() 114 upper.i = mx; in main()
|
| /petsc/src/tao/pde_constrained/tutorials/ ! |
| H A D | elliptic.c | 8 PetscInt mx; /* grid points in each direction */ member 109 user.mx = 8; in main() 111 …PetscCall(PetscOptionsInt("-mx", "Number of grid points in each direction", "", user.mx, &user.mx,… in main() 130 user.m = user.ns * user.mx * user.mx * user.mx; /* number of constraints */ in main() 132 user.ndesign = user.mx * user.mx * user.mx; in main() 655 PetscCall(PetscMalloc1(user->mx, &x)); in EllipticInitialize() 656 PetscCall(PetscMalloc1(user->mx, &y)); in EllipticInitialize() 657 PetscCall(PetscMalloc1(user->mx, &z)); in EllipticInitialize() 662 n = user->mx * user->mx * user->mx; in EllipticInitialize() 663 m = 3 * user->mx * user->mx * (user->mx - 1); in EllipticInitialize() [all …]
|
| /petsc/src/ksp/ksp/tutorials/ ! |
| H A D | ex28.c | 47 PetscInt mx, col[2], xs, xm, i; in ComputeInitialSolution() local 51 PetscCall(DMDAGetInfo(da, 0, &mx, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); in ComputeInitialSolution() 52 Hx = 2.0 * PETSC_PI / (PetscReal)mx; in ComputeInitialSolution() 68 PetscInt mx; in ComputeRHS() local 75 PetscCall(DMDAGetInfo(da, 0, &mx, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); in ComputeRHS() 77 h = 2.0 * PETSC_PI / mx; in ComputeRHS() 85 PetscInt i, mx, xm, xs; in ComputeMatrix() local 94 PetscCall(DMDAGetInfo(da, 0, &mx, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); in ComputeMatrix() 95 Hx = 2.0 * PETSC_PI / (PetscReal)mx; in ComputeMatrix()
|
| H A D | ex25.c | 74 PetscInt mx, idx[2]; in ComputeRHS() local 80 PetscCall(DMDAGetInfo(da, 0, &mx, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); in ComputeRHS() 81 h = 1.0 / (mx - 1); in ComputeRHS() 84 idx[1] = mx - 1; in ComputeRHS() 95 PetscInt i, mx, xm, xs; in ComputeMatrix() local 102 PetscCall(DMDAGetInfo(da, 0, &mx, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); in ComputeMatrix() 104 h = 1.0 / (mx - 1); in ComputeMatrix() 108 if (i == 0 || i == mx - 1) { in ComputeMatrix()
|
| H A D | ex44f.F90 | 49 PetscInt xs, xm, i, mx 52 …PetscCall(DMDAGetInfo(da, PETSC_NULL_INTEGER, mx, PETSC_NULL_INTEGER, PETSC_NULL_INTEGER, PETSC_NU… 54 hx = 1.0_PETSC_REAL_KIND/(mx - 1) 70 PetscInt xs, xm, i, mx 74 …PetscCall(DMDAGetInfo(da, PETSC_NULL_INTEGER, mx, PETSC_NULL_INTEGER, PETSC_NULL_INTEGER, PETSC_NU… 76 hx = 1.0_PETSC_REAL_KIND/(mx - 1) 78 if ((i == 0) .or. (i == mx - 1)) then
|
| /petsc/src/mat/tests/ ! |
| H A D | ex111.c | 18 PetscInt mx, my, mz; /* number grid points in x, y and z direction */ member 57 user.coarse.mx = 4; in main() 61 PetscCall(PetscOptionsGetInt(NULL, NULL, "-Mx", &user.coarse.mx, NULL)); in main() 67 user.fine.mx = user.ratio * (user.coarse.mx - 1) + 1; in main() 73 … grids: %" PetscInt_FMT " %" PetscInt_FMT "\n", user.coarse.mx, user.coarse.my, user.fine.mx, user… in main() 75 …%" PetscInt_FMT " %" PetscInt_FMT "\n", user.coarse.mx, user.coarse.my, user.coarse.mz, user.fine.… in main() 82 …MM_WORLD, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_STAR, user.fine.mx, user.fine.my, PETSC… in main() 84 …ARY_NONE, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_STAR, user.fine.mx, user.fine.my, user.… in main() 126 …_WORLD, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_STAR, user.coarse.mx, user.coarse.my, PET… in main() 128 …Y_NONE, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_STAR, user.coarse.mx, user.coarse.my, use… in main()
|
| /petsc/src/snes/tutorials/ ! |
| H A D | ex55k.kokkos.cxx | 41 …PetscInt xs = info->xs, ys = info->ys, xm = info->xm, ym = info->ym, mx = info->mx, my = info->my; in FormFunctionLocalVec() local 50 hx = 1.0 / (PetscReal)(info->mx - 1); in FormFunctionLocalVec() 65 if (i == 0 || j == 0 || i == mx - 1 || j == my - 1) { in FormFunctionLocalVec() 83 if (i + 1 == mx - 1) { in FormFunctionLocalVec() 118 …PetscInt xs = info->xs, ys = info->ys, xm = info->xm, ym = info->ym, mx = info->mx, my = info->my; in FormObjectiveLocalVec() local 129 hx = 1.0 / (PetscReal)(mx - 1); in FormObjectiveLocalVec() 143 if (i == 0 || j == 0 || i == mx - 1 || j == my - 1) { in FormObjectiveLocalVec() 153 if (i + 1 == mx - 1) ue = 0.; in FormObjectiveLocalVec() 176 …PetscInt xs = info->xs, ys = info->ys, xm = info->xm, ym = info->ym, mx = info->mx, my = info-… in FormJacobianLocalVec() local 215 if (i == 0 || j == 0 || i == mx - 1 || j == my - 1) { in FormJacobianLocalVec() [all …]
|
| H A D | ex4.c | 115 PetscInt mx = info->mx, my = info->my; in FormObjectiveLocal() local 124 hx = 1.0 / (mx + 1); in FormObjectiveLocal() 140 if (i + 1 == mx) { /* right side */ in FormObjectiveLocal() 180 if (xs + xm == mx) { /* right side */ in FormObjectiveLocal() 182 d1 = (x[j][mx - 1] - user->right[j + 1]) / hx; in FormObjectiveLocal() 199 if (ys + ym == my && xs + xm == mx) { in FormObjectiveLocal() 213 PetscInt mx = info->mx, my = info->my; in FormFunctionLocal() local 222 hx = 1.0 / (mx + 1); in FormFunctionLocal() 242 if (i + 1 == mx) { /* right side */ in FormFunctionLocal() 253 if (j > 0 && i + 1 < mx) xrb = x[j - 1][i + 1]; /* right bottom */ in FormFunctionLocal() [all …]
|
| /petsc/src/binding/petsc4py/demo/python_types/ ! |
| H A D | mat.py | 42 mx, my = self.da.getSizes() 43 hx, hy = (1.0 / m for m in [mx, my]) 62 if i < mx - 1: 74 mx, my = self.da.getSizes() 75 hx, hy = (1.0 / m for m in [mx, my]) 88 mx, my = self.da.getSizes() 89 hx, hy = (1.0 / m for m in [mx, my])
|