Epetra Package Browser (Single Doxygen Collection) Development
Epetra_FECrsMatrix.h
Go to the documentation of this file.
00001 /*
00002 //@HEADER
00003 // ************************************************************************
00004 // 
00005 //               Epetra: Linear Algebra Services Package 
00006 //                 Copyright 2001 Sandia Corporation
00007 // 
00008 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00009 // the U.S. Government retains certain rights in this software.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00039 // 
00040 // ************************************************************************
00041 //@HEADER
00042 */
00043 
00044 #ifndef EPETRA_FECRSMATRIX_H
00045 #define EPETRA_FECRSMATRIX_H
00046 
00047 #include <Epetra_CrsMatrix.h>
00048 class Epetra_Map;
00049 class Epetra_IntSerialDenseVector;
00050 class Epetra_SerialDenseMatrix;
00051 class Epetra_FECrsGraph;
00052 
00110 class EPETRA_LIB_DLL_EXPORT Epetra_FECrsMatrix : public Epetra_CrsMatrix {
00111   public:
00113    Epetra_FECrsMatrix(Epetra_DataAccess CV,
00114           const Epetra_Map& RowMap,
00115           int* NumEntriesPerRow,
00116           bool ignoreNonLocalEntries=false);
00117 
00119    Epetra_FECrsMatrix(Epetra_DataAccess CV,
00120           const Epetra_Map& RowMap,
00121           int NumEntriesPerRow,
00122           bool ignoreNonLocalEntries=false);
00123 
00125    Epetra_FECrsMatrix(Epetra_DataAccess CV,
00126           const Epetra_Map& RowMap,
00127           const Epetra_Map& ColMap,
00128           int* NumEntriesPerRow,
00129           bool ignoreNonLocalEntries=false);
00130 
00132    Epetra_FECrsMatrix(Epetra_DataAccess CV,
00133           const Epetra_Map& RowMap,
00134           const Epetra_Map& ColMap,
00135           int NumEntriesPerRow,
00136           bool ignoreNonLocalEntries=false);
00137 
00139    Epetra_FECrsMatrix(Epetra_DataAccess CV,
00140           const Epetra_CrsGraph& Graph,
00141           bool ignoreNonLocalEntries=false);
00142 
00144    Epetra_FECrsMatrix(Epetra_DataAccess CV,
00145          const Epetra_FECrsGraph& Graph,
00146          bool ignoreNonLocalEntries=false);
00147 
00149    Epetra_FECrsMatrix(const Epetra_FECrsMatrix& src);
00150 
00152    virtual ~Epetra_FECrsMatrix();
00153 
00155    Epetra_FECrsMatrix& operator=(const Epetra_FECrsMatrix& src);
00156 
00157    enum { ROW_MAJOR = 0, COLUMN_MAJOR = 3 };
00158 
00159    using Epetra_CrsMatrix::SumIntoGlobalValues;
00160    using Epetra_CrsMatrix::InsertGlobalValues;
00161    using Epetra_CrsMatrix::ReplaceGlobalValues;
00162 
00164    int SumIntoGlobalValues(int GlobalRow, int NumEntries,
00165                            const double* Values, const int* Indices);
00166 
00168    int InsertGlobalValues(int GlobalRow, int NumEntries,
00169                            const double* Values, const int* Indices);
00170 
00172    int ReplaceGlobalValues(int GlobalRow, int NumEntries,
00173                            const double* Values, const int* Indices);
00174 
00190    int SumIntoGlobalValues(int numIndices, const int* indices,
00191                            const double* values,
00192                            int format=Epetra_FECrsMatrix::COLUMN_MAJOR);
00193 
00210    int SumIntoGlobalValues(int numRows, const int* rows,
00211                            int numCols, const int* cols,
00212                            const double* values,
00213                            int format=Epetra_FECrsMatrix::COLUMN_MAJOR);
00214 
00229    int SumIntoGlobalValues(int numIndices, const int* indices,
00230                            const double* const* values,
00231                            int format=Epetra_FECrsMatrix::ROW_MAJOR);
00232 
00248    int SumIntoGlobalValues(int numRows, const int* rows,
00249                      int numCols, const int* cols,
00250                            const double* const* values,
00251                            int format=Epetra_FECrsMatrix::ROW_MAJOR);
00252 
00267    int InsertGlobalValues(int numIndices, const int* indices,
00268                            const double* values,
00269                            int format=Epetra_FECrsMatrix::COLUMN_MAJOR);
00270 
00286    int InsertGlobalValues(int numRows, const int* rows,
00287                            int numCols, const int* cols,
00288                            const double* values,
00289                            int format=Epetra_FECrsMatrix::COLUMN_MAJOR);
00290 
00304    int InsertGlobalValues(int numIndices, const int* indices,
00305                            const double* const* values,
00306                            int format=Epetra_FECrsMatrix::ROW_MAJOR);
00307 
00322    int InsertGlobalValues(int numRows, const int* rows,
00323                      int numCols, const int* cols,
00324                            const double* const* values,
00325                            int format=Epetra_FECrsMatrix::ROW_MAJOR);
00326 
00342    int ReplaceGlobalValues(int numIndices, const int* indices,
00343                            const double* values,
00344                            int format=Epetra_FECrsMatrix::COLUMN_MAJOR);
00345 
00363    int ReplaceGlobalValues(int numRows, const int* rows,
00364                            int numCols, const int* cols,
00365                            const double* values,
00366                            int format=Epetra_FECrsMatrix::COLUMN_MAJOR);
00367 
00382    int ReplaceGlobalValues(int numIndices, const int* indices,
00383                            const double* const* values,
00384                            int format=Epetra_FECrsMatrix::ROW_MAJOR);
00385 
00401    int ReplaceGlobalValues(int numRows, const int* rows,
00402                            int numCols, const int* cols,
00403                            const double* const* values,
00404                            int format=Epetra_FECrsMatrix::ROW_MAJOR);
00405 
00416    int SumIntoGlobalValues(const Epetra_IntSerialDenseVector& indices,
00417          const Epetra_SerialDenseMatrix& values,
00418          int format=Epetra_FECrsMatrix::COLUMN_MAJOR);
00419 
00434    int SumIntoGlobalValues(const Epetra_IntSerialDenseVector& rows,
00435          const Epetra_IntSerialDenseVector& cols,
00436          const Epetra_SerialDenseMatrix& values,
00437          int format=Epetra_FECrsMatrix::COLUMN_MAJOR);
00438 
00449    int InsertGlobalValues(const Epetra_IntSerialDenseVector& indices,
00450          const Epetra_SerialDenseMatrix& values,
00451          int format=Epetra_FECrsMatrix::COLUMN_MAJOR);
00452 
00467    int InsertGlobalValues(const Epetra_IntSerialDenseVector& rows,
00468          const Epetra_IntSerialDenseVector& cols,
00469          const Epetra_SerialDenseMatrix& values,
00470          int format=Epetra_FECrsMatrix::COLUMN_MAJOR);
00471 
00483    int ReplaceGlobalValues(const Epetra_IntSerialDenseVector& indices,
00484          const Epetra_SerialDenseMatrix& values,
00485          int format=Epetra_FECrsMatrix::COLUMN_MAJOR);
00486 
00501    int ReplaceGlobalValues(const Epetra_IntSerialDenseVector& rows,
00502          const Epetra_IntSerialDenseVector& cols,
00503          const Epetra_SerialDenseMatrix& values,
00504          int format=Epetra_FECrsMatrix::COLUMN_MAJOR);
00505 
00527    int GlobalAssemble(bool callFillComplete=true);
00528 
00554    int GlobalAssemble(const Epetra_Map& domain_map,
00555                       const Epetra_Map& range_map,
00556                       bool callFillComplete=true);
00557 
00561    void setIgnoreNonLocalEntries(bool flag) {
00562      ignoreNonLocalEntries_ = flag;
00563    }
00564 
00565   private:
00566    void DeleteMemory();
00567 
00568    enum {SUMINTO = 0, REPLACE = 1, INSERT = 2};
00569 
00570    int InputGlobalValues(int numRows, const int* rows,
00571                          int numCols, const int* cols,
00572                          const double* const* values,
00573                          int format,
00574                          int mode);
00575 
00576    int InputGlobalValues(int numRows, const int* rows,
00577                          int numCols, const int* cols,
00578                          const double* values,
00579                          int format,
00580                          int mode);
00581 
00582    int InputNonlocalGlobalValues(int row,
00583          int numCols, const int* cols,
00584          const double* values,
00585          int mode);
00586 
00587    int InsertNonlocalRow(int row, int offset);
00588 
00589    int InputNonlocalValue(int rowoffset,
00590         int col, double value,
00591         int mode);
00592 
00593    int myFirstRow_;
00594    int myNumRows_;
00595 
00596    bool ignoreNonLocalEntries_;
00597 
00598    int numNonlocalRows_;
00599    int* nonlocalRows_;
00600    int* nonlocalRowLengths_;
00601    int* nonlocalRowAllocLengths_;
00602    int** nonlocalCols_;
00603    double** nonlocalCoefs_;
00604 
00605    double* workData_;
00606    int workDataLength_;
00607 
00608    bool useNonlocalMatrix_;
00609    Epetra_CrsMatrix* nonlocalMatrix_;
00610 };//class Epetra_FECrsMatrix
00611 
00612 #endif /* EPETRA_FECRSMATRIX_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines