decide_and_prepare_for_remeshing;
/**
- * Callback to interpolate vectors and perform mesh adaption.
+ * @deprecated This callback is equivalent to `transfer_solution_vectors_to_new_mesh`, but is
+ * deprecated. Use `transfer_solution_vectors_to_new_mesh` instead.
+ */
+ DEAL_II_DEPRECATED_EARLY
+ std::function<void(const std::vector<VectorType> &all_in,
+ std::vector<VectorType> &all_out)>
+ interpolate;
+
+ /**
+ * Callback to perform mesh adaptation and transfer solution vectors
+ * from the old to the new mesh.
*
* Implementation of this function is mandatory if
- * TimeStepper::decide_for_coarsening_and_refinement is used.
+ * TimeStepper::decide_and_prepare_for_remeshing 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.
+ * functions that are stored in @p all_in onto the refined and/or coarsened grid.
+ * The output vectors must be sized correctly within this callback.
*
* @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.
*/
- std::function<void(const std::vector<VectorType> &all_in,
+ std::function<void(const real_type t,
+ const std::vector<VectorType> &all_in,
std::vector<VectorType> &all_out)>
- interpolate;
+ transfer_solution_vectors_to_new_mesh;
private:
/**
const int lineno = __LINE__;
const int err = call_and_possibly_capture_ts_exception(
- user->interpolate, user->pending_exception, {}, all_in, all_out);
+ (user->transfer_solution_vectors_to_new_mesh ?
+ // If we can, call the new callback
+ user->transfer_solution_vectors_to_new_mesh :
+ // otherwise, use the old one where we just ignore the time:
+ [user](const real_type /*t*/,
+ const std::vector<VectorType> &all_in,
+ std::vector<VectorType> &all_out) {
+ user->interpolate(all_in, all_out);
+ }),
+ user->pending_exception,
+ {},
+ user->get_time(),
+ all_in,
+ all_out);
if (err)
return PetscError(
PetscObjectComm((PetscObject)ts),
"the equivalent 'decide_and_prepare_for_remeshing' callback, you "
"cannot also set the 'decide_for_coarsening_and_refinement' "
"callback."));
- AssertThrow(interpolate,
- StandardExceptions::ExcFunctionNotProvided("interpolate"));
+
+ // If we have the decide_and_prepare_for_remeshing callback
+ // set, then we also need to have the callback for actually
+ // transfering the solution:
+ AssertThrow(interpolate || transfer_solution_vectors_to_new_mesh,
+ StandardExceptions::ExcFunctionNotProvided(
+ "transfer_solution_vectors_to_new_mesh"));
+
+ if (transfer_solution_vectors_to_new_mesh)
+ Assert(
+ !interpolate,
+ ExcMessage(
+ "The 'interpolate' callback name "
+ "of the TimeStepper class is deprecated. If you are setting "
+ "the equivalent 'transfer_solution_vectors_to_new_mesh' callback, you "
+ "cannot also set the 'interpolate' "
+ "callback."));
+
# if DEAL_II_PETSC_VERSION_GTE(3, 21, 0)
(void)ts_poststep_amr;
AssertPETSc(TSSetResize(ts,