Ifpack_Graph_Epetra_RowMatrix.cpp

00001 /*@HEADER
00002 // ***********************************************************************
00003 //
00004 //       Ifpack: Object-Oriented Algebraic Preconditioner Package
00005 //                 Copyright (2002) Sandia Corporation
00006 //
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 //
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00025 //
00026 // ***********************************************************************
00027 //@HEADER
00028 */
00029 
00030 #include "Ifpack_ConfigDefs.h"
00031 #include "Ifpack_Graph.h"
00032 #include "Ifpack_Graph_Epetra_RowMatrix.h"
00033 #include "Epetra_Comm.h"
00034 #include "Epetra_Map.h"
00035 #include "Epetra_RowMatrix.h"
00036 
00037 //==============================================================================
00038 Ifpack_Graph_Epetra_RowMatrix::Ifpack_Graph_Epetra_RowMatrix(const Teuchos::RefCountPtr<const Epetra_RowMatrix>& RowMatrix) :
00039 RowMatrix_(RowMatrix)
00040 {
00041   NumMyRows_ = RowMatrix_->NumMyRows();
00042   NumMyCols_ = RowMatrix_->NumMyCols();
00043   NumGlobalRows_ = RowMatrix_->NumGlobalRows();
00044   NumGlobalCols_ = RowMatrix_->NumGlobalCols();
00045   MaxNumIndices_ = RowMatrix_->MaxNumEntries();
00046 
00047   Values_.resize(MaxNumIndices_);
00048 }
00049 
00050 //==============================================================================
00051 const Epetra_Comm& Ifpack_Graph_Epetra_RowMatrix::Comm() const
00052 {
00053   return(RowMatrix_->Comm());
00054 }
00055 
00056 //==============================================================================
00057 bool Ifpack_Graph_Epetra_RowMatrix::Filled() const
00058 {
00059   return(RowMatrix_->Filled());
00060 }
00061  
00062 //==============================================================================
00063 int Ifpack_Graph_Epetra_RowMatrix::GRID(int LRID_in) const
00064 {
00065   return(RowMatrix_->RowMatrixRowMap().GID(LRID_in));
00066 }
00067 
00068 //==============================================================================
00069 int Ifpack_Graph_Epetra_RowMatrix::GCID(int LCID_in) const
00070 {
00071   return(RowMatrix_->RowMatrixColMap().GID(LCID_in));
00072 }
00073 
00074 //==============================================================================
00075 int Ifpack_Graph_Epetra_RowMatrix::LRID(int GRID_in) const
00076 {
00077   return(RowMatrix_->RowMatrixRowMap().LID(GRID_in));
00078 }
00079 
00080 //==============================================================================
00081 int Ifpack_Graph_Epetra_RowMatrix::LCID(int GCID_in) const
00082 {
00083   return(RowMatrix_->RowMatrixColMap().LID(GCID_in));
00084 }
00085 
00086 //==============================================================================
00087 int Ifpack_Graph_Epetra_RowMatrix::
00088 ExtractMyRowCopy(int MyRow, int LenOfIndices, 
00089          int &NumIndices, int *Indices) const
00090 {
00091   return(RowMatrix_->ExtractMyRowCopy(MyRow, LenOfIndices,
00092                       NumIndices, &Values_[0],
00093                       Indices));
00094 }
00095 
00096 //==============================================================================
00097 int Ifpack_Graph_Epetra_RowMatrix::NumMyNonzeros() const
00098 {
00099   return(RowMatrix_->NumMyNonzeros());
00100 }
00101 
00102 // ======================================================================
00103 ostream& Ifpack_Graph_Epetra_RowMatrix::Print(std::ostream& os) const
00104 {
00105 
00106   if (Comm().MyPID())
00107     return(os);
00108 
00109   os << "================================================================================" << endl;
00110   os << "Ifpack_Graph_Epetra_RowMatrix" << endl;
00111   os << "Number of local rows  = " << NumMyRows_ << endl;
00112   os << "Number of global rows = " << NumGlobalRows_ << endl;
00113   os << "================================================================================" << endl;
00114 
00115   return(os);
00116 
00117 }
00118 

Generated on Wed May 12 21:30:18 2010 for IFPACK by  doxygen 1.4.7