IFPACK Development
Loading...
Searching...
No Matches
Factor_dh.h
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
49extern "C"
50{
51#endif
52
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 */
66 bool blockJacobi;
67
68 /* sparse row-oriented storage for locally owned submatrix */
69 int *rp;
70 int *cval;
71 REAL_DH *aval;
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) */
77 int num_recvLo, num_recvHi;
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;
86 int *sendindLo, *sendindHi;
87 int sendlenLo, sendlenHi;
88 bool solveIsSetup;
89 Numbering_dh numbSolve;
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