Select Git revision
GmshMessage.h 7.12 KiB
// Gmsh - Copyright (C) 1997-2019 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
#ifndef _GMSH_MESSAGE_H_
#define _GMSH_MESSAGE_H_
#include <map>
#include <vector>
#include <string>
#include <stdarg.h>
#include "GmshConfig.h"
class GmshClient;
namespace onelab {
class client;
}
// the external message handler
class GmshMessage {
public:
GmshMessage() {}
virtual ~GmshMessage() {}
virtual void operator()(std::string level, std::string message) {}
};
// a class to manage messages
class Msg {
private:
// current cpu number and total number of cpus
static int _commRank, _commSize;
// verbosity level (0: silent except fatal errors, 1: +errors, 2: +warnings,
// 3: +direct, 4: +info, 5 (=normal): +statusbar, 99: debug)
static int _verbosity;
// step (in %) of the progress meter and current progress %
static int _progressMeterStep, _progressMeterCurrent;
// timers
static std::map<std::string, double> _timers;
// report cpu time for each info message?
static bool _infoCpu;
// starting time (gettimeofday at startup)
static double _startTime;
// counters
static int _warningCount, _errorCount, _atLeastOneErrorInRun;
static std::string _firstWarning, _firstError;
// callback
static GmshMessage *_callback;
// command-line and startup time
static std::string _commandLine, _launchDate;
// command-line-specified numbers and strings
static std::map<std::string, std::vector<double> > _commandLineNumbers;
static std::map<std::string, std::string> _commandLineStrings;
// communication with Gmsh when run remotely
static GmshClient *_client;
#if defined(HAVE_ONELAB)
// communication with onelab server
static onelab::client *_onelabClient;
#endif
// executable name
static std::string _execName;
// log file
static std::string _logFileName;
static FILE *_logFile;
public:
Msg() {}
static void Init(int argc, char **argv);
static void Exit(int level);