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 #include "euclid_common.h"
47 
48 #ifdef __cplusplus
49 extern "C"
50 {
51 #endif
52 
53  struct _factor_dh
54  {
55  /* dimensions of local rectangular submatrix; global matrix is n*n */
56  int m, n;
57 
58  int id; /* this subdomain's id after reordering */
59  int beg_row; /* global number of 1st locally owned row */
60  int first_bdry; /* local number of first boundary row */
61  int bdry_count; /* m - first_boundary */
62 
63  /* if true, factorization was block jacobi, in which case all
64  column indices are zero-based; else, they are global.
65  */
67 
68  /* sparse row-oriented storage for locally owned submatrix */
69  int *rp;
70  int *cval;
72  int *fill;
73  int *diag;
74  int alloc; /* currently allocated length of cval, aval, and fill arrays */
75 
76  /* used for PILU solves (Apply) */
78  int num_sendLo, num_sendHi; /* used in destructor */
79  double *work_y_lo; /* recv values from lower nabors; also used as
80  work vector when solving Ly=b for y.
81  */
82  double *work_x_hi; /* recv values from higher nabors; also used as
83  work vector when solving Ux=y for x.
84  */
85  double *sendbufLo, *sendbufHi;
90 
91  MPI_Request recv_reqLo[MAX_MPI_TASKS], recv_reqHi[MAX_MPI_TASKS]; /* used for persistent comms */
92  MPI_Request send_reqLo[MAX_MPI_TASKS], send_reqHi[MAX_MPI_TASKS]; /* used for persistent comms */
93  MPI_Request requests[MAX_MPI_TASKS];
94  MPI_Status status[MAX_MPI_TASKS];
95 
96  bool debug;
97  };
98 
99  extern void Factor_dhCreate (Factor_dh * mat);
100  extern void Factor_dhDestroy (Factor_dh mat);
101 
102  extern void Factor_dhTranspose (Factor_dh matIN, Factor_dh * matOUT);
103 
104  extern void Factor_dhInit (void *A, bool fillFlag, bool avalFlag,
105  double rho, int id, int beg_rowP, Factor_dh * F);
106 
107  extern void Factor_dhReallocate (Factor_dh F, int used, int additional);
108  /* ensures fill, cval, and aval arrays can accomodate
109  at least "c" additional entrie
110  */
111 
112  /* adopted from ParaSails, by Edmond Chow */
113  extern void Factor_dhSolveSetup (Factor_dh mat, SubdomainGraph_dh sg);
114 
115 
116  extern void Factor_dhSolve (double *rhs, double *lhs, Euclid_dh ctx);
117  extern void Factor_dhSolveSeq (double *rhs, double *lhs, Euclid_dh ctx);
118 
119  /* functions for monitoring stability */
120  extern double Factor_dhCondEst (Factor_dh mat, Euclid_dh ctx);
121  extern double Factor_dhMaxValue (Factor_dh mat);
122  extern double Factor_dhMaxPivotInverse (Factor_dh mat);
123 
124  extern int Factor_dhReadNz (Factor_dh mat);
125  extern void Factor_dhPrintTriples (Factor_dh mat, char *filename);
126 
127  extern void Factor_dhPrintGraph (Factor_dh mat, char *filename);
128  /* seq only */
129 
130 
131  extern void Factor_dhPrintDiags (Factor_dh mat, FILE * fp);
132  extern void Factor_dhPrintRows (Factor_dh mat, FILE * fp);
133  /* prints local matrix to logfile, if open */
134 
135 #ifdef __cplusplus
136 }
137 #endif
138 #endif
139 
140 #if defined(Ifpack_SHOW_DEPRECATED_WARNINGS)
141 #ifdef __GNUC__
142 #warning "The Ifpack package is deprecated"
143 #endif
144 #endif
145 
void Factor_dhPrintRows(Factor_dh mat, FILE *fp)
Definition: Factor_dh.c:232
int bdry_count
Definition: Factor_dh.h:61
int first_bdry
Definition: Factor_dh.h:60
#define REAL_DH
Definition: euclid_common.h:53
int sendlenLo
Definition: Factor_dh.h:87
MPI_Request send_reqHi[MAX_MPI_TASKS]
Definition: Factor_dh.h:92
#define MAX_MPI_TASKS
Definition: euclid_config.h:47
double * work_y_lo
Definition: Factor_dh.h:79
int * sendindLo
Definition: Factor_dh.h:86
MPI_Request recv_reqHi[MAX_MPI_TASKS]
Definition: Factor_dh.h:91
int num_recvLo
Definition: Factor_dh.h:77
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:86
int * cval
Definition: Factor_dh.h:70
void Factor_dhTranspose(Factor_dh A, Factor_dh *Bout)
Definition: Factor_dh.c:1225
double * work_x_hi
Definition: Factor_dh.h:82
void Factor_dhSolve(double *rhs, double *lhs, Euclid_dh ctx)
Definition: Factor_dh.c:796
REAL_DH * aval
Definition: Factor_dh.h:71
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:89
int * fill
Definition: Factor_dh.h:72
int num_sendHi
Definition: Factor_dh.h:78
double Factor_dhMaxValue(Factor_dh mat)
Definition: Factor_dh.c:1440
MPI_Request send_reqLo[MAX_MPI_TASKS]
Definition: Factor_dh.h:92
int sendlenHi
Definition: Factor_dh.h:87
MPI_Status status[MAX_MPI_TASKS]
Definition: Factor_dh.h:94
int * rp
Definition: Factor_dh.h:69
bool solveIsSetup
Definition: Factor_dh.h:88
int num_recvHi
Definition: Factor_dh.h:77
void Factor_dhPrintTriples(Factor_dh mat, char *filename)
Definition: Factor_dh.c:367
MPI_Request recv_reqLo[MAX_MPI_TASKS]
Definition: Factor_dh.h:91
int * diag
Definition: Factor_dh.h:73
bool blockJacobi
Definition: Factor_dh.h:66
int alloc
Definition: Factor_dh.h:74
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:93
int beg_row
Definition: Factor_dh.h:59
double Factor_dhMaxPivotInverse(Factor_dh mat)
Definition: Factor_dh.c:1409
bool debug
Definition: Factor_dh.h:96
double * sendbufHi
Definition: Factor_dh.h:85
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:78
void Factor_dhDestroy(Factor_dh mat)
Definition: Factor_dh.c:116
double * sendbufLo
Definition: Factor_dh.h:85