NAMD
InfoStream.C
Go to the documentation of this file.
1 
7 /*
8  Defines a new stream: iout, for "i"nforming consoles.
9 */
10 
11 #include "InfoStream.h"
12 #include "charm++.h"
13 #include "Vector.h"
14 #include "Tensor.h"
15 #include <stdio.h>
16 
17 CkpvExtern(infostream, iout_obj);
18 
20  return CkpvAccess(iout_obj);
21 }
22 
24 
26 
27 /* output using CkPrintf() (end by inform) */
29  *this << std::ends;
30  std::string infostr = str();
31  CkPrintf("%s",infostr.c_str());
32 #ifndef NAMD_NO_STDOUT_FLUSH
33  fflush(stdout); // since CkPrintf doesn't always flush
34 #endif
35  str("");
36 }
37 
38 infostream& endi(infostream& s) { s.endi(); return s; }
39 
40 std::ostream& iPE(std::ostream& s) {
41  return s << "Pe(" << CkMyPe() << ')';
42 }
43 
44 std::ostream& operator<<(std::ostream& strm, const Vector &v1) {
45  strm << v1.x << " " << v1.y << " " << v1.z;
46  return strm;
47 }
48 
49 infostream& operator<<(infostream& strm, const Vector &v1) {
50  strm << v1.x << " " << v1.y << " " << v1.z;
51  return strm;
52 }
53 
54 
55 std::ostream& operator<<(std::ostream& strm, const Tensor &t1) {
56  strm << t1.xx << " " << t1.xy << " " << t1.xz << " "
57  << t1.yx << " " << t1.yy << " " << t1.yz << " "
58  << t1.zx << " " << t1.zy << " " << t1.zz;
59  return strm;
60 }
61 
62 infostream& operator<<(infostream& strm, const Tensor &t1) {
63  strm << t1.xx << " " << t1.xy << " " << t1.xz << " "
64  << t1.yx << " " << t1.yy << " " << t1.yz << " "
65  << t1.zx << " " << t1.zy << " " << t1.zz;
66  return strm;
67 }
68 
69 /* define how to use the remaining << args */
71 infostream& infostream::operator<<(std::ostream& (*f)(std::ostream&)) { f(*this); return(*this); }
74 
75 #define LOCALMOD(type) infostream& infostream::operator<<(type x) \
76  { (std::ostream&)(*this) << x; return(*this); }
77 
78 LOCALMOD(char)
79 LOCALMOD(unsigned char)
80 LOCALMOD(const char *)
82 LOCALMOD(int)
83 LOCALMOD(long)
84 LOCALMOD(short)
85 LOCALMOD(unsigned int)
86 LOCALMOD(unsigned long)
87 LOCALMOD(unsigned short)
88 #ifdef _MSC_VER
89 LOCALMOD(__int64)
90 LOCALMOD(unsigned __int64)
91 #else
92 LOCALMOD(long long);
93 LOCALMOD(unsigned long long);
94 #endif
95 
96 LOCALMOD(float)
97 LOCALMOD(double)
99 LOCALMOD(void *)
100 LOCALMOD(std::streambuf *)
101 #undef LOCALMOD
102 
107 std::ostream& iINFO (std::ostream& s) { return s << "Info: "; }
108 std::ostream& iWARN (std::ostream& s) { return s << "Warning: "; }
109 std::ostream& iERROR(std::ostream& s) { return s << "ERROR: "; }
110 std::ostream& iDEBUG(std::ostream& s) { return s << "DEBUG: "; }
111 
112 
BigReal zy
Definition: Tensor.h:19
std::ostream & iINFO(std::ostream &s)
Definition: InfoStream.C:107
BigReal xz
Definition: Tensor.h:17
Definition: Vector.h:64
std::ostream & iPE(std::ostream &s)
Definition: InfoStream.C:40
BigReal z
Definition: Vector.h:66
BigReal yz
Definition: Tensor.h:18
std::ostream & iWARN(std::ostream &s)
Definition: InfoStream.C:108
CkpvExtern(infostream, iout_obj)
datastream & operator<<(datastream &strm, const Vector &v1)
Definition: DataStream.C:25
std::ostream & iDEBUG(std::ostream &s)
Definition: InfoStream.C:110
BigReal yx
Definition: Tensor.h:18
#define LOCALMOD(type)
Definition: DataStream.h:30
void endi()
Definition: InfoStream.C:28
BigReal x
Definition: Vector.h:66
static infostream & access_iout_obj()
Definition: InfoStream.C:19
BigReal xx
Definition: Tensor.h:17
infostream & operator<<(std::ostream &(*f)(std::ostream &))
Definition: InfoStream.C:71
BigReal zz
Definition: Tensor.h:19
Definition: Tensor.h:15
BigReal xy
Definition: Tensor.h:17
BigReal y
Definition: Vector.h:66
BigReal yy
Definition: Tensor.h:18
std::ostream & iERROR(std::ostream &s)
Definition: InfoStream.C:109
infostream & endi(infostream &s)
Definition: InfoStream.C:38
BigReal zx
Definition: Tensor.h:19