From: Wolfgang Bangerth Date: Mon, 1 Jul 2024 03:25:29 +0000 (-0600) Subject: Rename a callback in PETScWrappers::TimeStepper. X-Git-Tag: v9.6.0-rc1~145^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db4975c0a4e98d83ad023624acd8606cfc11e5f0;p=dealii.git Rename a callback in PETScWrappers::TimeStepper. --- diff --git a/include/deal.II/lac/petsc_ts.h b/include/deal.II/lac/petsc_ts.h index 9266342c6c..b4fa23918c 100644 --- a/include/deal.II/lac/petsc_ts.h +++ b/include/deal.II/lac/petsc_ts.h @@ -590,6 +590,13 @@ namespace PETScWrappers */ std::function algebraic_components; + /** + * This callback is equivalent to `update_constrained_components`, but is + * deprecated. Use `update_constrained_components` instead. + */ + DEAL_II_DEPRECATED_EARLY + std::function distribute; + /** * Callback to distribute solution to hanging nodes. * @@ -603,7 +610,8 @@ namespace PETScWrappers * See there for a description of how to deal with errors and other * requirements and conventions. */ - std::function distribute; + std::function + update_constrained_components; /** * Callback to set up mesh adaption. diff --git a/include/deal.II/lac/petsc_ts.templates.h b/include/deal.II/lac/petsc_ts.templates.h index aea7f2951f..bd44fda006 100644 --- a/include/deal.II/lac/petsc_ts.templates.h +++ b/include/deal.II/lac/petsc_ts.templates.h @@ -608,7 +608,11 @@ namespace PETScWrappers const int lineno = __LINE__; const int err = call_and_possibly_capture_ts_exception( - user->distribute, + // Call the user-provided callback. Use the new name if used, + // or the legacy name otherwise. + (user->update_constrained_components ? + user->update_constrained_components : + user->distribute), user->pending_exception, [user, ts]() -> void { user->error_in_function = true; @@ -623,7 +627,7 @@ namespace PETScWrappers return PetscError( PetscObjectComm((PetscObject)ts), lineno + 1, - "distribute", + "update_constrained_components", __FILE__, PETSC_ERR_LIB, PETSC_ERROR_INITIAL, @@ -1025,8 +1029,17 @@ namespace PETScWrappers AssertPETSc(KSPSetPC(ksp, solve_with_jacobian_pc.get_pc())); } - if (distribute) - AssertPETSc(TSSetPostStage(ts, ts_poststage)); + if (distribute || update_constrained_components) + { + if (update_constrained_components) + Assert(!distribute, + ExcMessage( + "The 'distribute' callback name of the TimeStepper " + "class is deprecated. If you are setting the equivalent " + "'update_constrained_components' callback, you cannot also " + "set the 'distribute' callback.")); + AssertPETSc(TSSetPostStage(ts, ts_poststage)); + } // Attach user monitoring routine. if (monitor)