$extrastylesheet
dense_vector_base.C
Go to the documentation of this file.
00001 // The libMesh Finite Element Library.
00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
00003 
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2.1 of the License, or (at your option) any later version.
00008 
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Lesser General Public License for more details.
00013 
00014 // You should have received a copy of the GNU Lesser General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018 // C++ includes
00019 #include <iostream>
00020 #include <iomanip> // for std::setw
00021 
00022 
00023 // Local Includes
00024 #include "libmesh/dense_vector_base.h"
00025 
00026 namespace libMesh
00027 {
00028 
00029 template<typename T>
00030 void DenseVectorBase<T>::print_scientific (std::ostream& os) const
00031 {
00032 #ifndef LIBMESH_BROKEN_IOSTREAM
00033 
00034   // save the initial format flags
00035   std::ios_base::fmtflags os_flags = os.flags();
00036 
00037   // Print the vector entries.
00038   for (unsigned int i=0; i<this->size(); i++)
00039     os << std::setw(10)
00040        << std::scientific
00041        << std::setprecision(8)
00042        << this->el(i)
00043        << std::endl;
00044 
00045   // reset the original format flags
00046   os.flags(os_flags);
00047 
00048 #else
00049 
00050   // Print the matrix entries.
00051   for (unsigned int i=0; i<this->size(); i++)
00052     os << std::setprecision(8)
00053        << this->el(i)
00054        << std::endl;
00055 
00056 #endif
00057 }
00058 
00059 
00060 
00061 template<typename T>
00062 void DenseVectorBase<T>::print (std::ostream& os) const
00063 {
00064   for (unsigned int i=0; i<this->size(); i++)
00065     os << std::setw(8)
00066        << this->el(i)
00067        << std::endl;
00068 }
00069 
00070 
00071 //--------------------------------------------------------------
00072 // Explicit instantiations
00073 template class DenseVectorBase<Real>;
00074 
00075 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
00076 template class DenseVectorBase<Complex>;
00077 #endif
00078 
00079 } // namespace libMesh