* and TimeStepper::explicit_jacobian.
* - deal.II style using TimeStepper::setup_jacobian and
* TimeStepper::solve_with_jacobian.
- * The preconditioning matrix can be specified using TimeStepper::set_matrix.
- * In case both approaches are implemented, the deal.II style will be used.
+ * The preconditioning matrix can be specified using
+ * TimeStepper::set_matrix(). In case both approaches are implemented, the
+ * deal.II style will be used.
*
- * TimeStepper::set_matrices must be used in case the user wants to provide
+ * TimeStepper::set_matrices() must be used in case the user wants to provide
* the iteration matrix of the tangent system in the deal.II style approach,
* thus replacing the matrix-free linearization.
*
* The correctness of the constructed Jacobians passed using
- * TimeStepper::set_matrix can be checked using
+ * TimeStepper::set_matrix() can be checked using
* @code
* ./myApp -snes_test_jacobian
* @endcode
- * See TimeStepper::set_matrix and TimeStepper::set_matrices for
+ * See TimeStepper::set_matrix() and TimeStepper::set_matrices() for
* additional details.
*
* The deal.II style approach still allows command line customization, like
std::function<void(const real_type t, VectorType &y)> distribute;
/**
- * Callback to setup mesh adaption.
+ * Callback to set up mesh adaption.
*
* Implementation of this function is optional.
* @p resize must be set to true if mesh adaption is to be performed, false
const unsigned int step,
const VectorType & y,
bool & resize)>
- prepare_for_coarsening_and_refinement;
+ decide_for_coarsening_and_refinement;
/**
* Callback to interpolate vectors and perform mesh adaption.
*
* Implementation of this function is mandatory if
- * TimeStepper::prepare_for_coarsening_and_refinement is used.
+ * TimeStepper::decide_for_coarsening_and_refinement is used.
* This function must perform mesh adaption and interpolate the discrete
* functions that are stored in @p all_in onto the refined and/or coarsenend grid.
* Output vectors must be created inside the callback.
const int lineno = __LINE__;
const int err = call_and_possibly_capture_ts_exception(
- user->prepare_for_coarsening_and_refinement,
+ user->decide_for_coarsening_and_refinement,
user->pending_exception,
[]() -> void {},
t,
return PetscError(
PetscObjectComm((PetscObject)ts),
lineno + 1,
- "prepare_for_coarsening_and_refinement",
+ "decide_for_coarsening_and_refinement",
__FILE__,
PETSC_ERR_LIB,
PETSC_ERROR_INITIAL,
PetscCall(TSGetApplicationContext(ts, &ctx));
auto user = static_cast<TimeStepper *>(ctx);
- PetscErrorCode (
- *transfer_setup)(TS, PetscInt, PetscReal, Vec, PetscBool *, void *);
- PetscErrorCode (*transfer)(TS, PetscInt, Vec[], Vec[], void *);
+ using transfer_setup_fn =
+ PetscErrorCode (*)(TS, PetscInt, PetscReal, Vec, PetscBool *, void *);
+ using transfer_fn =
+ PetscErrorCode (*)(TS, PetscInt, Vec[], Vec[], void *);
+ transfer_setup_fn transfer_setup;
+ transfer_fn transfer;
+
AssertPETSc(PetscObjectQueryFunction((PetscObject)ts,
"__dealii_ts_resize_setup__",
&transfer_setup));
Vec x;
PetscCall(TSGetSolution(ts, &x));
PetscCall(PetscObjectReference((PetscObject)x));
- PetscCall((*transfer_setup)(
+ PetscCall(transfer_setup(
ts, user->get_step_number(), user->get_time(), x, &resize, user));
if (resize)
// Reinitialize DM. Currently it is not possible to do with public API
ts_reset_dm(ts);
- PetscCall((*transfer)(ts, 1, &x, &new_x, user));
+ PetscCall(transfer(ts, 1, &x, &new_x, user));
PetscCall(TSSetSolution(ts, new_x));
PetscCall(VecDestroy(&new_x));
}
AssertPETSc(TSMonitorSet(ts, ts_monitor, this, nullptr));
// Handle AMR.
- if (prepare_for_coarsening_and_refinement)
+ if (decide_for_coarsening_and_refinement)
{
AssertThrow(interpolate,
StandardExceptions::ExcFunctionNotProvided("interpolate"));
unsigned int TimeStepper<VectorType, PMatrixType, AMatrixType>::solve(
VectorType &y)
{
- try
- {
- setup_callbacks();
- }
- catch (...)
- {
- throw;
- }
+ // Set up PETSc data structure.
+ setup_callbacks();
// Set solution vector.
AssertPETSc(TSSetSolution(ts, y.petsc_vector()));
// Handle algebraic components. This must be done when we know the layout
// of the solution vector.
- try
- {
- setup_algebraic_constraints(y);
- }
- catch (...)
- {
- throw;
- }
+ setup_algebraic_constraints(y);
// Having set everything up, now do the actual work
// and let PETSc do the time stepping. If there is