#include <SimplePetscNonlinearSolver.hpp>
Inherits AbstractNonlinearSolver.
Public Member Functions | |
Vec | Solve (PetscErrorCode(*pComputeResidual)(SNES, Vec, Vec, void *), PetscErrorCode(*pComputeJacobian)(SNES, Vec, Mat *, Mat *, MatStructure *, void *), Vec initialGuess, void *pContext) |
Concrete Simple Nonlinear PDE system solver.
Definition at line 40 of file SimplePetscNonlinearSolver.hpp.
Vec SimplePetscNonlinearSolver::Solve | ( | PetscErrorCode(*)(SNES, Vec, Vec, void *) | pComputeResidual, | |
PetscErrorCode(*)(SNES, Vec, Mat *, Mat *, MatStructure *, void *) | pComputeJacobian, | |||
Vec | initialGuess, | |||
void * | pContext | |||
) | [virtual] |
Concrete Simple Nonlinear PDE system solver. Simple Nonlinear PDE system solver, uses the PETSc SNES Solver, which uses Newton's method.
pComputeResidual | points to the function which computes the residual, it must take arguments SNES (a PETSc nonlinear solver object), Vec (current guess - a vector of the correct size), Vec (a Vec of the correct size in which the residual is returned), void* (a pointer to anything you may need to refer to when calculating the residual) | |
pComputeJacobian | points to the function which computes the Jacobian, it must take arguments SNES (a PETSc nonlinear solver * object), Mat* (a pointer to the Jacobian matrix) ,Mat* (a pointer to a preconditioner matrix), MatStructure* (points to the PETSc matrix type e.g. AIJ), void* (a pointer to anything you may need to refer to when calculating the residual). | |
initialGuess | A PETSc Vec of the correct size, containing initial guesses for the nonlinear solver. | |
pContext | [optional] A pointer to a class that may have to be used in the ComputeResidual and ComputeJacobian functions |
To be used in the form: Vec answer=solver->Solve(&ComputeResidual, &ComputeJacobian, initialGuess, NULL);
In the same file, but outside this class the functions ComputeResidual and ComputeJacobian must sit, using the input arguments specified above.
Implements AbstractNonlinearSolver.
Definition at line 72 of file SimplePetscNonlinearSolver.cpp.
References PetscTools::SetupMat().