forked from sanshar/Block
-
Notifications
You must be signed in to change notification settings - Fork 1
/
pario.h
58 lines (46 loc) · 1.43 KB
/
pario.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef PARIO_HEADER_H
#define PARIO_HEADER_H
#include <communicate.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include "global.h"
#ifdef MOLPRO
#include "global/CxOutputStream.h"
#endif
using namespace std;
using namespace SpinAdapted;
#define pout if (mpigetrank() == 0 && dmrginp.outputlevel() >= 0) bout
#define perr if (mpigetrank() == 0 && dmrginp.outputlevel() >= 0) berr
#define p1out if (mpigetrank() == 0 && dmrginp.outputlevel() >= 1) bout
#define p1err if (mpigetrank() == 0 && dmrginp.outputlevel() >= 1) berr
#define p2out if (mpigetrank() == 0 && dmrginp.outputlevel() >= 2) bout
#define p2err if (mpigetrank() == 0 && dmrginp.outputlevel() >= 2) berr
#define p3out if (mpigetrank() == 0 && dmrginp.outputlevel() >= 3) bout
#define p3err if (mpigetrank() == 0 && dmrginp.outputlevel() >= 3) berr
extern ostream &bout, &berr;
class blockout {
public:
ostream *outstream;
char* output;
blockout(ostream *outstream_ = &cout, char* output_=0): outstream(outstream_),output(output_)
{
if(output!=0) {
ofstream file(output);
outstream->rdbuf(file.rdbuf());
}
}
};
class blockerr {
public:
ostream *errstream;
char* output;
blockerr(ostream *errstream_ = &cerr, char* output_=0):errstream(errstream_), output(output_)
{
if(output!=0) {
ofstream file(output);
errstream->rdbuf(file.rdbuf());
}
}
};
#endif