/usr/include/InsightToolkit/Numerics/FEM/itkFEMItpackSparseMatrix.h is in libinsighttoolkit3-dev 3.20.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | /*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: itkFEMItpackSparseMatrix.h
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __itkFEMItpackSparseMatrix_h
#define __itkFEMItpackSparseMatrix_h
#include "itkFEMException.h"
namespace itk {
namespace fem {
/**
* \class ItpackSparseMatrix
* \brief a compressed row sparse matrix representation that makes
* use of itpack to dynamically assemble the matrix
* \sa ItpackLinearSystemWrapper
*/
// Forward declaration of friend class
class ItpackLinearSystemWrapper;
class ItpackSparseMatrix
{
public:
/** typedefs from f2c.h */
typedef long integer;
typedef double doublereal;
/** Constructor */
ItpackSparseMatrix();
/**
* Constructor with single parameter
* \param order the order of the matrix to be created
*/
ItpackSparseMatrix(integer order);
/**
* Constructor with two parameters
* \param order the order of the matrix to be created
* \param maxNonZeroValues the maximum number of non-zero values that may
* appear in the matrix
*/
ItpackSparseMatrix(integer order, integer maxNonZeroValues);
/**
* Destructor
*/
~ItpackSparseMatrix();
/**
* Set the order of the matrix
* \param order the order of the matrix
* \note the order must be set before any values are entered
*/
void SetOrder(integer order) { m_N = order; }
/**
* Set the maximum number of non-zero values that may appear in the matrix
* \param maxNonZeroValues maximum number of non-zero values that may appear in matrix
* \note the maxNonZeroValues must be set before any values are entered
*/
void SetMaxNonZeroValues(integer maxNonZeroValues) { m_NZ = maxNonZeroValues; }
/**
* Insert a value into the matrix
* \param i row index
* \param j column index
* \param value value to be added at (i,j)
*/
void Set(integer i, integer j, doublereal value);
/**
* Add to existing entry of matrix
* \param i row index
* \param j column index
* \param value value to add to current value at (i,j)
*/
void Add(integer i, integer j, doublereal value);
/** Get a value from the matrix
* \param i row index
* \param j column index
*/
doublereal Get(integer i, integer j);
/**
* Get the order of the matrix (via "itpack-like" naming scheme)
*/
integer* GetN() { return &m_N; }
/**
* Get the row indices of the matrix (via "itpack-like" naming scheme)
*/
integer* GetIA();
/**
* Pass pointers to compressed row format arrays
* \param ia row indices
* \param ja column indices
* \param a matrix values
*/
void SetCompressedRow(integer *ia, integer *ja, doublereal *a);
/**
* Get the column indices of the matrix (via "itpack-like" naming scheme)
*/
integer* GetJA();
/**
* Get the values of the matrix (via "itpack-like" naming scheme)
*/
doublereal* GetA();
/**
* Get the values of the matrix
*/
doublereal* GetValueArray() { return GetA(); }
/**
* Get the column indices
*/
integer* GetColumnArray() { return GetJA(); }
/**
* Get the row indices
*/
integer* GetRowArray() { return GetIA(); }
/**
* Get the order of the matrix
*/
integer GetOrder() const { return m_N; }
/**
* Get the maximum number of non-zero values allowed in the matrix
*/
integer GetMaxNonZeroValues() const { return m_NZ; }
/**
* Clear the memory
*/
void Clear();
/**
* Multiply the matrix by a vector
*/
void mult(doublereal* vector, doublereal* result);
/**
* Multiply the matrix by another ItpackSparseMatrix
*/
void mult(ItpackSparseMatrix* rightMatrix, ItpackSparseMatrix* resultMatrix);
/** output compressed row vectors: IA, JA, A */
void PrintCompressedRow();
private:
/** friend class */
friend class LinearSystemWrapperItpack;
/** initialize matrix */
void Initialize();
/** unfinalize matrix */
void UnFinalize();
/** finalize matrix form */
void Finalize();
/** flag indicating whether the matrix representation has been finalized */
integer m_MatrixFinalized;
/** flag indicating variables have been initialized */
integer m_MatrixInitialized;
/** Order of system */
integer m_N;
/** Maximum number of non-zero elements in master stiffness matrix */
integer m_NZ;
/** row pointegerers used in compressed row storage format */
integer *m_IA;
/** column indices used in compressed row storage format */
integer *m_JA;
/** nonzero entries in compressed row storage format */
doublereal *m_A;
/** integer workspace used in matrix building */
integer *m_IWORK;
/**
* flag indicating mode of matrix building for repeat entries
* m_MODE < 0 - current entry left as is
* = 0 - current entry reset
* > 0 - value is added to current entry
*/
integer m_MODE;
/** unit number that error messages are written to during matrix building */
integer m_NOUT;
/**
* flag indicating desired level of error reporting during matrix building
* m_LEVEL < 0 - no printing
* = 0 - fatal error messages written to m_NOUT
* > 0 - messages printed when repeat entries are encountered
* \note must be set to less than 0
*/
integer m_LEVEL;
/**
* error flag for matrix building
* m_IER = 0 - no error
* = 700 - entry already set - reset according to m_MODE
* = 701 - Improper value for i or j
* = 701 - m_NZ is too small - no room for new entry
*/
//integer m_IER;
};
/**
* \class FEMExceptionItpackSparseMatrixSbagn
* \brief handles errors that occur when unfinalizing the matrix
* \sa ItpackSparseMatrix
* \sa FEMException
*/
class FEMExceptionItpackSparseMatrixSbagn : public FEMException
{
public:
/** typedefs from f2c.h */
typedef long integer;
typedef double doublereal;
/**
* Constructor. In order to construct this exception object, five parameters
* must be provided: file, lineNumber, location and a detailed description
* of the exception, and the invalid index
*/
FEMExceptionItpackSparseMatrixSbagn(const char *file, unsigned int lineNumber, std::string location, integer errorCode);
/** Virtual destructor needed for subclasses. Has to have empty throw(). */
virtual ~FEMExceptionItpackSparseMatrixSbagn() throw() {}
/** Type related information. */
itkTypeMacro(FEMExceptionItpackSparseMatrixSbagn,FEMException);
};
/**
* \class FEMExceptionItpackSparseMatrixSbsij
* \brief handles errors that occur when building the matrix
* \sa ItpackSparseMatrix
* \sa FEMException
*/
class FEMExceptionItpackSparseMatrixSbsij : public FEMException
{
public:
/** typedefs from f2c.h */
typedef long integer;
typedef double doublereal;
/**
* Constructor. In order to construct this exception object, five parameters
* must be provided: file, lineNumber, location and a detailed description
* of the exception, and the invalid index
*/
FEMExceptionItpackSparseMatrixSbsij(const char *file, unsigned int lineNumber, std::string location, integer errorCode);
/** Virtual destructor needed for subclasses. Has to have empty throw(). */
virtual ~FEMExceptionItpackSparseMatrixSbsij() throw() {}
/** Type related information. */
itkTypeMacro(FEMExceptionItpackSparseMatrixSbsij,FEMException);
};
}} // end namespace itk::fem
#endif
|