int hypre_BoomerAMGIndepSetInit( hypre_ParCSRMatrix *S, double *measure_array , int seq_rand) { hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag(S); MPI_Comm comm = hypre_ParCSRMatrixComm(S); int S_num_nodes = hypre_CSRMatrixNumRows(S_diag); HYPRE_BigInt i; int j, my_id; int ierr = 0; MPI_Comm_rank(comm,&my_id); j = 2747+my_id; if (seq_rand) j = 2747; hypre_SeedRand(j); if (seq_rand) { for (i = 0; i < hypre_ParCSRMatrixFirstRowIndex(S); i++) hypre_Rand(); } for (j = 0; j < S_num_nodes; j++) { measure_array[j] += hypre_Rand(); } return (ierr); }
HYPRE_Int hypre_InitAMGIndepSet( hypre_CSRMatrix *S, HYPRE_Real *measure_array, HYPRE_Real cconst) { HYPRE_Int S_num_nodes = hypre_CSRMatrixNumRows(S); HYPRE_Int i; HYPRE_Int ierr = 0; hypre_SeedRand(2747); for (i = 0; i < S_num_nodes; i++) { measure_array[i] += hypre_Rand()*cconst; } return (ierr); }
/* Mass coefficient beta = sigma */ double beta(double x, double y, double z) { switch (optionBeta) { case 0: /* uniform coefficient */ return 1.0; case 1: /* smooth coefficient */ return x*x+exp(y)+sin(z); case 2:/* small outside of interior cube */ if ((fabs(x-0.5) < 0.25) && (fabs(y-0.5) < 0.25) && (fabs(z-0.5) < 0.25)) return 1.0; else return 1.0e-6; case 3: /* small outside of an interior ball */ if (((x-0.5)*(x-0.5)+(y-0.5)*(y-0.5)+(z-0.5)*(z-0.5)) < 0.0625) return 1.0; else return 1.0e-6; case 4: /* random coefficient */ return hypre_Rand(); default: return 1.0; } }