Commit 451dbb44 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

added pde logger

parent d3f9370c
......@@ -10,47 +10,43 @@ private:
int verbose = 0;
public:
string default_indent = " ";
string defaultIndent = " ";
string indent = "";
string inner_indent = default_indent;
string innerIndent = defaultIndent;
MultilevelMonteCarloLogger() {
config.get("MLMCVerbose", verbose);
}
void increase_indent() {
indent += default_indent;
inner_indent += default_indent;
void IncreaseIndent() {
indent += defaultIndent;
innerIndent += defaultIndent;
}
void decrease_indent() {
int pos = indent.rfind(default_indent);
void DecreaseIndent() {
int pos = indent.rfind(defaultIndent);
if (pos != -1) {
indent.erase(pos, -3);
inner_indent.erase(pos, -3);
innerIndent.erase(pos, -3);
}
}
virtual string name() {
return "MLMC";
}
virtual void startMethodMSG() {
virtual void StartMethodMsg() {
Date start;
timestamp = start;
vout (1) << indent << "<Start MLMC method>" << endl;
}
virtual void endMethodMSG() {
virtual void EndMethodMsg() {
vout (1) << indent << "<End after " << Date() - timestamp << ">" << endl;
}
virtual void logMSGV1(string msg) {
vout(1) << inner_indent << msg << endl;
virtual void LogMsgv1(const string &msg) {
vout(1) << innerIndent << msg << endl;
}
virtual void logMSGV2(string msg) {
vout(2) << inner_indent << msg << endl;
virtual void LogMsgv2(const string &msg) {
vout(2) << innerIndent << msg << endl;
}
};
......@@ -62,26 +58,65 @@ private:
public:
MonteCarloLogger() : MultilevelMonteCarloLogger() {
ReadConfig(Settings, "MCVerbose", verbose);
indent += default_indent;
inner_indent += default_indent;
indent += defaultIndent;
innerIndent += defaultIndent;
}
void startMethodMSG() override {
void StartMethodMsg() override {
Date start;
timestamp = start;
vout (1) << indent << "<Start MC method>" << endl;
}
void endMethodMSG() override {
void EndMethodMsg() override {
vout (1) << indent << "<End after " << Date() - timestamp << ">" << endl;
}
void logMSGV1(string msg) override {
vout(1) << inner_indent << msg << endl;
void LogMsgv1(const string &msg) override {
vout(1) << innerIndent << msg << endl;
}
void LogMsgv2(const string &msg) override {
vout(2) << innerIndent << msg << endl;
}
};
class PDELogger : public MonteCarloLogger {
private:
Date timestamp;
int verbose = 0;
public:
PDELogger() : MonteCarloLogger() {
ReadConfig(Settings, "PDEVerbose", verbose);
indent += defaultIndent;
innerIndent += defaultIndent;
}
void StartMethodMsg() override {
Date start;
timestamp = start;
vout (1) << indent << "<Start solving PDE>" << endl;
}
void EndMethodMsg() override {
vout (1) << indent << "<End after " << Date() - timestamp << ">" << endl;
}
void LogMsgv1(const string &msg) override {
vout(1) << innerIndent << msg << endl;
}
void LogMsgv2(const string &msg) override {
vout(2) << innerIndent << msg << endl;
}
void LogMsgv1Flush(const string &msg) {
vout(1) << "\r" << innerIndent << msg << flush;
}
void logMSGV2(string msg) override {
vout(2) << inner_indent << msg << endl;
void LogMsgv2Flush(const string &msg) {
vout(2) << "\r" << innerIndent << msg << flush;
}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment