Lines Matching refs:user
37 User user = (User)ctx; in IFunction() local
46 f[1] = c21 * (xdot[0] - x[1]) + xdot[1] - user->mu * ((1.0 - x[0] * x[0]) * x[1] - x[0]); in IFunction()
55 User user = (User)ctx; in IJacobian() local
64 J[1][0] = c21 * a + user->mu * (1.0 + 2.0 * x[0] * x[1]); in IJacobian()
65 J[1][1] = -c21 + a - user->mu * (1.0 - x[0] * x[0]); in IJacobian()
80 User user = (User)ctx; in RHSJacobianP() local
86 if (user->combined) col[0] = 2; in RHSJacobianP()
103 User user = (User)ctx; in Monitor() local
110 while (user->next_output <= t && user->next_output <= tfinal) { in Monitor()
112 PetscCall(TSInterpolate(ts, user->next_output, interpolatedX)); in Monitor()
114 …%.1f] %" PetscInt_FMT " TS %.6f (dt = %.6f) X % 12.6e % 12.6e\n", (double)user->next_output, step,… in Monitor()
117 user->next_output += 0.1; in Monitor()
128 struct _n_User user; in main() local
143 user.next_output = 0.0; in main()
144 user.mu = 1.0e6; in main()
145 user.steps = 0; in main()
146 user.ftime = 0.5; in main()
147 user.combined = PETSC_FALSE; in main()
149 PetscCall(PetscOptionsGetReal(NULL, NULL, "-mu", &user.mu, NULL)); in main()
150 PetscCall(PetscOptionsGetBool(NULL, NULL, "-combined", &user.combined, NULL)); in main()
156 cols = user.combined ? 3 : 1; in main()
157 PetscCall(MatCreate(PETSC_COMM_WORLD, &user.Jac)); in main()
158 PetscCall(MatSetSizes(user.Jac, PETSC_DECIDE, PETSC_DECIDE, 2, 2)); in main()
159 PetscCall(MatSetFromOptions(user.Jac)); in main()
160 PetscCall(MatSetUp(user.Jac)); in main()
161 PetscCall(MatCreateVecs(user.Jac, &user.x, NULL)); in main()
168 PetscCall(TSSetIFunction(ts, NULL, IFunction, &user)); in main()
169 PetscCall(TSSetIJacobian(ts, user.Jac, user.Jac, IJacobian, &user)); in main()
171 PetscCall(TSSetMaxTime(ts, user.ftime)); in main()
172 if (monitor) PetscCall(TSMonitorSet(ts, Monitor, &user, NULL)); in main()
177 PetscCall(VecGetArray(user.x, &x_ptr)); in main()
180 PetscCall(VecRestoreArray(user.x, &x_ptr)); in main()
184 PetscCall(MatCreate(PETSC_COMM_WORLD, &user.Jacp)); in main()
185 PetscCall(MatSetSizes(user.Jacp, PETSC_DECIDE, PETSC_DECIDE, rows, cols)); in main()
186 PetscCall(MatSetFromOptions(user.Jacp)); in main()
187 PetscCall(MatSetUp(user.Jacp)); in main()
188 …PetscCall(MatCreateDense(PETSC_COMM_WORLD, PETSC_DECIDE, PETSC_DECIDE, rows, cols, NULL, &user.sp)… in main()
189 if (user.combined) { in main()
190 PetscCall(MatZeroEntries(user.sp)); in main()
191 PetscCall(MatShift(user.sp, 1.0)); in main()
193 PetscCall(MatZeroEntries(user.sp)); in main()
195 PetscCall(TSForwardSetSensitivities(ts, cols, user.sp)); in main()
196 PetscCall(TSSetRHSJacobianP(ts, user.Jacp, RHSJacobianP, &user)); in main()
203 PetscCall(TSSolve(ts, user.x)); in main()
204 PetscCall(TSGetSolveTime(ts, &user.ftime)); in main()
205 PetscCall(TSGetStepNumber(ts, &user.steps)); in main()
206 …ORLD, "mu %g, steps %" PetscInt_FMT ", ftime %g\n", (double)user.mu, user.steps, (double)user.ftim… in main()
208 PetscCall(VecView(user.x, PETSC_VIEWER_STDOUT_WORLD)); in main()
210 if (user.combined) { in main()
215 PetscCall(MatView(user.sp, PETSC_VIEWER_STDOUT_WORLD)); in main()
221 PetscCall(MatDestroy(&user.Jac)); in main()
222 PetscCall(MatDestroy(&user.sp)); in main()
223 PetscCall(MatDestroy(&user.Jacp)); in main()
224 PetscCall(VecDestroy(&user.x)); in main()