MFEM v2.0
|
00001 // Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at 00002 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights 00003 // reserved. See file COPYRIGHT for details. 00004 // 00005 // This file is part of the MFEM library. For more information and source code 00006 // availability see http://mfem.googlecode.com. 00007 // 00008 // MFEM is free software; you can redistribute it and/or modify it under the 00009 // terms of the GNU Lesser General Public License (as published by the Free 00010 // Software Foundation) version 2.1 dated February 1999. 00011 00012 // Implementation of class matrix 00013 00014 #include <iostream> 00015 #include <iomanip> 00016 00017 #include "matrix.hpp" 00018 00019 void Matrix::Print (ostream & out, int width) const 00020 { 00021 // output flags = scientific + show sign 00022 out << setiosflags(ios::scientific | ios::showpos); 00023 for (int i = 0; i < size; i++) 00024 { 00025 out << "[row " << i << "]\n"; 00026 for (int j = 0; j < size; j++) 00027 { 00028 out << Elem(i,j) << " "; 00029 if ( !((j+1) % width) ) 00030 out << endl; 00031 } 00032 out << endl; 00033 } 00034 out << endl; 00035 }