37
35
Msg::Init(argc, argv);
39
37
// Load default options
42
40
// Read configuration files and command line options
43
Get_Options(argc, argv);
41
GetOptions(argc, argv);
45
43
// Make sure we have enough resources (stack)
48
46
#if !defined(HAVE_NO_POST)
49
47
// Initialize the default plugins
50
GMSH_PluginManager::instance()->registerDefaultPlugins();
48
PluginManager::instance()->registerDefaultPlugins();
53
// Initialize numeric library (gsl, robust predicates)
51
// Initialize robust predicates
56
54
if(dummy) delete dummy;
66
64
int GmshSetOption(std::string category, std::string name, std::string value, int index)
68
if(StringOption(GMSH_SET, category.c_str(), index, name.c_str(), value.c_str()))
66
if(StringOption(GMSH_SET, category.c_str(), index, name.c_str(), value))
93
91
Msg::Info("Started on %s", Msg::GetLaunchDate().c_str());
95
93
OpenProject(GModel::current()->getFileName());
96
for(unsigned int i = 1; i < CTX.files.size(); i++){
97
if(CTX.files[i] == "-new")
94
for(unsigned int i = 1; i < CTX::instance()->files.size(); i++){
95
if(CTX::instance()->files[i] == "-new")
100
MergeFile(CTX.files[i]);
98
MergeFile(CTX::instance()->files[i]);
103
101
#if !defined(HAVE_NO_POST)
104
if(!CTX.bgm_filename.empty()) {
105
MergeFile(CTX.bgm_filename);
102
if(!CTX::instance()->bgmFileName.empty()) {
103
MergeFile(CTX::instance()->bgmFileName);
106
104
if(PView::list.size())
107
GModel::current()->getFields()->set_background_mesh(PView::list.size() - 1);
105
GModel::current()->getFields()->setBackgroundMesh(PView::list.size() - 1);
109
107
Msg::Error("Invalid background mesh (no view)");
114
GmshDaemon(CTX.solver.socket_name);
116
else if(CTX.batch == -2){
117
GModel::current()->checkMeshCoherence(CTX.geom.tolerance);
119
else if(CTX.batch == -1){
120
CreateOutputFile(CTX.output_filename, FORMAT_GEO);
122
else if(CTX.batch > 0){
124
GModel::current()->mesh(CTX.batch);
125
else if(CTX.batch == 4)
111
if(CTX::instance()->batch == -3){
112
GmshDaemon(CTX::instance()->solver.socketName);
114
else if(CTX::instance()->batch == -2){
115
GModel::current()->checkMeshCoherence(CTX::instance()->geom.tolerance);
117
else if(CTX::instance()->batch == -1){
118
CreateOutputFile(CTX::instance()->outputFileName, FORMAT_GEO);
120
else if(CTX::instance()->batch > 0){
121
if(CTX::instance()->batch < 4)
122
GModel::current()->mesh(CTX::instance()->batch);
123
else if(CTX::instance()->batch == 4)
126
124
AdaptMesh(GModel::current());
127
else if(CTX.batch == 5)
128
RefineMesh(GModel::current(), CTX.mesh.second_order_linear);
125
else if(CTX::instance()->batch == 5)
126
RefineMesh(GModel::current(), CTX::instance()->mesh.secondOrderLinear);
129
127
#if defined(HAVE_CHACO) || defined(HAVE_METIS)
130
if(CTX.batch_after_mesh == 1)
131
PartitionMesh(GModel::current(), CTX.mesh.partition_options);
128
if(CTX::instance()->batchAfterMesh == 1)
129
PartitionMesh(GModel::current(), CTX::instance()->partitionOptions);
133
CreateOutputFile(CTX.output_filename, CTX.mesh.format);
131
CreateOutputFile(CTX::instance()->outputFileName, CTX::instance()->mesh.format);