netgen/libsrc/meshing/global.cpp

118 lines
2.2 KiB
C++
Raw Normal View History

2009-01-13 04:40:13 +05:00
#include <mystdlib.h>
#include "global.hpp"
#include <netgen_version.hpp>
#include "msghandler.hpp"
#include "meshtype.hpp"
2009-01-18 22:36:38 +05:00
2009-01-13 04:40:13 +05:00
namespace netgen
{
class NetgenGeometry;
class TraceGlobal
{
string name;
public:
TraceGlobal(string _name) : name(_name) { cout << "init global " << name << endl; }
~TraceGlobal() { cout << "exit global " << name << endl; }
};
2009-01-18 22:36:38 +05:00
// stringstream emptystr;
// ostream * testout = &emptystr;
// testout -> clear(ios::failbit);
// ostream * testout = &cout;
// NetgenOutStream * testout = new NetgenOutStream;
2009-01-13 04:40:13 +05:00
const string netgen_version = NETGEN_VERSION;
2009-01-13 04:40:13 +05:00
ostream * mycout = &cout;
ostream * myerr = &cerr;
// some functions (visualization) still need a global mesh
// TraceGlobal glob1("global1");
2015-10-19 13:08:30 +05:00
DLL_HEADER shared_ptr<Mesh> mesh;
DLL_HEADER shared_ptr<NetgenGeometry> ng_geometry;
// TraceGlobal glob2("global2");
2009-01-13 04:40:13 +05:00
// global communicator for netgen
2019-02-13 02:11:55 +05:00
// DLL_HEADER NgMPI_Comm ng_comm;
2015-01-09 02:18:33 +05:00
weak_ptr<Mesh> global_mesh;
2015-12-22 00:21:24 +05:00
void SetGlobalMesh (shared_ptr<Mesh> m)
{
PrintMessage(5, "set global mesh");
global_mesh = m;
}
// true if netgen was started using the netgen executable
// false if netgen.gui was imported from python
DLL_HEADER bool netgen_executable_started = false;
2015-12-22 00:21:24 +05:00
2011-01-11 01:18:01 +05:00
// Flags parameters;
2009-01-13 04:40:13 +05:00
int silentflag = 0;
int testmode = 0;
volatile multithreadt multithread;
string ngdir = ".";
2014-08-30 06:15:59 +06:00
void Ng_PrintDest(const char * s)
{
if (id == 0)
(*mycout) << s << flush;
}
DLL_HEADER void MyError(const char * ch)
{
cout << ch;
(*testout) << "Error !!! " << ch << endl << flush;
}
static double starttimea;
2014-08-30 06:15:59 +06:00
void ResetTime ()
{
starttimea = WallTime();
2014-08-30 06:15:59 +06:00
}
double GetTime ()
{
return WallTime() - starttimea;
2014-08-30 06:15:59 +06:00
}
2016-02-22 22:43:51 +05:00
mutex tcl_todo_mutex;
2012-07-06 13:49:05 +06:00
int h_argc = 0;
char ** h_argv = NULL;
2009-01-13 04:40:13 +05:00
multithreadt :: multithreadt()
{
pause =0;
testmode = 0;
redraw = 0;
drawing = 0;
terminate = 0;
running = 0;
percent = 0;
task = "";
}
DebugParameters debugparam;
bool verbose = 0;
2017-04-11 13:45:11 +05:00
size_t timestamp = 0;
/*
2009-01-13 04:40:13 +05:00
int GetTimeStamp()
{
return timestamp;
}
int NextTimeStamp()
{
timestamp++;
return timestamp;
}
2017-04-11 13:45:11 +05:00
*/
2009-01-13 04:40:13 +05:00
}