/usr/include/trilinos/Epetra_FEVbrMatrix.h is in libtrilinos-epetra-dev 12.12.1-5.
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 | /*
//@HEADER
// ************************************************************************
//
// Epetra: Linear Algebra Services Package
// Copyright 2011 Sandia Corporation
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
//
// ************************************************************************
//@HEADER
*/
#ifndef EPETRA_FEVBRMATRIX_H
#define EPETRA_FEVBRMATRIX_H
#include <Epetra_VbrMatrix.h>
#include <Epetra_SerialDenseMatrix.h>
/** Epetra Finite-Element VbrMatrix. This class provides the ability to
input finite-element style sub-matrix data, including sub-matrices with
non-local rows (which could correspond to shared finite-element nodes for
example). This class inherits Epetra_VbrMatrix, and so all Epetra_VbrMatrix
functionality is also available.
*/
class EPETRA_LIB_DLL_EXPORT Epetra_FEVbrMatrix: public Epetra_VbrMatrix {
public:
//! @name Constructors/Destructor
//@{
//! Epetra_FEVbrMatrix constuctor with variable number of indices per row.
/*! Creates a Epetra_FEVbrMatrix object and allocates storage.
\param In
CV - A Epetra_DataAccess enumerated type set to Copy or View.
\param In
RowMap - A Epetra_BlockMap listing the block rows that this processor
will contribute to.
\param In
NumBlockEntriesPerRow - An integer array of length NumRows
such that NumBlockEntriesPerRow[i] indicates the (approximate)
number of Block entries in the ith row.
*/
Epetra_FEVbrMatrix(Epetra_DataAccess CV,
const Epetra_BlockMap& RowMap,
int *NumBlockEntriesPerRow,
bool ignoreNonLocalEntries=false);
//! Epetra_FEVbrMatrix constuctor with fixed number of indices per row.
/*! Creates a Epetra_FEVbrMatrix object and allocates storage.
\param In
CV - A Epetra_DataAccess enumerated type set to Copy or View.
\param In
RowMap - An Epetra_BlockMap listing the block rows that this
processor will contribute to.
\param In
NumBlockEntriesPerRow - An integer that indicates the (approximate)
number of Block entries in the each Block row.
Note that it is possible to use 0 for this value and let fill occur
during the insertion phase.
*/
Epetra_FEVbrMatrix(Epetra_DataAccess CV,
const Epetra_BlockMap& RowMap,
int NumBlockEntriesPerRow,
bool ignoreNonLocalEntries=false);
//! Epetra_FEVbrMatrix constuctor with variable number of indices per row.
/*! Creates a Epetra_FEVbrMatrix object and allocates storage.
\param In
CV - A Epetra_DataAccess enumerated type set to Copy or View.
\param In
RowMap - A Epetra_BlockMap listing the block rows that this processor
will contribute to.
\param In
ColMap - A Epetra_BlockMap listing the block columns to be contained
on this processor.
\param In
NumBlockEntriesPerRow - An integer array of length NumRows
such that NumBlockEntriesPerRow[i] indicates the (approximate)
number of Block entries in the ith row.
*/
Epetra_FEVbrMatrix(Epetra_DataAccess CV,
const Epetra_BlockMap& RowMap,
const Epetra_BlockMap& ColMap,
int *NumBlockEntriesPerRow,
bool ignoreNonLocalEntries=false);
//! Epetra_FEVbrMatrix constuctor with fixed number of indices per row.
/*! Creates a Epetra_FEVbrMatrix object and allocates storage.
\param In
CV - A Epetra_DataAccess enumerated type set to Copy or View.
\param In
RowMap - An Epetra_BlockMap listing the block rows that this
processor will contribute to.
\param In
ColMap - An Epetra_BlockMap listing the block columns to be contained
on this processor.
\param In
NumBlockEntriesPerRow - An integer that indicates the (approximate)
number of Block entries in the each Block row.
Note that it is possible to use 0 for this value and let fill occur
during the insertion phase.
*/
Epetra_FEVbrMatrix(Epetra_DataAccess CV,
const Epetra_BlockMap& RowMap,
const Epetra_BlockMap& ColMap,
int NumBlockEntriesPerRow,
bool ignoreNonLocalEntries=false);
/** Constructor with pre-constructed Graph.
*/
Epetra_FEVbrMatrix(Epetra_DataAccess CV,
const Epetra_CrsGraph& Graph,
bool ignoreNonLocalEntries=false);
/** Copy Constructor. */
Epetra_FEVbrMatrix(const Epetra_FEVbrMatrix& src);
//! Epetra_VbrMatrix Destructor
virtual ~Epetra_FEVbrMatrix();
//@}
//! @name Insertion/Replace/SumInto methods
//@{
Epetra_FEVbrMatrix& operator=(const Epetra_FEVbrMatrix& src);
//! Initialize all values in graph of the matrix with constant value.
/*!
\param In
ScalarConstant - Value to use.
\return Integer error code, set to 0 if successful.
*/
int PutScalar(double ScalarConstant);
//! Initiate insertion of a list of elements in a given global row of the matrix, values are inserted via SubmitEntry().
/*!
\param In
BlockRow - Block Row number (in global coordinates) to put elements.
\param In
NumBlockEntries - Number of entries.
\param In
Indices - Global column indices corresponding to values.
\return Integer error code, set to 0 if successful.
*/
int BeginInsertGlobalValues(int BlockRow, int NumBlockEntries, int * BlockIndices);
//! Initiate replacement of current values with this list of entries for a given global row of the matrix, values are replaced via SubmitEntry()
/*!
\param In
Row - Block Row number (in global coordinates) to put elements.
\param In
NumBlockEntries - Number of entries.
\param In
Indices - Global column indices corresponding to values.
\return Integer error code, set to 0 if successful.
*/
int BeginReplaceGlobalValues(int BlockRow, int NumBlockEntries, int *BlockIndices);
//! Initiate summing into current values with this list of entries for a given global row of the matrix, values are replaced via SubmitEntry()
/*!
\param In
Row - Block Row number (in global coordinates) to put elements.
\param In
NumBlockEntries - Number of entries.
\param In
Indices - Global column indices corresponding to values.
\return Integer error code, set to 0 if successful.
*/
int BeginSumIntoGlobalValues(int BlockRow, int NumBlockEntries, int *BlockIndices);
//Let the compiler know we intend to overload the base-class function
//SubmitBlockEntry rather than hide it.
using Epetra_VbrMatrix::SubmitBlockEntry;
//! Submit a block entry to the indicated block row and column specified in the Begin routine.
/* Submit a block entry that will recorded in the block row that was initiated by one of the
Begin routines listed above. Once a one of the following routines: BeginInsertGlobalValues(),
BeginInsertMyValues(), BeginReplaceGlobalValues(), BeginReplaceMyValues(), BeginSumIntoGlobalValues(),
BeginSumIntoMyValues(), you \e must call SubmitBlockEntry() NumBlockEntries times to register the values
corresponding to the block indices passed in to the Begin routine. If the Epetra_VbrMatrix constuctor
was called in Copy mode, the values will be copied. However, no copying will be done until the EndSubmitEntries()
function is call to complete submission of the current block row. If the constructor was called in View mode, all
block entries passed via SubmitBlockEntry() will not be copied, but a pointer will be set to point to the argument Values
that was passed in by the user.
For performance reasons, SubmitBlockEntry() does minimal processing of data. Any processing that can be
delayed is performed in EndSubmitEntries().
\param In
Values - The starting address of the values.
\param In
LDA - The stride between successive columns of Values.
\param In
NumRows - The number of rows passed in.
\param In
NumCols - The number of columns passed in.
\return Integer error code, set to 0 if successful.
*/
int SubmitBlockEntry(double *Values, int LDA, int NumRows, int NumCols);
//! Completes processing of all data passed in for the current block row.
/*! This function completes the processing of all block entries submitted via SubmitBlockEntry().
It also checks to make sure that SubmitBlockEntry was called the correct number of times as
specified by the Begin routine that initiated the entry process.
*/
int EndSubmitEntries();
int GlobalAssemble(bool callFillComplete=true);
private:
int SetupForNonlocalSubmits(int BlockRow,
int NumBlockEntries,
int * BlockIndices,
bool IndicesAreLocal,
Epetra_CombineMode SubmitMode);
int InputNonlocalBlockEntry(double *Values, int LDA,
int NumRows, int NumCols);
int InsertNonlocalRow(int row, int offset, int numCols);
void destroyNonlocalData();
bool ignoreNonLocalEntries_;
int numNonlocalBlockRows_;
int* nonlocalBlockRows_;
int* nonlocalBlockRowLengths_;
int* nonlocalBlockRowAllocLengths_;
int** nonlocalBlockCols_;
//Triple-pointers are gross, but we need one here. We want a 2-D table of
//pointer-to-matrix objects. If we only use a double-pointer, it would be
//too hard to change the lengths of the rows of the table.
Epetra_SerialDenseMatrix*** nonlocalCoefs_;
//Following the approach Mike uses in Epetra_VbrMatrix, we need some state
//variables to keep track of block-entry submits.
int curRowOffset_;
int curColOffset_;
int curNumCols_;
int* curCols_;
int curMode_;
};
#endif /* EPETRA_FEVBRMATRIX_H */
|