/*BHEADER********************************************************************** * Copyright (c) 2008, Lawrence Livermore National Security, LLC. * Produced at the Lawrence Livermore National Laboratory. * This file is part of HYPRE. See file COPYRIGHT for details. * * HYPRE is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License (as published by the Free * Software Foundation) version 2.1 dated February 1999. * * $Revision: 2.4 $ ***********************************************************************EHEADER*/ /****************************************************************************** * * Functions for scanning and printing "box-dimensioned" data. * *****************************************************************************/ #ifdef HYPRE_USE_PTHREADS #undef HYPRE_USE_PTHREADS #endif #include "headers.h" /*-------------------------------------------------------------------------- * hypre_PrintBoxArrayData *--------------------------------------------------------------------------*/ int hypre_PrintBoxArrayData( FILE *file, hypre_BoxArray *box_array, hypre_BoxArray *data_space, int num_values, double *data ) { int ierr = 0; hypre_Box *box; hypre_Box *data_box; int data_box_volume; int datai; hypre_Index loop_size; hypre_IndexRef start; hypre_Index stride; int i, j; int loopi, loopj, loopk; /*---------------------------------------- * Print data *----------------------------------------*/ hypre_SetIndex(stride, 1, 1, 1); hypre_ForBoxI(i, box_array) { box = hypre_BoxArrayBox(box_array, i); data_box = hypre_BoxArrayBox(data_space, i); start = hypre_BoxIMin(box); data_box_volume = hypre_BoxVolume(data_box); hypre_BoxGetSize(box, loop_size); hypre_BoxLoop1Begin(loop_size, data_box, start, stride, datai); hypre_BoxLoop1For(loopi, loopj, loopk, datai) { for (j = 0; j < num_values; j++) { fprintf(file, "%d: (%d, %d, %d; %d) %.14e\n", i, hypre_IndexX(start) + loopi, hypre_IndexY(start) + loopj, hypre_IndexZ(start) + loopk, j, data[datai + j*data_box_volume]); } } hypre_BoxLoop1End(datai); data += num_values*data_box_volume; } return ierr; } /*-------------------------------------------------------------------------- * hypre_PrintCCVDBoxArrayData * Note that the the stencil loop (j) is _outside_ the space index loop (datai), * unlie hypre_PrintBoxArrayData (there is no j loop in hypre_PrintCCBoxArrayData) *--------------------------------------------------------------------------*/ int hypre_PrintCCVDBoxArrayData( FILE *file, hypre_BoxArray *box_array, hypre_BoxArray *data_space, int num_values, int center_rank, int stencil_size, int *symm_elements, double *data ) { int ierr = 0; hypre_Box *box; hypre_Box *data_box; int data_box_volume, datai; hypre_Index loop_size; hypre_IndexRef start; hypre_Index stride; int i, j; int loopi, loopj, loopk; /*---------------------------------------- * Print data *----------------------------------------*/ hypre_SetIndex(stride, 1, 1, 1); /* First is the constant, off-diagonal, part of the matrix: */ for ( j=0; j