FEI Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
support-Trilinos
fei_AztecDVBR_Matrix.hpp
Go to the documentation of this file.
1
/*
2
// @HEADER
3
// ************************************************************************
4
// FEI: Finite Element Interface to Linear Solvers
5
// Copyright (2005) Sandia Corporation.
6
//
7
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the
8
// U.S. Government retains certain rights in this software.
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 Alan Williams (william@sandia.gov)
38
//
39
// ************************************************************************
40
// @HEADER
41
*/
42
43
#ifndef _fei_AztecDVBR_Matrix_hpp_
44
#define _fei_AztecDVBR_Matrix_hpp_
45
46
47
#include <
fei_SharedPtr.hpp
>
48
//
49
// This class provides a wrapper for the Aztec DVBR matrix data structure.
50
//
51
// Some functions return an int. This will be the ESI_error_code. It
52
// will be 0 if there were no errors, 1 if an error occurred.
53
//
54
namespace
fei_trilinos
{
55
56
class
Aztec_BlockMap
;
57
58
class
AztecDVBR_Matrix
{
59
60
public
:
61
// Constructor.
62
AztecDVBR_Matrix
(
fei::SharedPtr<Aztec_BlockMap>
map);
63
64
//Copy constructor.
65
AztecDVBR_Matrix
(
const
AztecDVBR_Matrix
& src);
66
67
virtual
~AztecDVBR_Matrix
();
68
69
//query functions.
70
71
int
getNumBlocksPerRow
(
int
blkRow,
int
& nnzBlksPerRow)
const
;
72
int
getNumNonzerosPerRow
(
int
blkRow,
int
& nnzPerRow)
const
;
73
int
getNumBlocksPerRow
(
int
* nnzBlksPerRow)
const
;
74
int
getNumNonzerosPerRow
(
int
* nnzPerRow)
const
;
75
int
getBlockSize
(
int
blkRow,
int
blkCol,
int
& ptRows,
int
& ptCols);
76
77
// Mathematical functions.
78
void
matvec
(
const
Aztec_LSVector
& x,
Aztec_LSVector
& y)
const
;
79
80
void
put
(
double
s);
81
82
// ... to read matrix.
83
84
int
getBlockRow
(
int
blk_row,
85
double
* vals,
86
int
* blk_col_inds,
87
int
num_nz_blocks)
const
;
88
89
// ... to write matrix.
90
91
int
putBlockRow
(
int
blk_row,
92
double
* vals,
93
int
* blk_col_inds,
94
int
num_nz_blocks)
const
;
95
96
int
sumIntoBlockRow
(
int
blk_row,
97
double
* vals,
98
int
* blk_col_inds,
99
int
num_nz_blocks)
const
;
100
101
// configuration function.
102
void
allocate
(
int
* num_nz_blocks,
int
* blk_col_inds);
103
104
void
loadComplete
();
105
106
bool
isLoaded
()
const
{
return
(
isLoaded_
);};
107
void
setLoaded
(
bool
flag) {
isLoaded_
= flag;};
108
bool
isAllocated
()
const
{
return
(
isAllocated_
);};
109
void
setAllocated
(
bool
flag) {
isAllocated_
= flag;};
110
111
AZ_MATRIX*
getAZ_MATRIX_Ptr
()
const
{
return
(
Amat_
);};
112
113
bool
readFromFile
(
const
char
*filename);
114
bool
writeToFile
(
const
char
*fileName)
const
;
115
116
//numRemoteBlocks is the number of block-column-indices on this processor
117
//that correspond to block-rows that reside on another processor.
118
int
getNumRemoteBlocks
() {
return
(
numRemoteBlocks_
);};
119
int
*
getRemoteBlockIndices
() {
return
(
remoteInds_
);};
120
int
*
getRemoteBlockSizes
() {
return
(
remoteBlockSizes_
);};
121
122
int
*
getUpdate_index
() {
return
(
update_index_
);};
123
int
*
getData_org
() {
return
(
data_org_
);};
124
125
private
:
126
int
inUpdate
(
int
globalIndex,
int
& localIndex)
const
;
127
128
void
readAllocateInfo
(FILE* infile,
int
*& num_nz_blocks,
int
*& blk_col_inds);
129
void
readMatrixData
(FILE* infile);
130
131
void
calcRpntr
();
132
void
calcBpntr
(
int
* nzBlksPerRow);
133
void
setBindx
(
int
nnzBlks,
int
* blkColInds);
134
void
calcIndx
(
int
nnzBlks);
135
136
int
getBindxOffset
(
int
blkInd,
int
bpntrStart,
int
bpntrEnd)
const
;
137
138
void
calcRemoteInds
(
int
*& remoteInds,
int
& len);
139
void
getRemoteBlkSizes
(
int
* remoteBlkSizes,
int
* remoteInds,
int
len);
140
void
insertList
(
int
item,
int
*& list,
int
& len);
141
void
getValuesFromString
(
char
*line,
int
len,
double
*values,
142
int
lenValues);
143
void
messageAbort
(
const
char
* mesg)
const
;
144
145
fei::SharedPtr<Aztec_BlockMap>
amap_
;
146
147
AZ_MATRIX *
Amat_
;
148
149
int
N_update_
;
150
int
*
external_
;
151
int
*
extern_index_
;
152
int
*
update_index_
;
153
int
*
data_org_
;
154
int
*
orderingUpdate_
;
155
156
bool
isLoaded_
;
157
bool
isAllocated_
;
158
159
int
localNNZ_
;
160
int
*
nnzPerRow_
;
161
162
int
numRemoteBlocks_
;
163
int
*
remoteInds_
;
164
int
*
remoteBlockSizes_
;
165
};
166
167
}
//namespace fei_trilinos
168
169
#endif
fei::SharedPtr
Definition
fei_SharedPtr.hpp:65
fei_trilinos::AztecDVBR_Matrix::calcRpntr
void calcRpntr()
fei_trilinos::AztecDVBR_Matrix::remoteInds_
int * remoteInds_
Definition
fei_AztecDVBR_Matrix.hpp:163
fei_trilinos::AztecDVBR_Matrix::numRemoteBlocks_
int numRemoteBlocks_
Definition
fei_AztecDVBR_Matrix.hpp:162
fei_trilinos::AztecDVBR_Matrix::put
void put(double s)
fei_trilinos::AztecDVBR_Matrix::allocate
void allocate(int *num_nz_blocks, int *blk_col_inds)
fei_trilinos::AztecDVBR_Matrix::loadComplete
void loadComplete()
fei_trilinos::AztecDVBR_Matrix::readFromFile
bool readFromFile(const char *filename)
fei_trilinos::AztecDVBR_Matrix::orderingUpdate_
int * orderingUpdate_
Definition
fei_AztecDVBR_Matrix.hpp:154
fei_trilinos::AztecDVBR_Matrix::calcIndx
void calcIndx(int nnzBlks)
fei_trilinos::AztecDVBR_Matrix::readMatrixData
void readMatrixData(FILE *infile)
fei_trilinos::AztecDVBR_Matrix::~AztecDVBR_Matrix
virtual ~AztecDVBR_Matrix()
fei_trilinos::AztecDVBR_Matrix::getRemoteBlkSizes
void getRemoteBlkSizes(int *remoteBlkSizes, int *remoteInds, int len)
fei_trilinos::AztecDVBR_Matrix::getValuesFromString
void getValuesFromString(char *line, int len, double *values, int lenValues)
fei_trilinos::AztecDVBR_Matrix::getNumBlocksPerRow
int getNumBlocksPerRow(int *nnzBlksPerRow) const
fei_trilinos::AztecDVBR_Matrix::AztecDVBR_Matrix
AztecDVBR_Matrix(fei::SharedPtr< Aztec_BlockMap > map)
fei_trilinos::AztecDVBR_Matrix::putBlockRow
int putBlockRow(int blk_row, double *vals, int *blk_col_inds, int num_nz_blocks) const
fei_trilinos::AztecDVBR_Matrix::calcBpntr
void calcBpntr(int *nzBlksPerRow)
fei_trilinos::AztecDVBR_Matrix::sumIntoBlockRow
int sumIntoBlockRow(int blk_row, double *vals, int *blk_col_inds, int num_nz_blocks) const
fei_trilinos::AztecDVBR_Matrix::external_
int * external_
Definition
fei_AztecDVBR_Matrix.hpp:150
fei_trilinos::AztecDVBR_Matrix::isLoaded
bool isLoaded() const
Definition
fei_AztecDVBR_Matrix.hpp:106
fei_trilinos::AztecDVBR_Matrix::isAllocated
bool isAllocated() const
Definition
fei_AztecDVBR_Matrix.hpp:108
fei_trilinos::AztecDVBR_Matrix::getNumNonzerosPerRow
int getNumNonzerosPerRow(int blkRow, int &nnzPerRow) const
fei_trilinos::AztecDVBR_Matrix::getBlockRow
int getBlockRow(int blk_row, double *vals, int *blk_col_inds, int num_nz_blocks) const
fei_trilinos::AztecDVBR_Matrix::setLoaded
void setLoaded(bool flag)
Definition
fei_AztecDVBR_Matrix.hpp:107
fei_trilinos::AztecDVBR_Matrix::getNumBlocksPerRow
int getNumBlocksPerRow(int blkRow, int &nnzBlksPerRow) const
fei_trilinos::AztecDVBR_Matrix::localNNZ_
int localNNZ_
Definition
fei_AztecDVBR_Matrix.hpp:159
fei_trilinos::AztecDVBR_Matrix::isAllocated_
bool isAllocated_
Definition
fei_AztecDVBR_Matrix.hpp:157
fei_trilinos::AztecDVBR_Matrix::getNumRemoteBlocks
int getNumRemoteBlocks()
Definition
fei_AztecDVBR_Matrix.hpp:118
fei_trilinos::AztecDVBR_Matrix::Amat_
AZ_MATRIX * Amat_
Definition
fei_AztecDVBR_Matrix.hpp:147
fei_trilinos::AztecDVBR_Matrix::getData_org
int * getData_org()
Definition
fei_AztecDVBR_Matrix.hpp:123
fei_trilinos::AztecDVBR_Matrix::inUpdate
int inUpdate(int globalIndex, int &localIndex) const
fei_trilinos::AztecDVBR_Matrix::N_update_
int N_update_
Definition
fei_AztecDVBR_Matrix.hpp:149
fei_trilinos::AztecDVBR_Matrix::getAZ_MATRIX_Ptr
AZ_MATRIX * getAZ_MATRIX_Ptr() const
Definition
fei_AztecDVBR_Matrix.hpp:111
fei_trilinos::AztecDVBR_Matrix::setAllocated
void setAllocated(bool flag)
Definition
fei_AztecDVBR_Matrix.hpp:109
fei_trilinos::AztecDVBR_Matrix::update_index_
int * update_index_
Definition
fei_AztecDVBR_Matrix.hpp:152
fei_trilinos::AztecDVBR_Matrix::isLoaded_
bool isLoaded_
Definition
fei_AztecDVBR_Matrix.hpp:156
fei_trilinos::AztecDVBR_Matrix::setBindx
void setBindx(int nnzBlks, int *blkColInds)
fei_trilinos::AztecDVBR_Matrix::getUpdate_index
int * getUpdate_index()
Definition
fei_AztecDVBR_Matrix.hpp:122
fei_trilinos::AztecDVBR_Matrix::getBlockSize
int getBlockSize(int blkRow, int blkCol, int &ptRows, int &ptCols)
fei_trilinos::AztecDVBR_Matrix::messageAbort
void messageAbort(const char *mesg) const
fei_trilinos::AztecDVBR_Matrix::getNumNonzerosPerRow
int getNumNonzerosPerRow(int *nnzPerRow) const
fei_trilinos::AztecDVBR_Matrix::amap_
fei::SharedPtr< Aztec_BlockMap > amap_
Definition
fei_AztecDVBR_Matrix.hpp:145
fei_trilinos::AztecDVBR_Matrix::getBindxOffset
int getBindxOffset(int blkInd, int bpntrStart, int bpntrEnd) const
fei_trilinos::AztecDVBR_Matrix::readAllocateInfo
void readAllocateInfo(FILE *infile, int *&num_nz_blocks, int *&blk_col_inds)
fei_trilinos::AztecDVBR_Matrix::getRemoteBlockIndices
int * getRemoteBlockIndices()
Definition
fei_AztecDVBR_Matrix.hpp:119
fei_trilinos::AztecDVBR_Matrix::matvec
void matvec(const Aztec_LSVector &x, Aztec_LSVector &y) const
fei_trilinos::AztecDVBR_Matrix::remoteBlockSizes_
int * remoteBlockSizes_
Definition
fei_AztecDVBR_Matrix.hpp:164
fei_trilinos::AztecDVBR_Matrix::extern_index_
int * extern_index_
Definition
fei_AztecDVBR_Matrix.hpp:151
fei_trilinos::AztecDVBR_Matrix::calcRemoteInds
void calcRemoteInds(int *&remoteInds, int &len)
fei_trilinos::AztecDVBR_Matrix::data_org_
int * data_org_
Definition
fei_AztecDVBR_Matrix.hpp:153
fei_trilinos::AztecDVBR_Matrix::AztecDVBR_Matrix
AztecDVBR_Matrix(const AztecDVBR_Matrix &src)
fei_trilinos::AztecDVBR_Matrix::insertList
void insertList(int item, int *&list, int &len)
fei_trilinos::AztecDVBR_Matrix::writeToFile
bool writeToFile(const char *fileName) const
fei_trilinos::AztecDVBR_Matrix::nnzPerRow_
int * nnzPerRow_
Definition
fei_AztecDVBR_Matrix.hpp:160
fei_trilinos::AztecDVBR_Matrix::getRemoteBlockSizes
int * getRemoteBlockSizes()
Definition
fei_AztecDVBR_Matrix.hpp:120
fei_trilinos::Aztec_BlockMap
Definition
fei_Aztec_BlockMap.hpp:61
fei_trilinos::Aztec_LSVector
Definition
fei_Aztec_LSVector.hpp:76
fei_SharedPtr.hpp
fei_trilinos
Definition
fei_Aztec_BlockMap.hpp:59
Generated by
1.17.0