File: global.cpp

package info (click to toggle)
netgen 6.2.2601%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,076 kB
  • sloc: cpp: 166,627; tcl: 6,310; python: 2,868; sh: 528; makefile: 90
file content (104 lines) | stat: -rw-r--r-- 2,019 bytes parent folder | download | duplicates (3)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#include <mystdlib.h>
#include "global.hpp"
#include <netgen_version.hpp>
#include "msghandler.hpp"
#include "meshtype.hpp"

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; }
  };
  
  // stringstream emptystr;
  // ostream * testout = &emptystr;
  // testout -> clear(ios::failbit);

  // ostream * testout = &cout;

  // NetgenOutStream * testout = new NetgenOutStream;

  const string netgen_version = NETGEN_VERSION;

  ostream * mycout = &cout;
  ostream * myerr = &cerr;

  // some functions (visualization) still need a global mesh
  // TraceGlobal glob1("global1");
  DLL_HEADER shared_ptr<Mesh> mesh;
  DLL_HEADER shared_ptr<NetgenGeometry> ng_geometry;
  // TraceGlobal glob2("global2");

  // global communicator for netgen
  // DLL_HEADER NgMPI_Comm ng_comm;
  
  weak_ptr<Mesh> global_mesh;
  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;
  
  //  Flags parameters;
  int silentflag = 0;
  int testmode = 0;


  string ngdir = ".";

  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;
  void ResetTime ()
  {
    starttimea = WallTime();
  }

  double GetTime ()
  {
    return WallTime() - starttimea;
  }



  mutex tcl_todo_mutex;

  int h_argc = 0;
  char ** h_argv = NULL;

  DebugParameters debugparam;
  bool verbose = 0;

  size_t timestamp = 0;
  /*
  int GetTimeStamp() 
  { 
    return timestamp; 
  }

  int NextTimeStamp()
  {
    timestamp++;
    return timestamp;
  }
  */
}