-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only print mid-timestep estDt outputs if relevant
- Loading branch information
Showing
3 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,32 @@ | ||
#ifndef CASTRO_IO_H | ||
#define CASTRO_IO_H | ||
|
||
#include <iostream> | ||
#include <sstream> | ||
|
||
extern std::string inputs_name; | ||
|
||
// Redirect std::cout to a temporary buffer. | ||
|
||
class CoutRedirection { | ||
|
||
public: | ||
CoutRedirection () : original_output(std::cout.rdbuf()) { | ||
std::cout.rdbuf(captured_output.rdbuf()); | ||
} | ||
|
||
~CoutRedirection () { | ||
std::cout.rdbuf(original_output); | ||
} | ||
|
||
std::string getCapturedOutput () { | ||
return captured_output.str(); | ||
} | ||
|
||
private: | ||
std::ostringstream captured_output; | ||
std::streambuf* original_output; | ||
|
||
}; | ||
|
||
#endif |