Line data Source code
1 : // The libMesh Finite Element Library. 2 : // Copyright (C) 2002-2025 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 3 : 4 : // This library is free software; you can redistribute it and/or 5 : // modify it under the terms of the GNU Lesser General Public 6 : // License as published by the Free Software Foundation; either 7 : // version 2.1 of the License, or (at your option) any later version. 8 : 9 : // This library is distributed in the hope that it will be useful, 10 : // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 : // Lesser General Public License for more details. 13 : 14 : // You should have received a copy of the GNU Lesser General Public 15 : // License along with this library; if not, write to the Free Software 16 : // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 : 18 : // C++ includes 19 : #include <iostream> 20 : #include <iomanip> // for std::setw 21 : 22 : 23 : // Local Includes 24 : #include "libmesh/dense_vector_base.h" 25 : #include "libmesh/int_range.h" 26 : 27 : namespace libMesh 28 : { 29 : 30 : template<typename T> 31 0 : void DenseVectorBase<T>::print_scientific (std::ostream & os, unsigned precision) const 32 : { 33 : // save the initial format flags 34 0 : std::ios_base::fmtflags os_flags = os.flags(); 35 : 36 : // Print the vector entries. 37 0 : for (auto i : make_range(this->size())) 38 0 : os << std::setw(10) 39 0 : << std::scientific 40 0 : << std::setprecision(precision) 41 0 : << this->el(i) 42 0 : << std::endl; 43 : 44 : // reset the original format flags 45 0 : os.flags(os_flags); 46 0 : } 47 : 48 : 49 : //-------------------------------------------------------------- 50 : // Explicit instantiations 51 : template class LIBMESH_EXPORT DenseVectorBase<Real>; 52 : 53 : #ifdef LIBMESH_USE_COMPLEX_NUMBERS 54 : template class LIBMESH_EXPORT DenseVectorBase<Complex>; 55 : #endif 56 : 57 : } // namespace libMesh