| 570 | } |
| 571 | |
| 572 | PetscErrorCode |
| 573 | PETScNewtonKrylovSolver::FormFunction_SAMRAI(SNES /*snes*/, Vec x, Vec f, void* p_ctx) |
| 574 | { |
| 575 | PetscFunctionBeginUser; |
| 576 | auto newton_solver = static_cast<PETScNewtonKrylovSolver*>(p_ctx); |
| 577 | #if !defined(NDEBUG) |
| 578 | TBOX_ASSERT(newton_solver); |
| 579 | TBOX_ASSERT(newton_solver->d_F); |
| 580 | #endif |
| 581 | Pointer<SAMRAIVectorReal<NDIM, double>> samrai_x, samrai_f; |
| 582 | PETScSAMRAIVectorReal::getSAMRAIVectorRead(x, &samrai_x); |
| 583 | PETScSAMRAIVectorReal::getSAMRAIVector(f, &samrai_f); |
| 584 | newton_solver->d_F->apply(*samrai_x, *samrai_f); |
| 585 | PETScSAMRAIVectorReal::restoreSAMRAIVectorRead(x, &samrai_x); |
| 586 | PETScSAMRAIVectorReal::restoreSAMRAIVector(f, &samrai_f); |
| 587 | PetscFunctionReturn(0); |
| 588 | } |
| 589 | |
| 590 | PetscErrorCode |
| 591 | PETScNewtonKrylovSolver::FormJacobian_SAMRAI(SNES snes, Vec x, Mat A, Mat /*B*/, void* p_ctx) |