25
24
extern Context_T CTX;
29
26
int main(int argc, char *argv[])
34
std::string currtime(ctime(&now));
35
currtime[currtime.size() - 1] = '\0';
37
for(int i = 0; i < argc; i++){
42
31
// Hack to generate automatic documentation (before getting
43
32
// user-defined options)
44
33
if(argc == 2 && std::string(argv[1]) == "-doc"){
46
35
GMSH_PluginManager::instance()->registerDefaultPlugins();
47
GModel *dummy = new GModel;
48
36
Print_OptionsDoc();
53
40
// Initialize static stuff (parser symbols, options)
54
41
GmshInitialize(argc, argv);
56
// Always print info on terminal for non-interactive execution
57
if(CTX.batch) CTX.terminal = 1;
62
43
// Non-interactive Gmsh
64
Msg::Info("'%s' started on %s", cmdline.c_str(), currtime.c_str());
71
CTX.batch = -1; // The GUI is not ready yet for interactivity
74
WID = new GUI(argc, argv);
52
GUI::instance(argc, argv);
76
54
// Set all previously defined options in the GUI
77
55
Init_Options_GUI(0);
83
58
Msg::StatusBar(1, false, "Geometry");
84
59
Msg::StatusBar(2, false, "Gmsh %s", Get_GmshVersion());
91
66
Msg::Info("Build date : %s", Get_GmshBuildDate());
92
67
Msg::Info("Build host : %s", Get_GmshBuildHost());
93
68
Msg::Info("Packager : %s", Get_GmshPackager());
94
Msg::Info("Home directory : %s", CTX.home_dir);
95
Msg::Info("Launch date : %s", currtime.c_str());
96
Msg::Info("Command line : %s", cmdline.c_str());
69
Msg::Info("Home directory : %s", CTX.home_dir.c_str());
70
Msg::Info("Launch date : %s", Msg::GetLaunchDate().c_str());
71
Msg::Info("Command line : %s", Msg::GetCommandLine().c_str());
97
72
Msg::Info("-------------------------------------------------------");
99
74
// Display the GUI immediately to have a quick "a la Windows" launch time
75
GUI::instance()->check();
102
77
// Open project file and merge all other input files
103
OpenProject(CTX.filename);
78
OpenProject(GModel::current()->getFileName());
104
79
for(unsigned int i = 1; i < CTX.files.size(); i++){
105
if(CTX.files[i] == "-new")
80
if(CTX.files[i] == "-new"){
81
GModel::current()->setVisibility(0);
108
MergeFile(CTX.files[i].c_str());
85
MergeFile(CTX.files[i]);
111
88
if(CTX.post.combine_time){
112
89
PView::combine(true, 2, CTX.post.combine_remove_orig);
90
GUI::instance()->updateViews();
116
93
// Init first context
117
94
switch (CTX.initial_context) {
118
case 1: WID->set_context(menu_geometry, 0); break;
119
case 2: WID->set_context(menu_mesh, 0); break;
120
case 3: WID->set_context(menu_solver, 0); break;
121
case 4: WID->set_context(menu_post, 0); break;
95
case 1: GUI::instance()->menu->setContext(menu_geometry, 0); break;
96
case 2: GUI::instance()->menu->setContext(menu_mesh, 0); break;
97
case 3: GUI::instance()->menu->setContext(menu_solver, 0); break;
98
case 4: GUI::instance()->menu->setContext(menu_post, 0); break;
122
99
default: // automatic
123
100
if(PView::list.size())
124
WID->set_context(menu_post, 0);
101
GUI::instance()->menu->setContext(menu_post, 0);
126
WID->set_context(menu_geometry, 0);
103
GUI::instance()->menu->setContext(menu_geometry, 0);
130
// Read background mesh on disk
131
if(CTX.bgm_filename) {
107
// Read background mesh if any
108
if(!CTX.bgm_filename.empty()) {
132
109
MergeFile(CTX.bgm_filename);
133
110
if(PView::list.size())
134
111
GModel::current()->getFields()->set_background_mesh(PView::list.size() - 1);