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 #include "ifp_DenseMat.h" 00030 /* Epetra_fmtflags typedef no longer used */ 00031 /*#include "Epetra_Object.h" // Bring in Epetra_fmtflags typedef */ 00032 00033 ifp_DenseMat::ifp_DenseMat(const ifp_DenseMat& A) 00034 { 00035 nrow = A.nrow; 00036 ncol = A.ncol; 00037 register double *p = a = new double[nrow*ncol]; 00038 register double *q = A.a; 00039 for (int i=0; i<nrow*ncol; i++) 00040 *p++ = *q++; 00041 } 00042 00043 void ifp_DenseMat::Print(ostream& os) const 00044 { 00045 // check not an implicit inverse 00046 assert (a != NULL); 00047 00048 /* Epetra_fmtflags olda = os.setf(ios::right,ios::adjustfield); 00049 Epetra_fmtflags oldf = os.setf(ios::scientific,ios::floatfield); 00050 int oldp = os.precision(12); */ 00051 00052 const double *p = a; 00053 for (int j=0; j<numcol(); j++) 00054 for (int i=0; i<numrow(); i++) 00055 os << i+1 << " " << j+1 << " " << *p++ << endl; 00056 00057 /* os.setf(olda,ios::adjustfield); 00058 os.setf(oldf,ios::floatfield); 00059 os.precision(oldp); */ 00060 } 00061 00062 // non-member functions 00063 00064 ostream& operator << (ostream& os, const ifp_DenseMat& mat) 00065 { 00066 // should check not an implicit inverse 00067 00068 /* Epetra_fmtflags olda = os.setf(ios::right,ios::adjustfield); 00069 Epetra_fmtflags oldf = os.setf(ios::scientific,ios::floatfield); 00070 int oldp = os.precision(12); */ 00071 00072 const double *a = &mat(0,0); 00073 for (int j=0; j<mat.numcol(); j++) 00074 for (int i=0; i<mat.numrow(); i++) 00075 os << i+1 << " " << j+1 << " " << *a++ << endl; 00076 00077 /* os.setf(olda,ios::adjustfield); 00078 os.setf(oldf,ios::floatfield); 00079 os.precision(oldp); */ 00080 return os; 00081 }
1.3.9.1