Ifpack Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Factor_dh.h
Go to the documentation of this file.
1 /*@HEADER
2 // ***********************************************************************
3 //
4 // Ifpack: Object-Oriented Algebraic Preconditioner Package
5 // Copyright (2002) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ***********************************************************************
40 //@HEADER
41 */
42 
43 #ifndef FACTOR_DH
44 #define FACTOR_DH
45 
46 #if defined(Ifpack_SHOW_DEPRECATED_WARNINGS)
47 #ifdef __GNUC__
48 #warning "The Ifpack package is deprecated"
49 #endif
50 #endif
51 
52 #include "euclid_common.h"
53 
54 #ifdef __cplusplus
55 extern "C"
56 {
57 #endif
58 
59  struct _factor_dh
60  {
61  /* dimensions of local rectangular submatrix; global matrix is n*n */
62  int m, n;
63 
64  int id; /* this subdomain's id after reordering */
65  int beg_row; /* global number of 1st locally owned row */
66  int first_bdry; /* local number of first boundary row */
67  int bdry_count; /* m - first_boundary */
68 
69  /* if true, factorization was block jacobi, in which case all
70  column indices are zero-based; else, they are global.
71  */
73 
74  /* sparse row-oriented storage for locally owned submatrix */
75  int *rp;
76  int *cval;
78  int *fill;
79  int *diag;
80  int alloc; /* currently allocated length of cval, aval, and fill arrays */
81 
82  /* used for PILU solves (Apply) */
84  int num_sendLo, num_sendHi; /* used in destructor */
85  double *work_y_lo; /* recv values from lower nabors; also used as
86  work vector when solving Ly=b for y.
87  */
88  double *work_x_hi; /* recv values from higher nabors; also used as
89  work vector when solving Ux=y for x.
90  */
91  double *sendbufLo, *sendbufHi;
96 
97  MPI_Request recv_reqLo[MAX_MPI_TASKS], recv_reqHi[MAX_MPI_TASKS]; /* used for persistent comms */
98  MPI_Request send_reqLo[MAX_MPI_TASKS], send_reqHi[MAX_MPI_TASKS]; /* used for persistent comms */
99  MPI_Request requests[MAX_MPI_TASKS];
100  MPI_Status status[MAX_MPI_TASKS];
101 
102  bool debug;
103  };
104 
105  extern void Factor_dhCreate (Factor_dh * mat);
106  extern void Factor_dhDestroy (Factor_dh mat);
107 
108  extern void Factor_dhTranspose (Factor_dh matIN, Factor_dh * matOUT);
109 
110  extern void Factor_dhInit (void *A, bool fillFlag, bool avalFlag,
111  double rho, int id, int beg_rowP, Factor_dh * F);
112 
113  extern void Factor_dhReallocate (Factor_dh F, int used, int additional);
114  /* ensures fill, cval, and aval arrays can accomodate
115  at least "c" additional entrie
116  */
117 
118  /* adopted from ParaSails, by Edmond Chow */
119  extern void Factor_dhSolveSetup (Factor_dh mat, SubdomainGraph_dh sg);
120 
121 
122  extern void Factor_dhSolve (double *rhs, double *lhs, Euclid_dh ctx);
123  extern void Factor_dhSolveSeq (double *rhs, double *lhs, Euclid_dh ctx);
124 
125  /* functions for monitoring stability */
126  extern double Factor_dhCondEst (Factor_dh mat, Euclid_dh ctx);
127  extern double Factor_dhMaxValue (Factor_dh mat);
128  extern double Factor_dhMaxPivotInverse (Factor_dh mat);
129 
130  extern int Factor_dhReadNz (Factor_dh mat);
131  extern void Factor_dhPrintTriples (Factor_dh mat, char *filename);
132 
133  extern void Factor_dhPrintGraph (Factor_dh mat, char *filename);
134  /* seq only */
135 
136 
137  extern void Factor_dhPrintDiags (Factor_dh mat, FILE * fp);
138  extern void Factor_dhPrintRows (Factor_dh mat, FILE * fp);
139  /* prints local matrix to logfile, if open */
140 
141 #ifdef __cplusplus
142 }
143 #endif
144 #endif
void Factor_dhPrintRows(Factor_dh mat, FILE *fp)
Definition: Factor_dh.c:232
int bdry_count
Definition: Factor_dh.h:67
int first_bdry
Definition: Factor_dh.h:66
#define REAL_DH
Definition: euclid_common.h:59
int sendlenLo
Definition: Factor_dh.h:93
MPI_Request send_reqHi[MAX_MPI_TASKS]
Definition: Factor_dh.h:98
#define MAX_MPI_TASKS
Definition: euclid_config.h:53
double * work_y_lo
Definition: Factor_dh.h:85
int * sendindLo
Definition: Factor_dh.h:92
MPI_Request recv_reqHi[MAX_MPI_TASKS]
Definition: Factor_dh.h:97
int num_recvLo
Definition: Factor_dh.h:83
void Factor_dhPrintGraph(Factor_dh mat, char *filename)
Definition: Factor_dh.c:322
double Factor_dhCondEst(Factor_dh mat, Euclid_dh ctx)
Definition: Factor_dh.c:1465
void Factor_dhCreate(Factor_dh *mat)
Definition: Factor_dh.c:70
void Factor_dhInit(void *A, bool fillFlag, bool avalFlag, double rho, int id, int beg_rowP, Factor_dh *Fout)
Definition: Factor_dh.c:1144
int * sendindHi
Definition: Factor_dh.h:92
int * cval
Definition: Factor_dh.h:76
void Factor_dhTranspose(Factor_dh A, Factor_dh *Bout)
Definition: Factor_dh.c:1225
double * work_x_hi
Definition: Factor_dh.h:88
void Factor_dhSolve(double *rhs, double *lhs, Euclid_dh ctx)
Definition: Factor_dh.c:796
REAL_DH * aval
Definition: Factor_dh.h:77
void Factor_dhPrintDiags(Factor_dh mat, FILE *fp)
Definition: Factor_dh.c:284
void Factor_dhSolveSetup(Factor_dh mat, SubdomainGraph_dh sg)
Definition: Factor_dh.c:649
Numbering_dh numbSolve
Definition: Factor_dh.h:95
int * fill
Definition: Factor_dh.h:78
int num_sendHi
Definition: Factor_dh.h:84
double Factor_dhMaxValue(Factor_dh mat)
Definition: Factor_dh.c:1440
MPI_Request send_reqLo[MAX_MPI_TASKS]
Definition: Factor_dh.h:98
int sendlenHi
Definition: Factor_dh.h:93
MPI_Status status[MAX_MPI_TASKS]
Definition: Factor_dh.h:100
int * rp
Definition: Factor_dh.h:75
bool solveIsSetup
Definition: Factor_dh.h:94
int num_recvHi
Definition: Factor_dh.h:83
void Factor_dhPrintTriples(Factor_dh mat, char *filename)
Definition: Factor_dh.c:367
MPI_Request recv_reqLo[MAX_MPI_TASKS]
Definition: Factor_dh.h:97
int * diag
Definition: Factor_dh.h:79
bool blockJacobi
Definition: Factor_dh.h:72
int alloc
Definition: Factor_dh.h:80
void Factor_dhReallocate(Factor_dh F, int used, int additional)
Definition: Factor_dh.c:1185
MPI_Request requests[MAX_MPI_TASKS]
Definition: Factor_dh.h:99
int beg_row
Definition: Factor_dh.h:65
double Factor_dhMaxPivotInverse(Factor_dh mat)
Definition: Factor_dh.c:1409
bool debug
Definition: Factor_dh.h:102
double * sendbufHi
Definition: Factor_dh.h:91
int Factor_dhReadNz(Factor_dh mat)
Definition: Factor_dh.c:219
void Factor_dhSolveSeq(double *rhs, double *lhs, Euclid_dh ctx)
Definition: Factor_dh.c:1257
int num_sendLo
Definition: Factor_dh.h:84
void Factor_dhDestroy(Factor_dh mat)
Definition: Factor_dh.c:116
double * sendbufLo
Definition: Factor_dh.h:91