libMesh
Loading...
Searching...
No Matches
dense_vector_base.C
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 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
27namespace libMesh
28{
29
30template<typename T>
31void DenseVectorBase<T>::print_scientific (std::ostream & os, unsigned precision) const
32{
33 // save the initial format flags
34 std::ios_base::fmtflags os_flags = os.flags();
35
36 // Print the vector entries.
37 for (auto i : make_range(this->size()))
38 os << std::setw(10)
39 << std::scientific
40 << std::setprecision(precision)
41 << this->el(i)
42 << std::endl;
43
44 // reset the original format flags
45 os.flags(os_flags);
46}
47
48
49//--------------------------------------------------------------
50// Explicit instantiations
51template class LIBMESH_EXPORT DenseVectorBase<Real>;
52
53#ifdef LIBMESH_USE_COMPLEX_NUMBERS
54template class LIBMESH_EXPORT DenseVectorBase<Complex>;
55#endif
56
57} // namespace libMesh
Defines an abstract dense vector base class for use in Finite Element-type computations.
void print_scientific(std::ostream &os, unsigned precision=8) const
Prints the entries of the vector with additional decimal places in scientific notation.
The libMesh namespace provides an interface to certain functionality in the library.
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition int_range.h:176