Ifpack Package Browser (Single Doxygen Collection)  Development
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
_subdomain_dh
Definition: SubdomainGraph_dh.h:68
_factor_dh::rp
int * rp
Definition: Factor_dh.h:69
_factor_dh::work_x_hi
double * work_x_hi
Definition: Factor_dh.h:82
_factor_dh::alloc
int alloc
Definition: Factor_dh.h:74
euclid_common.h
_factor_dh::beg_row
int beg_row
Definition: Factor_dh.h:59
_factor_dh::num_recvLo
int num_recvLo
Definition: Factor_dh.h:77
Factor_dhSolve
void Factor_dhSolve(double *rhs, double *lhs, Euclid_dh ctx)
Definition: Factor_dh.c:796
_factor_dh::status
MPI_Status status[MAX_MPI_TASKS]
Definition: Factor_dh.h:94
Factor_dhMaxValue
double Factor_dhMaxValue(Factor_dh mat)
Definition: Factor_dh.c:1440
_factor_dh::solveIsSetup
bool solveIsSetup
Definition: Factor_dh.h:88
_factor_dh::send_reqLo
MPI_Request send_reqLo[MAX_MPI_TASKS]
Definition: Factor_dh.h:92
_factor_dh::num_recvHi
int num_recvHi
Definition: Factor_dh.h:77
_factor_dh::bdry_count
int bdry_count
Definition: Factor_dh.h:61
_factor_dh::first_bdry
int first_bdry
Definition: Factor_dh.h:60
MAX_MPI_TASKS
#define MAX_MPI_TASKS
Definition: euclid_config.h:47
Factor_dhPrintGraph
void Factor_dhPrintGraph(Factor_dh mat, char *filename)
Definition: Factor_dh.c:322
_factor_dh::work_y_lo
double * work_y_lo
Definition: Factor_dh.h:79
Factor_dhPrintTriples
void Factor_dhPrintTriples(Factor_dh mat, char *filename)
Definition: Factor_dh.c:367
Factor_dhReallocate
void Factor_dhReallocate(Factor_dh F, int used, int additional)
Definition: Factor_dh.c:1185
_factor_dh
Definition: Factor_dh.h:53
_factor_dh::num_sendHi
int num_sendHi
Definition: Factor_dh.h:78
Factor_dhDestroy
void Factor_dhDestroy(Factor_dh mat)
Definition: Factor_dh.c:116
Factor_dhCondEst
double Factor_dhCondEst(Factor_dh mat, Euclid_dh ctx)
Definition: Factor_dh.c:1465
Factor_dhTranspose
void Factor_dhTranspose(Factor_dh matIN, Factor_dh *matOUT)
Definition: Factor_dh.c:1225
_factor_dh::id
int id
Definition: Factor_dh.h:58
_factor_dh::sendlenHi
int sendlenHi
Definition: Factor_dh.h:87
_factor_dh::fill
int * fill
Definition: Factor_dh.h:72
_factor_dh::sendindLo
int * sendindLo
Definition: Factor_dh.h:86
_factor_dh::sendbufLo
double * sendbufLo
Definition: Factor_dh.h:85
_factor_dh::n
int n
Definition: Factor_dh.h:56
_factor_dh::sendindHi
int * sendindHi
Definition: Factor_dh.h:86
_factor_dh::diag
int * diag
Definition: Factor_dh.h:73
REAL_DH
#define REAL_DH
Definition: euclid_common.h:53
_numbering_dh
Definition: Numbering_dh.h:59
_factor_dh::m
int m
Definition: Factor_dh.h:56
_factor_dh::recv_reqLo
MPI_Request recv_reqLo[MAX_MPI_TASKS]
Definition: Factor_dh.h:91
_factor_dh::numbSolve
Numbering_dh numbSolve
Definition: Factor_dh.h:89
_factor_dh::blockJacobi
bool blockJacobi
Definition: Factor_dh.h:66
_factor_dh::requests
MPI_Request requests[MAX_MPI_TASKS]
Definition: Factor_dh.h:93
_factor_dh::send_reqHi
MPI_Request send_reqHi[MAX_MPI_TASKS]
Definition: Factor_dh.h:92
_factor_dh::debug
bool debug
Definition: Factor_dh.h:96
Factor_dhReadNz
int Factor_dhReadNz(Factor_dh mat)
Definition: Factor_dh.c:219
Factor_dhSolveSeq
void Factor_dhSolveSeq(double *rhs, double *lhs, Euclid_dh ctx)
Definition: Factor_dh.c:1257
Factor_dhCreate
void Factor_dhCreate(Factor_dh *mat)
Definition: Factor_dh.c:70
_factor_dh::num_sendLo
int num_sendLo
Definition: Factor_dh.h:78
A
_mpi_interface_dh
Definition: Euclid_dh.h:136
Factor_dhMaxPivotInverse
double Factor_dhMaxPivotInverse(Factor_dh mat)
Definition: Factor_dh.c:1409
Factor_dhPrintDiags
void Factor_dhPrintDiags(Factor_dh mat, FILE *fp)
Definition: Factor_dh.c:284
_factor_dh::sendlenLo
int sendlenLo
Definition: Factor_dh.h:87
Factor_dhInit
void Factor_dhInit(void *A, bool fillFlag, bool avalFlag, double rho, int id, int beg_rowP, Factor_dh *F)
Definition: Factor_dh.c:1144
_factor_dh::sendbufHi
double * sendbufHi
Definition: Factor_dh.h:85
_factor_dh::aval
REAL_DH * aval
Definition: Factor_dh.h:71
Factor_dhPrintRows
void Factor_dhPrintRows(Factor_dh mat, FILE *fp)
Definition: Factor_dh.c:232
_factor_dh::recv_reqHi
MPI_Request recv_reqHi[MAX_MPI_TASKS]
Definition: Factor_dh.h:91
Factor_dhSolveSetup
void Factor_dhSolveSetup(Factor_dh mat, SubdomainGraph_dh sg)
Definition: Factor_dh.c:649
_factor_dh::cval
int * cval
Definition: Factor_dh.h:70