IFPACK  Development
 All Classes Files Functions Variables Enumerations Friends
Factor_dh.h
00001 /*@HEADER
00002 // ***********************************************************************
00003 //
00004 //       Ifpack: Object-Oriented Algebraic Preconditioner Package
00005 //                 Copyright (2002) Sandia Corporation
00006 //
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00038 //
00039 // ***********************************************************************
00040 //@HEADER
00041 */
00042 
00043 #ifndef FACTOR_DH
00044 #define FACTOR_DH
00045 
00046 #include "euclid_common.h"
00047 
00048 #ifdef __cplusplus
00049 extern "C"
00050 {
00051 #endif
00052 
00053   struct _factor_dh
00054   {
00055     /* dimensions of local rectangular submatrix; global matrix is n*n */
00056     int m, n;
00057 
00058     int id;         /* this subdomain's id after reordering */
00059     int beg_row;        /* global number of 1st locally owned row */
00060     int first_bdry;     /* local number of first boundary row */
00061     int bdry_count;     /* m - first_boundary */
00062 
00063     /* if true, factorization was block jacobi, in which case all
00064        column indices are zero-based; else, they are global.
00065      */
00066     bool blockJacobi;
00067 
00068     /* sparse row-oriented storage for locally owned submatrix */
00069     int *rp;
00070     int *cval;
00071     REAL_DH *aval;
00072     int *fill;
00073     int *diag;
00074     int alloc;          /* currently allocated length of cval, aval, and fill arrays */
00075 
00076     /* used for PILU solves (Apply) */
00077     int num_recvLo, num_recvHi;
00078     int num_sendLo, num_sendHi; /* used in destructor */
00079     double *work_y_lo;      /* recv values from lower nabors; also used as
00080                    work vector when solving Ly=b for y.
00081                  */
00082     double *work_x_hi;      /* recv values from higher nabors; also used as
00083                    work vector when solving Ux=y for x.
00084                  */
00085     double *sendbufLo, *sendbufHi;
00086     int *sendindLo, *sendindHi;
00087     int sendlenLo, sendlenHi;
00088     bool solveIsSetup;
00089     Numbering_dh numbSolve;
00090 
00091     MPI_Request recv_reqLo[MAX_MPI_TASKS], recv_reqHi[MAX_MPI_TASKS];   /* used for persistent comms */
00092     MPI_Request send_reqLo[MAX_MPI_TASKS], send_reqHi[MAX_MPI_TASKS];   /* used for persistent comms */
00093     MPI_Request requests[MAX_MPI_TASKS];
00094     MPI_Status status[MAX_MPI_TASKS];
00095 
00096     bool debug;
00097   };
00098 
00099   extern void Factor_dhCreate (Factor_dh * mat);
00100   extern void Factor_dhDestroy (Factor_dh mat);
00101 
00102   extern void Factor_dhTranspose (Factor_dh matIN, Factor_dh * matOUT);
00103 
00104   extern void Factor_dhInit (void *A, bool fillFlag, bool avalFlag,
00105                  double rho, int id, int beg_rowP, Factor_dh * F);
00106 
00107   extern void Factor_dhReallocate (Factor_dh F, int used, int additional);
00108   /* ensures fill, cval, and aval arrays can accomodate
00109      at least "c" additional entrie
00110    */
00111 
00112   /* adopted from ParaSails, by Edmond Chow */
00113   extern void Factor_dhSolveSetup (Factor_dh mat, SubdomainGraph_dh sg);
00114 
00115 
00116   extern void Factor_dhSolve (double *rhs, double *lhs, Euclid_dh ctx);
00117   extern void Factor_dhSolveSeq (double *rhs, double *lhs, Euclid_dh ctx);
00118 
00119   /* functions for monitoring stability */
00120   extern double Factor_dhCondEst (Factor_dh mat, Euclid_dh ctx);
00121   extern double Factor_dhMaxValue (Factor_dh mat);
00122   extern double Factor_dhMaxPivotInverse (Factor_dh mat);
00123 
00124   extern int Factor_dhReadNz (Factor_dh mat);
00125   extern void Factor_dhPrintTriples (Factor_dh mat, char *filename);
00126 
00127   extern void Factor_dhPrintGraph (Factor_dh mat, char *filename);
00128   /* seq only */
00129 
00130 
00131   extern void Factor_dhPrintDiags (Factor_dh mat, FILE * fp);
00132   extern void Factor_dhPrintRows (Factor_dh mat, FILE * fp);
00133   /* prints local matrix to logfile, if open */
00134 
00135 #ifdef __cplusplus
00136 }
00137 #endif
00138 #endif
 All Classes Files Functions Variables Enumerations Friends