Skip to content

Commit cfe0f71

Browse files
authored
Merge pull request #4103 from lindsayad/dont-put-print-in-src
2 parents aa6fc71 + fdd8f85 commit cfe0f71

2 files changed

Lines changed: 26 additions & 28 deletions

File tree

include/numerics/type_vector.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#include <cstdlib> // *must* precede <cmath> for proper std:abs() on PGI, Sun Studio CC
3232
#include <cmath>
3333
#include <complex>
34+
#include <iostream>
35+
#include <iomanip> // for std::setw, std::setiosflags
3436

3537
namespace libMesh
3638
{
@@ -1100,6 +1102,30 @@ TypeVector<T> TypeVector<T>::unit() const
11001102

11011103
}
11021104

1105+
template <typename T>
1106+
void TypeVector<T>::print(std::ostream & os) const
1107+
{
1108+
#if LIBMESH_DIM == 1
1109+
1110+
os << "x=" << (*this)(0);
1111+
1112+
#endif
1113+
#if LIBMESH_DIM == 2
1114+
1115+
os << "(x,y)=("
1116+
<< std::setw(8) << (*this)(0) << ", "
1117+
<< std::setw(8) << (*this)(1) << ")";
1118+
1119+
#endif
1120+
#if LIBMESH_DIM == 3
1121+
1122+
os << "(x,y,z)=("
1123+
<< std::setw(8) << (*this)(0) << ", "
1124+
<< std::setw(8) << (*this)(1) << ", "
1125+
<< std::setw(8) << (*this)(2) << ")";
1126+
#endif
1127+
}
1128+
11031129
template <typename T>
11041130
struct CompareTypes<TypeVector<T>, TypeVector<T>>
11051131
{

src/numerics/type_vector.C

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
#include "libmesh/type_vector.h"
2323

2424
// C++ includes
25-
#include <iostream>
26-
#include <iomanip> // for std::setw, std::setiosflags
2725
#include <type_traits> // std::is_trivially_copyable
2826

2927

@@ -43,32 +41,6 @@ namespace libMesh
4341

4442
// ------------------------------------------------------------
4543
// TypeVector<T> class member functions
46-
template <typename T>
47-
void TypeVector<T>::print(std::ostream & os) const
48-
{
49-
#if LIBMESH_DIM == 1
50-
51-
os << "x=" << (*this)(0);
52-
53-
#endif
54-
#if LIBMESH_DIM == 2
55-
56-
os << "(x,y)=("
57-
<< std::setw(8) << (*this)(0) << ", "
58-
<< std::setw(8) << (*this)(1) << ")";
59-
60-
#endif
61-
#if LIBMESH_DIM == 3
62-
63-
os << "(x,y,z)=("
64-
<< std::setw(8) << (*this)(0) << ", "
65-
<< std::setw(8) << (*this)(1) << ", "
66-
<< std::setw(8) << (*this)(2) << ")";
67-
#endif
68-
}
69-
70-
71-
7244

7345

7446
template <typename T>

0 commit comments

Comments
 (0)