HYPRE_Int hypre_CommInfoProjectSend( hypre_CommInfo *comm_info, hypre_Index index, hypre_Index stride ) { hypre_ProjectBoxArrayArray(hypre_CommInfoSendBoxes(comm_info), index, stride); hypre_ProjectBoxArrayArray(hypre_CommInfoSendRBoxes(comm_info), index, stride); hypre_CopyIndex(stride, hypre_CommInfoSendStride(comm_info)); return hypre_error_flag; }
int hypre_ComputeInfoProjectComp( hypre_ComputeInfo *compute_info, hypre_Index index, hypre_Index stride ) { int ierr = 0; hypre_ProjectBoxArrayArray(hypre_ComputeInfoIndtBoxes(compute_info), index, stride); hypre_ProjectBoxArrayArray(hypre_ComputeInfoDeptBoxes(compute_info), index, stride); hypre_CopyIndex(stride, hypre_ComputeInfoStride(compute_info)); return ierr; }
int hypre_CommInfoProjectSend( hypre_CommInfo *comm_info, hypre_Index index, hypre_Index stride ) { int ierr = 0; hypre_ProjectBoxArrayArray(hypre_CommInfoSendBoxes(comm_info), index, stride); hypre_ProjectBoxArrayArray(hypre_CommInfoSendRBoxes(comm_info), index, stride); hypre_CopyIndex(stride, hypre_CommInfoSendStride(comm_info)); return ierr; }
int hypre_SMGResidualSetup(void *residual_vdata,hypre_StructMatrix *A,hypre_StructVector *x,hypre_StructVector *b,hypre_StructVector *r) { int ierr = 0; hypre_SMGResidualData *residual_data = residual_vdata; hypre_IndexRef base_index = (residual_data -> base_index); hypre_IndexRef base_stride = (residual_data -> base_stride); hypre_Index unit_stride; hypre_StructGrid *grid; hypre_StructStencil *stencil; hypre_BoxArrayArray *send_boxes; hypre_BoxArrayArray *recv_boxes; int **send_processes; int **recv_processes; hypre_BoxArrayArray *indt_boxes; hypre_BoxArrayArray *dept_boxes; hypre_BoxArray *base_points; hypre_ComputePkg *compute_pkg; /*---------------------------------------------------------- * Set up base points and the compute package *----------------------------------------------------------*/ grid = (A -> grid); stencil = (A -> stencil); ((((unit_stride[0] = 1) , (unit_stride[1] = 1))) , (unit_stride[2] = 1)); base_points = hypre_BoxArrayDuplicate((grid -> boxes)); hypre_ProjectBoxArray(base_points,base_index,base_stride); hypre_CreateComputeInfo(grid,stencil,&send_boxes,&recv_boxes,&send_processes,&recv_processes,&indt_boxes,&dept_boxes); hypre_ProjectBoxArrayArray(indt_boxes,base_index,base_stride); hypre_ProjectBoxArrayArray(dept_boxes,base_index,base_stride); hypre_ComputePkgCreate(send_boxes,recv_boxes,unit_stride,unit_stride,send_processes,recv_processes,indt_boxes,dept_boxes,base_stride,grid,(x -> data_space),1,&compute_pkg); /*---------------------------------------------------------- * Set up the residual data structure *----------------------------------------------------------*/ residual_data -> A = hypre_StructMatrixRef(A); residual_data -> x = hypre_StructVectorRef(x); residual_data -> b = hypre_StructVectorRef(b); residual_data -> r = hypre_StructVectorRef(r); residual_data -> base_points = base_points; residual_data -> compute_pkg = compute_pkg; /*----------------------------------------------------- * Compute flops *-----------------------------------------------------*/ residual_data -> flops = (((A -> global_size) + (x -> global_size)) / (((base_stride[0]) * (base_stride[1])) * (base_stride[2]))); return ierr; }
int hypre_SMGResidualSetup( void *residual_vdata, hypre_StructMatrix *A, hypre_StructVector *x, hypre_StructVector *b, hypre_StructVector *r ) { int ierr = 0; hypre_SMGResidualData *residual_data = residual_vdata; hypre_IndexRef base_index = (residual_data -> base_index); hypre_IndexRef base_stride = (residual_data -> base_stride); hypre_Index unit_stride; hypre_StructGrid *grid; hypre_StructStencil *stencil; hypre_BoxArrayArray *send_boxes; hypre_BoxArrayArray *recv_boxes; int **send_processes; int **recv_processes; hypre_BoxArrayArray *indt_boxes; hypre_BoxArrayArray *dept_boxes; hypre_BoxArray *base_points; hypre_ComputePkg *compute_pkg; /*---------------------------------------------------------- * Set up base points and the compute package *----------------------------------------------------------*/ grid = hypre_StructMatrixGrid(A); stencil = hypre_StructMatrixStencil(A); hypre_SetIndex(unit_stride, 1, 1, 1); base_points = hypre_BoxArrayDuplicate(hypre_StructGridBoxes(grid)); hypre_ProjectBoxArray(base_points, base_index, base_stride); hypre_CreateComputeInfo(grid, stencil, &send_boxes, &recv_boxes, &send_processes, &recv_processes, &indt_boxes, &dept_boxes); hypre_ProjectBoxArrayArray(indt_boxes, base_index, base_stride); hypre_ProjectBoxArrayArray(dept_boxes, base_index, base_stride); hypre_ComputePkgCreate(send_boxes, recv_boxes, unit_stride, unit_stride, send_processes, recv_processes, indt_boxes, dept_boxes, base_stride, grid, hypre_StructVectorDataSpace(x), 1, &compute_pkg); /*---------------------------------------------------------- * Set up the residual data structure *----------------------------------------------------------*/ (residual_data -> A) = hypre_StructMatrixRef(A); (residual_data -> x) = hypre_StructVectorRef(x); (residual_data -> b) = hypre_StructVectorRef(b); (residual_data -> r) = hypre_StructVectorRef(r); (residual_data -> base_points) = base_points; (residual_data -> compute_pkg) = compute_pkg; /*----------------------------------------------------- * Compute flops *-----------------------------------------------------*/ (residual_data -> flops) = (hypre_StructMatrixGlobalSize(A) + hypre_StructVectorGlobalSize(x)) / (hypre_IndexX(base_stride) * hypre_IndexY(base_stride) * hypre_IndexZ(base_stride) ); return ierr; }
int hypre_SemiInterpSetup( void *interp_vdata, hypre_StructMatrix *P, int P_stored_as_transpose, hypre_StructVector *xc, hypre_StructVector *e, hypre_Index cindex, hypre_Index findex, hypre_Index stride ) { hypre_SemiInterpData *interp_data = interp_vdata; hypre_StructGrid *grid; hypre_StructStencil *stencil; hypre_BoxArrayArray *send_boxes; hypre_BoxArrayArray *recv_boxes; int **send_processes; int **recv_processes; hypre_BoxArrayArray *indt_boxes; hypre_BoxArrayArray *dept_boxes; hypre_ComputePkg *compute_pkg; int ierr = 0; /*---------------------------------------------------------- * Set up the compute package *----------------------------------------------------------*/ grid = hypre_StructVectorGrid(e); stencil = hypre_StructMatrixStencil(P); hypre_CreateComputeInfo(grid, stencil, &send_boxes, &recv_boxes, &send_processes, &recv_processes, &indt_boxes, &dept_boxes); hypre_ProjectBoxArrayArray(send_boxes, cindex, stride); hypre_ProjectBoxArrayArray(recv_boxes, cindex, stride); hypre_ProjectBoxArrayArray(indt_boxes, findex, stride); hypre_ProjectBoxArrayArray(dept_boxes, findex, stride); hypre_ComputePkgCreate(send_boxes, recv_boxes, stride, stride, send_processes, recv_processes, indt_boxes, dept_boxes, stride, grid, hypre_StructVectorDataSpace(e), 1, &compute_pkg); /*---------------------------------------------------------- * Set up the interp data structure *----------------------------------------------------------*/ (interp_data -> P) = hypre_StructMatrixRef(P); (interp_data -> P_stored_as_transpose) = P_stored_as_transpose; (interp_data -> compute_pkg) = compute_pkg; hypre_CopyIndex(cindex, (interp_data -> cindex)); hypre_CopyIndex(findex, (interp_data -> findex)); hypre_CopyIndex(stride, (interp_data -> stride)); return ierr; }
int hypre_SemiRestrictSetup( void *restrict_vdata, hypre_StructMatrix *R, int R_stored_as_transpose, hypre_StructVector *r, hypre_StructVector *rc, hypre_Index cindex, hypre_Index findex, hypre_Index stride ) { hypre_SemiRestrictData *restrict_data = (hypre_SemiRestrictData *)restrict_vdata; hypre_StructGrid *grid; hypre_StructStencil *stencil; hypre_BoxArrayArray *send_boxes; hypre_BoxArrayArray *recv_boxes; int **send_processes; int **recv_processes; hypre_BoxArrayArray *indt_boxes; hypre_BoxArrayArray *dept_boxes; hypre_ComputePkg *compute_pkg; int ierr = 0; /*---------------------------------------------------------- * Set up the compute package *----------------------------------------------------------*/ grid = hypre_StructVectorGrid(r); stencil = hypre_StructMatrixStencil(R); hypre_CreateComputeInfo(grid, stencil, &send_boxes, &recv_boxes, &send_processes, &recv_processes, &indt_boxes, &dept_boxes); hypre_ProjectBoxArrayArray(send_boxes, findex, stride); hypre_ProjectBoxArrayArray(recv_boxes, findex, stride); hypre_ProjectBoxArrayArray(indt_boxes, cindex, stride); hypre_ProjectBoxArrayArray(dept_boxes, cindex, stride); hypre_ComputePkgCreate(send_boxes, recv_boxes, stride, stride, send_processes, recv_processes, indt_boxes, dept_boxes, stride, grid, hypre_StructVectorDataSpace(r), 1, &compute_pkg); /*---------------------------------------------------------- * Set up the restrict data structure *----------------------------------------------------------*/ (restrict_data -> R) = hypre_StructMatrixRef(R); (restrict_data -> R_stored_as_transpose) = R_stored_as_transpose; (restrict_data -> compute_pkg) = compute_pkg; hypre_CopyIndex(cindex ,(restrict_data -> cindex)); hypre_CopyIndex(stride ,(restrict_data -> stride)); return ierr; }