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