* A function object that users should supply and that is intended to
* compute the residual `dst = F(src)`.
*
- * This function should return an int for either failure or success.
+ * @note This variable represents a
+ * @ref GlossUserProvidedCallBack "user provided callback".
+ * See there for a description of how to deal with errors and other
+ * requirements and conventions. Some of the underlying packages
+ * used by this class can deal with recoverable exceptions, whereas
+ * others cannot. As a consequence, if a callback
+ * throws an exception of type RecoverableUserCallbackError, then this
+ * exception may or may not be treated like any other exception.
*/
- std::function<int(const VectorType &src, VectorType &dst)> residual;
+ std::function<void(const VectorType &src, VectorType &dst)> residual;
/**
* A function object that users may supply and that is intended to
* approximate Jacobian matrix $L$.
*
* @param current_u Current value of $u$
+ *
+ * @note This variable represents a
+ * @ref GlossUserProvidedCallBack "user provided callback".
+ * See there for a description of how to deal with errors and other
+ * requirements and conventions. Some of the underlying packages
+ * used by this class can deal with recoverable exceptions, whereas
+ * others cannot. As a consequence, if a callback
+ * throws an exception of type RecoverableUserCallbackError, then this
+ * exception may or may not be treated like any other exception.
*/
- std::function<int(const VectorType ¤t_u)> setup_jacobian;
+ std::function<void(const VectorType ¤t_u)> setup_jacobian;
/**
* A function object that users may supply and that is intended to solve
* @param[out] dst The solution of $J^{-1} * \texttt{src}$.
* @param[in] tolerance The tolerance with which to solve the linear system
* of equations.
+ *
+ * @note This variable represents a
+ * @ref GlossUserProvidedCallBack "user provided callback".
+ * See there for a description of how to deal with errors and other
+ * requirements and conventions. Some of the underlying packages
+ * used by this class can deal with recoverable exceptions, whereas
+ * others cannot. As a consequence, if a callback
+ * throws an exception of type RecoverableUserCallbackError, then this
+ * exception may or may not be treated like any other exception.
*/
std::function<
- int(const VectorType &rhs, VectorType &dst, const double tolerance)>
+ void(const VectorType &rhs, VectorType &dst, const double tolerance)>
solve_with_jacobian;
private:
nonlinear_solver.solve_with_jacobian =
[&](const PETScWrappers::MPI::Vector &src,
- PETScWrappers::MPI::Vector & dst) -> int {
- // PETSc does not gives a tolerance, so we have to choose something
- // reasonable to provide to the user:
- const double tolerance = 1e-6;
- return solve_with_jacobian(src, dst, tolerance);
- };
+ PETScWrappers::MPI::Vector & dst) {
+ // PETSc does not gives a tolerance, so we have to choose something
+ // reasonable to provide to the user:
+ const double tolerance = 1e-6;
+ solve_with_jacobian(src, dst, tolerance);
+ };
nonlinear_solver.solve(initial_guess_and_solution);
}
nonlinear_solver.residual = [&](const Vector<double> &evaluation_point,
Vector<double> & residual) {
compute_residual(evaluation_point, residual);
-
- return 0;
};
nonlinear_solver.setup_jacobian = [&](const Vector<double> ¤t_u) {
compute_and_factorize_jacobian(current_u);
-
- return 0;
};
nonlinear_solver.solve_with_jacobian = [&](const Vector<double> &rhs,
Vector<double> & dst,
const double tolerance) {
this->solve(rhs, dst, tolerance);
-
- return 0;
};
nonlinear_solver.solve(current_solution);
MinimalSurfaceProblem<2> laplace_problem_2d;
laplace_problem_2d.run();
-
- return 0;
}
nonlinear_solver.residual = [&](const LA::MPI::Vector &evaluation_point,
LA::MPI::Vector & residual) {
compute_residual(evaluation_point, residual);
-
- return 0;
};
nonlinear_solver.setup_jacobian = [&](const LA::MPI::Vector ¤t_u) {
compute_and_factorize_jacobian(current_u);
-
- return 0;
};
nonlinear_solver.solve_with_jacobian = [&](const LA::MPI::Vector &rhs,
LA::MPI::Vector & dst,
const double tolerance) {
this->solve(rhs, dst, tolerance);
-
- return 0;
};
nonlinear_solver.solve(current_solution);
MinimalSurfaceProblem<2> laplace_problem_2d;
laplace_problem_2d.run();
-
- return 0;
}