Lines Matching refs:ierr
26 subroutine FormFunction(snes, x, f, dummy, ierr) argument
29 PetscErrorCode ierr
40 PetscCall(VecGetArrayRead(x, lx_v, ierr))
41 PetscCall(VecGetArray(f, lf_v, ierr))
50 PetscCall(VecRestoreArrayRead(x, lx_v, ierr))
51 PetscCall(VecRestoreArray(f, lf_v, ierr))
68 subroutine FormJacobian(snes, X, jac, B, dummy, ierr) argument
74 PetscErrorCode ierr
85 PetscCall(VecGetArrayRead(x, lx_v, ierr))
99 PetscCall(MatSetValues(B, i2, idx, i2, idx, A, INSERT_VALUES, ierr))
103 PetscCall(VecRestoreArrayRead(x, lx_v, ierr))
107 PetscCall(MatAssemblyBegin(B, MAT_FINAL_ASSEMBLY, ierr))
108 PetscCall(MatAssemblyEnd(B, MAT_FINAL_ASSEMBLY, ierr))
110 PetscCall(MatAssemblyBegin(jac, MAT_FINAL_ASSEMBLY, ierr))
111 PetscCall(MatAssemblyEnd(jac, MAT_FINAL_ASSEMBLY, ierr))
116 subroutine MyLineSearch(linesearch, lctx, ierr) argument
123 PetscErrorCode ierr
128 PetscCall(SNESLineSearchGetSNES(linesearch, snes, ierr))
129 PetscCall(SNESLineSearchGetVecs(linesearch, x, f, y, w, g, ierr))
130 PetscCall(VecNorm(y, NORM_2, ynorm, ierr))
131 PetscCall(VecAXPY(x, mone, y, ierr))
132 PetscCall(SNESComputeFunction(snes, x, f, ierr))
133 PetscCall(VecNorm(f, NORM_2, gnorm, ierr))
134 PetscCall(VecNorm(x, NORM_2, xnorm, ierr))
135 PetscCall(VecNorm(y, NORM_2, ynorm, ierr))
136 PetscCall(SNESLineSearchSetNorms(linesearch, xnorm, gnorm, ynorm, ierr))
164 PetscErrorCode ierr
182 PetscCallA(PetscInitialize(ierr))
183 PetscCallA(PetscLogNestedBegin(ierr))
185 PetscCallA(PetscLogSetThreshold(threshold, oldthreshold, ierr))
186 PetscCallMPIA(MPI_Comm_size(PETSC_COMM_WORLD, size, ierr))
187 PetscCallMPIA(MPI_Comm_rank(PETSC_COMM_WORLD, rank, ierr))
196 PetscCallA(SNESCreate(PETSC_COMM_WORLD, snes, ierr))
198 …nceHistory(snes, PETSC_NULL_REAL_ARRAY, PETSC_NULL_INTEGER_ARRAY, PETSC_DECIDE, PETSC_FALSE, ierr))
206 PetscCallA(VecCreateSeq(PETSC_COMM_SELF, i2, x, ierr))
207 PetscCallA(VecDuplicate(x, r, ierr))
211 PetscCallA(MatCreate(PETSC_COMM_SELF, J, ierr))
212 PetscCallA(MatSetSizes(J, PETSC_DECIDE, PETSC_DECIDE, i2, i2, ierr))
213 PetscCallA(MatSetFromOptions(J, ierr))
214 PetscCallA(MatSetUp(J, ierr))
218 PetscCallA(SNESSetFunction(snes, r, FormFunction, 0, ierr))
222 PetscCallA(SNESSetJacobian(snes, J, J, FormJacobian, 0, ierr))
232 PetscCallA(SNESGetKSP(snes, ksp, ierr))
233 PetscCallA(KSPGetPC(ksp, pc, ierr))
234 PetscCallA(PCSetType(pc, PCNONE, ierr))
236 PetscCallA(KSPSetTolerances(ksp, tol, PETSC_CURRENT_REAL, PETSC_CURRENT_REAL, i20, ierr))
244 PetscCallA(SNESSetFromOptions(snes, ierr))
246 PetscCallA(PetscOptionsHasName(PETSC_NULL_OPTIONS, PETSC_NULL_CHARACTER, '-setls', setls, ierr))
249 PetscCallA(SNESGetLineSearch(snes, linesearch, ierr))
250 PetscCallA(SNESLineSearchSetType(linesearch, 'shell', ierr))
251 PetscCallA(SNESLineSearchShellSetApply(linesearch, MyLineSearch, 0, ierr))
264 PetscCallA(VecSet(x, pfive, ierr))
265 PetscCallA(SNESSolve(snes, PETSC_NULL_VEC, x, ierr))
267 PetscCallA(SNESGetConvergenceHistory(snes, rhistory, itshistory, nhistory, ierr))
268 PetscCallA(SNESRestoreConvergenceHistory(snes, rhistory, itshistory, nhistory, ierr))
271 PetscCallA(SNESConvergedReasonView(snes, PETSC_VIEWER_STDOUT_WORLD, ierr))
273 PetscCallA(SNESGetIterationNumber(snes, its, ierr))
284 PetscCallA(VecDestroy(x, ierr))
285 PetscCallA(VecDestroy(r, ierr))
286 PetscCallA(MatDestroy(J, ierr))
287 PetscCallA(SNESDestroy(snes, ierr))
289 PetscCallA(PetscViewerASCIIOpen(PETSC_COMM_WORLD, 'filename.xml', viewer, ierr))
290 PetscCallA(PetscViewerPushFormat(viewer, PETSC_VIEWER_ASCII_XML, ierr))
291 PetscCallA(PetscLogView(viewer, ierr))
292 PetscCallA(PetscViewerDestroy(viewer, ierr))
294 PetscCallA(PetscFinalize(ierr))