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#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
55extern "C"
56{
57#endif
58
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 */
72 bool blockJacobi;
73
74 /* sparse row-oriented storage for locally owned submatrix */
75 int *rp;
76 int *cval;
77 REAL_DH *aval;
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) */
83 int num_recvLo, num_recvHi;
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;
92 int *sendindLo, *sendindHi;
93 int sendlenLo, sendlenHi;
94 bool solveIsSetup;
95 Numbering_dh numbSolve;
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