Fix regression tests (#979)

Initialize `P_max_elmts` if not set by user.
This commit is contained in:
Victor A. P. Magri 2023-10-04 10:16:20 -04:00 committed by GitHub
parent 8b7e65a231
commit dcd6468ae4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,7 +61,7 @@ hypre_MGRSetup( void *mgr_vdata,
HYPRE_Int *num_relax_sweeps = (mgr_data -> num_relax_sweeps);
HYPRE_Int num_interp_sweeps = (mgr_data -> num_interp_sweeps);
HYPRE_Int num_restrict_sweeps = (mgr_data -> num_interp_sweeps);
HYPRE_Int *max_elmts = (mgr_data -> P_max_elmts);
HYPRE_Int *P_max_elmts = (mgr_data -> P_max_elmts);
HYPRE_Real max_row_sum = (mgr_data -> max_row_sum);
HYPRE_Real strong_threshold = (mgr_data -> strong_threshold);
HYPRE_Real trunc_factor = (mgr_data -> trunc_factor);
@ -639,6 +639,10 @@ hypre_MGRSetup( void *mgr_vdata,
{
l1_norms = hypre_CTAlloc(hypre_Vector*, max_num_coarse_levels, HYPRE_MEMORY_HOST);
}
if (P_max_elmts == NULL)
{
P_max_elmts = hypre_CTAlloc(HYPRE_Int, max_num_coarse_levels, HYPRE_MEMORY_HOST);
}
/* Set default for Frelax_method if not set already -- Supports deprecated function */
/*
@ -791,14 +795,15 @@ hypre_MGRSetup( void *mgr_vdata,
}
/* set pointers to mgr data */
(mgr_data -> A_array) = A_array;
(mgr_data -> B_array) = B_array;
(mgr_data -> P_array) = P_array;
(mgr_data -> RT_array) = RT_array;
(mgr_data -> A_array) = A_array;
(mgr_data -> B_array) = B_array;
(mgr_data -> P_array) = P_array;
(mgr_data -> RT_array) = RT_array;
(mgr_data -> CF_marker_array) = CF_marker_array;
(mgr_data -> l1_norms) = l1_norms;
(mgr_data -> l1_norms) = l1_norms;
(mgr_data -> P_max_elmts) = P_max_elmts;
#if defined(HYPRE_USING_GPU)
(mgr_data -> P_FF_array) = P_FF_array;
(mgr_data -> P_FF_array) = P_FF_array;
#endif
/* Set up solution and rhs arrays */
@ -1165,7 +1170,7 @@ hypre_MGRSetup( void *mgr_vdata,
}
hypre_MGRBuildInterp(A_array[lev], A_FF, A_FC, CF_marker, Wp,
coarse_pnts_global, 1, dof_func_buff_data,
debug_flag, trunc_factor, max_elmts[lev],
debug_flag, trunc_factor, P_max_elmts[lev],
block_jacobi_bsize, &P, interp_type[lev],
num_interp_sweeps);
}
@ -1173,7 +1178,7 @@ hypre_MGRSetup( void *mgr_vdata,
{
hypre_MGRBuildInterp(A_array[lev], A_FF, A_FC, CF_marker, S,
coarse_pnts_global, 1, dof_func_buff_data,
debug_flag, trunc_factor, max_elmts[lev],
debug_flag, trunc_factor, P_max_elmts[lev],
block_jacobi_bsize, &P, interp_type[lev],
num_interp_sweeps);
}
@ -1338,9 +1343,10 @@ hypre_MGRSetup( void *mgr_vdata,
// if (restrict_type[lev] > 0)
{
hypre_MGRBuildRestrict(A_array[lev], A_FF, A_FC, CF_marker, coarse_pnts_global, 1,
dof_func_buff_data, debug_flag, trunc_factor, max_elmts[lev],
strong_threshold, max_row_sum, block_num_f_points, &RT,
restrict_type[lev], num_restrict_sweeps);
dof_func_buff_data, debug_flag, trunc_factor,
P_max_elmts[lev], strong_threshold, max_row_sum,
block_num_f_points, &RT, restrict_type[lev],
num_restrict_sweeps);
RT_array[lev] = RT;
}
@ -1378,7 +1384,7 @@ hypre_MGRSetup( void *mgr_vdata,
block_num_f_points,
set_c_points_method,
mgr_coarse_grid_method[lev],
max_elmts[lev], CF_marker, &RAP_ptr);
P_max_elmts[lev], CF_marker, &RAP_ptr);
}
if (interp_type[lev] == 12)
@ -1411,7 +1417,7 @@ hypre_MGRSetup( void *mgr_vdata,
}
hypre_MGRBuildRestrict(A_array[lev], A_FF, A_FC, CF_marker,
coarse_pnts_global, 1, dof_func_buff_data,
debug_flag, trunc_factor, max_elmts[lev],
debug_flag, trunc_factor, P_max_elmts[lev],
strong_threshold, max_row_sum,
block_jacobi_bsize, &RT, restrict_type[lev],
num_restrict_sweeps);