Epetra Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Epetra_FEVbrMatrix.h
Go to the documentation of this file.
1 /*
2 //@HEADER
3 // ************************************************************************
4 //
5 // Epetra: Linear Algebra Services Package
6 // Copyright 2011 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ************************************************************************
41 //@HEADER
42 */
43 
44 #ifndef EPETRA_FEVBRMATRIX_H
45 #define EPETRA_FEVBRMATRIX_H
46 
47 #include <Epetra_VbrMatrix.h>
49 
57 class EPETRA_LIB_DLL_EXPORT Epetra_FEVbrMatrix: public Epetra_VbrMatrix {
58  public:
59 
61 
62 
76  const Epetra_BlockMap& RowMap,
77  int *NumBlockEntriesPerRow,
78  bool ignoreNonLocalEntries=false);
79 
81 
95  const Epetra_BlockMap& RowMap,
96  int NumBlockEntriesPerRow,
97  bool ignoreNonLocalEntries=false);
98 
100 
116  const Epetra_BlockMap& RowMap,
117  const Epetra_BlockMap& ColMap,
118  int *NumBlockEntriesPerRow,
119  bool ignoreNonLocalEntries=false);
120 
122 
139  const Epetra_BlockMap& RowMap,
140  const Epetra_BlockMap& ColMap,
141  int NumBlockEntriesPerRow,
142  bool ignoreNonLocalEntries=false);
143 
147  const Epetra_CrsGraph& Graph,
148  bool ignoreNonLocalEntries=false);
149 
152 
154  virtual ~Epetra_FEVbrMatrix();
156 
158 
159 
161 
163 
169  int PutScalar(double ScalarConstant);
170 
172 
182  int BeginInsertGlobalValues(int BlockRow, int NumBlockEntries, int * BlockIndices);
183 
185 
195  int BeginReplaceGlobalValues(int BlockRow, int NumBlockEntries, int *BlockIndices);
196 
198 
208  int BeginSumIntoGlobalValues(int BlockRow, int NumBlockEntries, int *BlockIndices);
209 
210  //Let the compiler know we intend to overload the base-class function
211  //SubmitBlockEntry rather than hide it.
213 
215  /* Submit a block entry that will recorded in the block row that was initiated by one of the
216  Begin routines listed above. Once a one of the following routines: BeginInsertGlobalValues(),
217  BeginInsertMyValues(), BeginReplaceGlobalValues(), BeginReplaceMyValues(), BeginSumIntoGlobalValues(),
218  BeginSumIntoMyValues(), you \e must call SubmitBlockEntry() NumBlockEntries times to register the values
219  corresponding to the block indices passed in to the Begin routine. If the Epetra_VbrMatrix constuctor
220  was called in Copy mode, the values will be copied. However, no copying will be done until the EndSubmitEntries()
221  function is call to complete submission of the current block row. If the constructor was called in View mode, all
222  block entries passed via SubmitBlockEntry() will not be copied, but a pointer will be set to point to the argument Values
223  that was passed in by the user.
224 
225  For performance reasons, SubmitBlockEntry() does minimal processing of data. Any processing that can be
226  delayed is performed in EndSubmitEntries().
227 
228  \param In
229  Values - The starting address of the values.
230  \param In
231  LDA - The stride between successive columns of Values.
232  \param In
233  NumRows - The number of rows passed in.
234  \param In
235  NumCols - The number of columns passed in.
236 
237  \return Integer error code, set to 0 if successful.
238  */
239  int SubmitBlockEntry(double *Values, int LDA, int NumRows, int NumCols);
240 
242 
247  int EndSubmitEntries();
248 
249  int GlobalAssemble(bool callFillComplete=true);
250 
251  private:
252  int SetupForNonlocalSubmits(int BlockRow,
253  int NumBlockEntries,
254  int * BlockIndices,
255  bool IndicesAreLocal,
256  Epetra_CombineMode SubmitMode);
257 
258  int InputNonlocalBlockEntry(double *Values, int LDA,
259  int NumRows, int NumCols);
260 
261  int InsertNonlocalRow(int row, int offset, int numCols);
262 
263  void destroyNonlocalData();
264 
266 
272 
273  //Triple-pointers are gross, but we need one here. We want a 2-D table of
274  //pointer-to-matrix objects. If we only use a double-pointer, it would be
275  //too hard to change the lengths of the rows of the table.
276 
278 
279  //Following the approach Mike uses in Epetra_VbrMatrix, we need some state
280  //variables to keep track of block-entry submits.
284  int* curCols_;
285  int curMode_;
286 };
287 
288 #endif /* EPETRA_FEVBRMATRIX_H */
Epetra_SerialDenseMatrix *** nonlocalCoefs_
int BeginReplaceGlobalValues(int BlockRow, int NumBlockEntries, int *BlockIndices)
Initiate replacement of current values with this list of entries for a given global row of the matrix...
int PutScalar(double ScalarConstant)
Initialize all values in graph of the matrix with constant value.
Epetra_VbrMatrix: A class for the construction and use of real-valued double-precision variable block...
int BeginSumIntoGlobalValues(int BlockRow, int NumBlockEntries, int *BlockIndices)
Initiate summing into current values with this list of entries for a given global row of the matrix...
Epetra_SerialDenseMatrix: A class for constructing and using real double precision general dense matr...
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
int EndSubmitEntries()
Completes processing of all data passed in for the current block row.
Epetra Finite-Element VbrMatrix.
Epetra_CombineMode
int BeginInsertGlobalValues(int BlockRow, int NumBlockEntries, int *BlockIndices)
Initiate insertion of a list of elements in a given global row of the matrix, values are inserted via...
int SubmitBlockEntry(double *Values, int LDA, int NumRows, int NumCols)
Submit a block entry to the indicated block row and column specified in the Begin routine...
Epetra_VbrMatrix & operator=(const Epetra_VbrMatrix &src)
Epetra_DataAccess
Epetra_CrsGraph: A class for constructing and using sparse compressed row graphs. ...