Epetra_FEVbrMatrix.h

Go to the documentation of this file.
00001 
00002 //@HEADER
00003 /*
00004 ************************************************************************
00005 
00006               Epetra: Linear Algebra Services Package 
00007                 Copyright (2001) Sandia Corporation
00008 
00009 Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00010 license for use of this work by or on behalf of the U.S. Government.
00011 
00012 This library is free software; you can redistribute it and/or modify
00013 it under the terms of the GNU Lesser General Public License as
00014 published by the Free Software Foundation; either version 2.1 of the
00015 License, or (at your option) any later version.
00016  
00017 This library is distributed in the hope that it will be useful, but
00018 WITHOUT ANY WARRANTY; without even the implied warranty of
00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 Lesser General Public License for more details.
00021  
00022 You should have received a copy of the GNU Lesser General Public
00023 License along with this library; if not, write to the Free Software
00024 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00025 USA
00026 Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00027 
00028 ************************************************************************
00029 */
00030 //@HEADER
00031 
00032 #ifndef EPETRA_FEVBRMATRIX_H
00033 #define EPETRA_FEVBRMATRIX_H
00034 
00035 #include <Epetra_VbrMatrix.h>
00036 #include <Epetra_SerialDenseMatrix.h>
00037 
00045 class Epetra_FEVbrMatrix: public Epetra_VbrMatrix {
00046  public:
00047 
00049 
00050 
00051 
00063   Epetra_FEVbrMatrix(Epetra_DataAccess CV,
00064          const Epetra_BlockMap& RowMap,
00065          int *NumBlockEntriesPerRow,
00066          bool ignoreNonLocalEntries=false);
00067   
00069 
00082   Epetra_FEVbrMatrix(Epetra_DataAccess CV,
00083          const Epetra_BlockMap& RowMap,
00084          int NumBlockEntriesPerRow,
00085          bool ignoreNonLocalEntries=false);
00086 
00088 
00103   Epetra_FEVbrMatrix(Epetra_DataAccess CV,
00104          const Epetra_BlockMap& RowMap,
00105          const Epetra_BlockMap& ColMap,
00106          int *NumBlockEntriesPerRow,
00107          bool ignoreNonLocalEntries=false);
00108   
00110 
00126   Epetra_FEVbrMatrix(Epetra_DataAccess CV,
00127          const Epetra_BlockMap& RowMap,
00128          const Epetra_BlockMap& ColMap,
00129          int NumBlockEntriesPerRow,
00130          bool ignoreNonLocalEntries=false);
00131 
00134   Epetra_FEVbrMatrix(Epetra_DataAccess CV,
00135          const Epetra_CrsGraph& Graph,
00136          bool ignoreNonLocalEntries=false);
00137 
00139   Epetra_FEVbrMatrix(const Epetra_FEVbrMatrix& src);
00140 
00142   virtual ~Epetra_FEVbrMatrix();
00144   
00146 
00147 
00148   Epetra_FEVbrMatrix& operator=(const Epetra_FEVbrMatrix& src);
00149 
00151 
00157     int PutScalar(double ScalarConstant);
00158 
00160 
00170     int BeginInsertGlobalValues(int BlockRow, int NumBlockEntries, int * BlockIndices);
00171 
00173 
00183     int BeginReplaceGlobalValues(int BlockRow, int NumBlockEntries, int *BlockIndices);
00184 
00186 
00196     int BeginSumIntoGlobalValues(int BlockRow, int NumBlockEntries, int *BlockIndices);
00197 
00198     //Let the compiler know we intend to overload the base-class function
00199     //SubmitBlockEntry rather than hide it.
00200     using Epetra_VbrMatrix::SubmitBlockEntry;
00201 
00203     /* Submit a block entry that will recorded in the block row that was initiated by one of the
00204        Begin routines listed above.  Once a one of the following routines: BeginInsertGlobalValues(),
00205        BeginInsertMyValues(), BeginReplaceGlobalValues(), BeginReplaceMyValues(), BeginSumIntoGlobalValues(),
00206        BeginSumIntoMyValues(), you \e must call SubmitBlockEntry() NumBlockEntries times to register the values 
00207        corresponding to the block indices passed in to the Begin routine.  If the Epetra_VbrMatrix constuctor
00208        was called in Copy mode, the values will be copied.  However, no copying will be done until the EndSubmitEntries()
00209        function is call to complete submission of the current block row.  If the constructor was called in View mode, all
00210        block entries passed via SubmitBlockEntry() will not be copied, but a pointer will be set to point to the argument Values
00211        that was passed in by the user.
00212 
00213        For performance reasons, SubmitBlockEntry() does minimal processing of data.  Any processing that can be
00214        delayed is performed in EndSubmitEntries().
00215 
00216     \param In
00217            Values - The starting address of the values.
00218     \param In
00219            LDA - The stride between successive columns of Values.
00220     \param In
00221            NumRows - The number of rows passed in.
00222     \param In
00223            NumCols - The number of columns passed in.
00224 
00225     \return Integer error code, set to 0 if successful.
00226     */
00227     int SubmitBlockEntry(double *Values, int LDA, int NumRows, int NumCols);
00228 
00230 
00235     int EndSubmitEntries();
00236 
00237     int GlobalAssemble(bool callFillComplete=true);
00238 
00239  private:
00240     int SetupForNonlocalSubmits(int BlockRow,
00241         int NumBlockEntries,
00242         int * BlockIndices, 
00243         bool IndicesAreLocal,
00244         Epetra_CombineMode SubmitMode);
00245 
00246     int InputNonlocalBlockEntry(double *Values, int LDA,
00247         int NumRows, int NumCols);
00248 
00249     int InsertNonlocalRow(int row, int offset, int numCols);
00250 
00251     void destroyNonlocalData();
00252 
00253     bool ignoreNonLocalEntries_;
00254 
00255     int numNonlocalBlockRows_;
00256     int* nonlocalBlockRows_;
00257     int* nonlocalBlockRowLengths_;
00258     int* nonlocalBlockRowAllocLengths_;
00259     int** nonlocalBlockCols_;
00260 
00261     //Triple-pointers are gross, but we need one here. We want a 2-D table of
00262     //pointer-to-matrix objects. If we only use a double-pointer, it would be
00263     //too hard to change the lengths of the rows of the table.
00264 
00265     Epetra_SerialDenseMatrix*** nonlocalCoefs_;
00266 
00267     //Following the approach Mike uses in Epetra_VbrMatrix, we need some state
00268     //variables to keep track of block-entry submits.
00269     int curRowOffset_;
00270     int curColOffset_;
00271     int curNumCols_;
00272     int* curCols_;
00273     int curMode_;
00274 };
00275 
00276 #endif /* EPETRA_FEVBRMATRIX_H */

Generated on Thu Sep 18 12:37:57 2008 for Epetra Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1