Keep smooth_num_levels in sync with amg_data (#954)

This solves an out-of-bounds memory error during `hypre_BoomerAMGSetup` when called multiple times without a call to `hypre_BoomerAMGDestroy` interleaved. This pull request makes sure that `smooth_num_levels` is reset to `hypre_ParAMGDataSmoothNumLevels(amg_data)` before the smoothers variable is allocated.
This commit is contained in:
tisaac 2023-09-05 15:29:30 -04:00 committed by GitHub
parent 0e43aec1d4
commit cd8f9c363e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -957,6 +957,7 @@ hypre_BoomerAMGSetup( void *amg_vdata,
agg_P_max_elmts = hypre_ParAMGDataAggPMaxElmts(amg_data);
agg_P12_max_elmts = hypre_ParAMGDataAggP12MaxElmts(amg_data);
jacobi_trunc_threshold = hypre_ParAMGDataJacobiTruncThreshold(amg_data);
smooth_num_levels = hypre_ParAMGDataSmoothNumLevels(amg_data);
if (smooth_num_levels > level)
{
smoother = hypre_CTAlloc(HYPRE_Solver, smooth_num_levels, HYPRE_MEMORY_HOST);