Proto  3.2
Proto_Parstream.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _PARSTREAM_H_
12 #define _PARSTREAM_H_
13 
14 #include <iostream>
15 #include <iomanip>
16 #include <string>
17 #include <cstdio>
18 #include <fstream>
19 #include "Proto_SPMD.H"
20 namespace Proto
21 {
22 using std::setprecision;
23 using std::setiosflags;
24 using std::endl;
25 using std::ios;
26 
27 /// Use this in place of std::cout for program output.
28 /**
29  * Replaces std::cout in most of the Chombo code. In serial this just
30  * returns std::cout. In parallel, this creates a separate file for each
31  * proc called <basename>.n where n is the procID and <basename> defaults to
32  * "pout" but can be set by calling setPoutBaseName(). Output is then
33  * directed to these files. This keeps the output from different processors
34  * from getting all jumbled up.
35  If you want fewer files, you can do
36  setenv CH_OUTPUT_INTERVAL nproc
37  and it will only output every nproc processors pout.n files
38  (where n%nproc == 0).
39 */
40 inline std::ostream& pr_out();
41 
42 /// Changes the base part of the filename for pr_out() files.
43 /**
44  * When in parallel, changes the base name of the pr_out() files. If pr_out()
45  * has already been called, it closes the current output file and opens a
46  * new one (unless the name is the same, in which case it does nothing).
47  * In serial, ignores the argument and does nothing.
48 */
49 inline void setPoutBaseName(const std::string & a_Name);
50 
51 /// Accesses the filename for the local pr_out() file.
52 /**
53  * Returns the name used for the local pr_out() file. In parallel this is
54  * "<pout_basename>.<procID>", where <pout_basename> defaults to "pout" and
55  * can be modified by calling setPoutBaseName(), and <procID> is the local
56  * proc number. In serial, this always returns the string "cout". It is an
57  * error (exit code 111) to call this in parallel before MPI_Initialize().
58 */
59 inline const std::string & poutFileName();
60 
61 }
62 #endif // _PARSTREAM_H_
void setPoutBaseName(const std::string &a_Name)
Changes the base part of the filename for pr_out() files.
std::ostream & pr_out()
Use this in place of std::cout for program output.
Definition: Proto_Array.H:17
const std::string & poutFileName()
Accesses the filename for the local pr_out() file.