IFPACK  Development
 All Classes Namespaces Files Functions Variables Enumerations Friends Pages
SortedList_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 SORTEDLIST_DH_H
44 #define SORTEDLIST_DH_H
45 
46 #if defined(Ifpack_SHOW_DEPRECATED_WARNINGS)
47 #ifdef __GNUC__
48 #warning "The Ifpack package is deprecated"
49 #endif
50 #endif
51 
52 /* for private use by mpi factorization algorithms */
53 
54 #include "euclid_common.h"
55 #ifdef __cplusplus
56 extern "C"
57 {
58 #endif
59 
60  typedef struct _srecord
61  {
62  int col;
63  int level;
64  double val;
65  int next;
66  } SRecord;
67 
68 
69  extern void SortedList_dhCreate (SortedList_dh * sList);
70  extern void SortedList_dhDestroy (SortedList_dh sList);
71  extern void SortedList_dhInit (SortedList_dh sList, SubdomainGraph_dh sg);
72  extern void SortedList_dhEnforceConstraint (SortedList_dh sList,
74 
75  extern void SortedList_dhReset (SortedList_dh sList, int row);
76 
77  extern int SortedList_dhReadCount (SortedList_dh sList);
78  /* returns number of records inserted since last reset */
79 
80  extern void SortedList_dhResetGetSmallest (SortedList_dh sList);
81  /* resets index used for SortedList_dhGetSmallestLowerTri().
82  */
83 
84  extern SRecord *SortedList_dhGetSmallest (SortedList_dh sList);
85  /* returns record with smallest column value that hasn't been
86  retrieved via this method since last call to SortedList_dhReset()
87  or SortedList_dhResetGetSmallest().
88  If all records have been retrieved, returns NULL.
89  */
90 
91  extern SRecord *SortedList_dhGetSmallestLowerTri (SortedList_dh sList);
92  /* returns record with smallest column value that hasn't been
93  retrieved via this method since last call to reset.
94  Only returns records where SRecord sr.col < row (per Init).
95  If all records have been retrieved, returns NULL.
96  */
97 
98  extern void SortedList_dhInsert (SortedList_dh sList, SRecord * sr);
99  /* unilateral insert (does not check to see if item is already
100  in list); does not permute sr->col; used in numeric
101  factorization routines.
102  */
103 
104  extern void SortedList_dhInsertOrUpdateVal (SortedList_dh sList,
105  SRecord * sr);
106  /* unilateral insert: does not check to see if already
107  inserted; does not permute sr->col; used in numeric
108  factorization routines.
109  */
110 
111  extern bool SortedList_dhPermuteAndInsert (SortedList_dh sList,
112  SRecord * sr, double thresh);
113  /* permutes sr->col, and inserts record in sorted list.
114  Note: the contents of the passed variable "sr" may be changed.
115  Note: this performs sparsification
116  */
117 
118 
119  extern void SortedList_dhInsertOrUpdate (SortedList_dh sList, SRecord * sr);
120  /* if a record with identical sr->col was inserted, updates sr->level
121  to smallest of the two values; otherwise, inserts the record.
122  Unlike SortedList_dhPermuteAndInsert, does not permute sr->col.
123  Note: the contents of the passed variable "sr" may be changed.
124  Warning: do not call SortedList_dhGetSmallestLowerTri() again
125  until reset is called.
126  */
127 
128  extern SRecord *SortedList_dhFind (SortedList_dh sList, SRecord * sr);
129  /* returns NULL if no record is found containing sr->col
130  */
131 
132  extern void SortedList_dhUpdateVal (SortedList_dh sList, SRecord * sr);
133 #ifdef __cplusplus
134 }
135 #endif
136 #endif