1 // Gmsh - Copyright (C) 1997-2021 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5
6 #include <string.h>
7 #include <stdlib.h>
8 #include <stdio.h>
9 #include <limits>
10 #include "GmshConfig.h"
11 #include "GmshVersion.h"
12 #include "GmshDefines.h"
13 #include "GmshMessage.h"
14 #include "StringUtils.h"
15 #include "GModel.h"
16 #include "Context.h"
17 #include "Options.h"
18 #include "OS.h"
19 #include "Colors.h"
20 #include "CommandLine.h"
21 #include "GamePad.h"
22 #include "DefaultOptions.h"
23
24 #if defined(HAVE_MESH)
25 #include "Generator.h"
26 #include "Field.h"
27 #include "BackgroundMesh.h"
28 #endif
29
30 #if defined(HAVE_PARSER)
31 #include "Parser.h"
32 #endif
33
34 #if defined(HAVE_POST)
35 #include "PView.h"
36 #include "PViewOptions.h"
37 #include "PViewData.h"
38 #include "adaptiveData.h"
39 #endif
40
41 #if defined(HAVE_PLUGINS)
42 #include "PluginManager.h"
43 #include "Plugin.h"
44 #endif
45
46 #if defined(HAVE_FLTK)
47 #include <FL/Fl_Tooltip.H>
48 #include "FlGui.h"
49 #include "drawContextFltk.h"
50 #include "graphicWindow.h"
51 #include "optionWindow.h"
52 #include "manipWindow.h"
53 #include "contextWindow.h"
54 #include "clippingWindow.h"
55 #include "onelabGroup.h"
56 #include "viewButton.h"
57 #include "drawContextFltkCairo.h"
58 #include "drawContextFltkStringTexture.h"
59 #endif
60
61 // General routines for string options
62
StringOption(int action,const char * category,int num,const char * name,std::string & val,bool warnIfUnknown)63 bool StringOption(int action, const char *category, int num, const char *name,
64 std::string &val, bool warnIfUnknown)
65 {
66 StringXString *s = nullptr;
67 if(!strcmp(category, "General"))
68 s = GeneralOptions_String;
69 else if(!strcmp(category, "Geometry"))
70 s = GeometryOptions_String;
71 else if(!strcmp(category, "Mesh"))
72 s = MeshOptions_String;
73 else if(!strcmp(category, "Solver"))
74 s = SolverOptions_String;
75 else if(!strcmp(category, "PostProcessing"))
76 s = PostProcessingOptions_String;
77 else if(!strcmp(category, "View"))
78 s = ViewOptions_String;
79 else if(!strcmp(category, "Print"))
80 s = PrintOptions_String;
81 else {
82 if(warnIfUnknown)
83 Msg::Error("Unknown string option category '%s'", category);
84 return false;
85 }
86
87 int i = 0;
88 while(s[i].str && strcmp(s[i].str, name)) i++;
89 if(!s[i].str) {
90 if(warnIfUnknown)
91 Msg::Error("Unknown string option '%s.%s'", category, name);
92 return false;
93 }
94
95 if(action & GMSH_GET_DEFAULT)
96 val = s[i].def;
97 else if(action & GMSH_SET_DEFAULT)
98 val = s[i].function(num, action | GMSH_SET, s[i].def);
99 else
100 val = s[i].function(num, action, val);
101 return true;
102 }
103
SetDefaultStringOptions(int num,StringXString s[])104 static void SetDefaultStringOptions(int num, StringXString s[])
105 {
106 int i = 0;
107 while(s[i].str) {
108 s[i].function(num, GMSH_SET_DEFAULT | GMSH_SET, s[i].def);
109 i++;
110 }
111 }
112
SetStringOptionsGUI(int num,StringXString s[])113 static void SetStringOptionsGUI(int num, StringXString s[])
114 {
115 int i = 0;
116 while(s[i].str) {
117 s[i].function(num, GMSH_GUI, "");
118 i++;
119 }
120 }
121
PrintStringOptions(int num,int level,int diff,int help,StringXString s[],const char * prefix,FILE * file,std::vector<std::string> * vec=nullptr)122 static void PrintStringOptions(int num, int level, int diff, int help,
123 StringXString s[], const char *prefix,
124 FILE *file, std::vector<std::string> *vec = nullptr)
125 {
126 int i = 0;
127 while(s[i].str) {
128 if((s[i].level & level) && !(s[i].level & GMSH_DEPRECATED)) {
129 if(!diff || s[i].function(num, GMSH_GET, "") != s[i].def) {
130 char tmp[1024];
131 sprintf(tmp, "%s%s = \"%s\";%s%s", prefix, s[i].str,
132 s[i].function(num, GMSH_GET, "").c_str(), help ? " // " : "",
133 help ? s[i].help : "");
134 if(file)
135 fprintf(file, "%s\n", tmp);
136 else {
137 // remove \n, \t, \r
138 for(std::size_t i = 0; i < strlen(tmp); i++)
139 if(tmp[i] == '\n' || tmp[i] == '\t' || tmp[i] == '\r') tmp[i] = ' ';
140 if(vec)
141 vec->push_back(std::string(tmp) + '\0' + "string");
142 else
143 Msg::Direct("%s", tmp);
144 }
145 }
146 }
147 i++;
148 }
149 }
150
GetOptionSaveLevel(int level)151 static const char *GetOptionSaveLevel(int level)
152 {
153 if(level & GMSH_SESSIONRC) { return "General.SessionFileName"; }
154 else if(level & GMSH_OPTIONSRC) {
155 return "General.OptionsFileName";
156 }
157 else {
158 return "-";
159 }
160 }
161
PrintStringOptionsDoc(StringXString s[],const char * prefix,FILE * file)162 static void PrintStringOptionsDoc(StringXString s[], const char *prefix,
163 FILE *file)
164 {
165 int i = 0;
166 while(s[i].str) {
167 if(!(s[i].level & GMSH_DEPRECATED)) {
168 fprintf(file, "@item %s%s\n", prefix, s[i].str);
169 fprintf(file, "%s@*\n", s[i].help);
170
171 // sanitize the string for texinfo
172 std::string val = s[i].function(0, GMSH_GET, "");
173 for(std::size_t j = 1; j < val.size(); j++) {
174 if(val[j] == '\n' && val[j - 1] == '\n') val[j - 1] = '.';
175 }
176 fprintf(file, "Default value: @code{\"%s\"}@*\n", val.c_str());
177 fprintf(file, "Saved in: @code{%s}\n\n", GetOptionSaveLevel(s[i].level));
178 }
179 i++;
180 }
181 }
182
183 // General routines for numeric options
184
NumberOption(int action,const char * category,int num,const char * name,double & val,bool warnIfUnknown)185 bool NumberOption(int action, const char *category, int num, const char *name,
186 double &val, bool warnIfUnknown)
187 {
188 StringXNumber *s = nullptr;
189 if(!strcmp(category, "General"))
190 s = GeneralOptions_Number;
191 else if(!strcmp(category, "Geometry"))
192 s = GeometryOptions_Number;
193 else if(!strcmp(category, "Mesh"))
194 s = MeshOptions_Number;
195 else if(!strcmp(category, "Solver"))
196 s = SolverOptions_Number;
197 else if(!strcmp(category, "PostProcessing"))
198 s = PostProcessingOptions_Number;
199 else if(!strcmp(category, "View"))
200 s = ViewOptions_Number;
201 else if(!strcmp(category, "Print"))
202 s = PrintOptions_Number;
203 else {
204 if(warnIfUnknown)
205 Msg::Error("Unknown number option category '%s'", category);
206 return false;
207 }
208
209 int i = 0;
210 while(s[i].str && strcmp(s[i].str, name)) i++;
211 if(!s[i].str) {
212 if(warnIfUnknown)
213 Msg::Error("Unknown number option '%s.%s'", category, name);
214 return false;
215 }
216
217 if(action & GMSH_GET_DEFAULT)
218 val = s[i].def;
219 else if(action & GMSH_SET_DEFAULT)
220 val = s[i].function(num, action | GMSH_SET, s[i].def);
221 else
222 val = s[i].function(num, action, val);
223
224 return true;
225 }
226
SetDefaultNumberOptions(int num,StringXNumber s[])227 static void SetDefaultNumberOptions(int num, StringXNumber s[])
228 {
229 int i = 0;
230 while(s[i].str) {
231 s[i].function(num, GMSH_SET_DEFAULT | GMSH_SET, s[i].def);
232 i++;
233 }
234 }
235
SetNumberOptionsGUI(int num,StringXNumber s[])236 static void SetNumberOptionsGUI(int num, StringXNumber s[])
237 {
238 int i = 0;
239 while(s[i].str) {
240 s[i].function(num, GMSH_GUI, 0);
241 i++;
242 }
243 }
244
PrintNumberOptions(int num,int level,int diff,int help,StringXNumber s[],const char * prefix,FILE * file,std::vector<std::string> * vec=nullptr)245 static void PrintNumberOptions(int num, int level, int diff, int help,
246 StringXNumber s[], const char *prefix,
247 FILE *file, std::vector<std::string> *vec = nullptr)
248 {
249 int i = 0;
250 char tmp[1024];
251 while(s[i].str) {
252 if((s[i].level & level) && !(s[i].level & GMSH_DEPRECATED)) {
253 if(!diff || (s[i].function(num, GMSH_GET, 0) != s[i].def)) {
254 sprintf(tmp, "%s%s = %.16g;%s%s", prefix, s[i].str,
255 s[i].function(num, GMSH_GET, 0), help ? " // " : "",
256 help ? s[i].help : "");
257 if(file)
258 fprintf(file, "%s\n", tmp);
259 else if(vec)
260 vec->push_back(std::string(tmp) + '\0' + "number");
261 else
262 Msg::Direct(tmp);
263 }
264 }
265 i++;
266 }
267 }
268
PrintNumberOptionsDoc(StringXNumber s[],const char * prefix,FILE * file)269 static void PrintNumberOptionsDoc(StringXNumber s[], const char *prefix,
270 FILE *file)
271 {
272 int i = 0;
273 while(s[i].str) {
274 if(!(s[i].level & GMSH_DEPRECATED)) {
275 fprintf(file, "@item %s%s\n", prefix, s[i].str);
276 fprintf(file, "%s@*\n", s[i].help);
277 fprintf(file, "Default value: @code{%g}@*\n",
278 s[i].function(0, GMSH_GET, 0));
279 fprintf(file, "Saved in: @code{%s}\n\n", GetOptionSaveLevel(s[i].level));
280 }
281 i++;
282 }
283 }
284
285 // General routines for color options
286
ColorOption(int action,const char * category,int num,const char * name,unsigned int & val,bool warnIfUnknown)287 bool ColorOption(int action, const char *category, int num, const char *name,
288 unsigned int &val, bool warnIfUnknown)
289 {
290 StringXColor *s = nullptr;
291 if(!strcmp(category, "General"))
292 s = GeneralOptions_Color;
293 else if(!strcmp(category, "Geometry"))
294 s = GeometryOptions_Color;
295 else if(!strcmp(category, "Mesh"))
296 s = MeshOptions_Color;
297 else if(!strcmp(category, "Solver"))
298 s = SolverOptions_Color;
299 else if(!strcmp(category, "PostProcessing"))
300 s = PostProcessingOptions_Color;
301 else if(!strcmp(category, "View"))
302 s = ViewOptions_Color;
303 else if(!strcmp(category, "Print"))
304 s = PrintOptions_Color;
305 else {
306 if(warnIfUnknown)
307 Msg::Error("Unknown color option category '%s'", category);
308 return false;
309 }
310
311 int i = 0;
312 while(s[i].str && strcmp(s[i].str, name)) i++;
313 if(!s[i].str) {
314 if(warnIfUnknown)
315 Msg::Error("Unknown color option '%s.%s'", category, name);
316 return false;
317 }
318
319 if(action & GMSH_GET_DEFAULT)
320 val = CTX::instance()->packColor(s[i].def1[0], s[i].def1[1], s[i].def1[2],
321 s[i].def1[3]);
322 else if(action & GMSH_SET_DEFAULT)
323 val = s[i].function(num, action | GMSH_SET,
324 CTX::instance()->packColor(s[i].def1[0], s[i].def1[1],
325 s[i].def1[2], s[i].def1[3]));
326 else
327 val = s[i].function(num, action, val);
328 return true;
329 }
330
GetColorForString(int alpha,const char * str,int * FlagError)331 int GetColorForString(int alpha, const char *str, int *FlagError)
332 {
333 int i = 0;
334 while(ColorString[i].str && strcmp(ColorString[i].str, str)) i++;
335 *FlagError = !ColorString[i].str ? 1 : 0;
336 if(alpha > 0)
337 return CTX::instance()->packColor(ColorString[i].int1, ColorString[i].int2,
338 ColorString[i].int3, alpha);
339 else
340 return CTX::instance()->packColor(ColorString[i].int1, ColorString[i].int2,
341 ColorString[i].int3, ColorString[i].int4);
342 }
343
GetRGBForString(const char * str,int & r,int & g,int & b)344 bool GetRGBForString(const char *str, int &r, int &g, int &b)
345 {
346 int i = 0;
347 while(ColorString[i].str && strcmp(ColorString[i].str, str)) i++;
348 if(!ColorString[i].str) {
349 r = g = b = 0;
350 return false;
351 }
352 r = ColorString[i].int1;
353 g = ColorString[i].int2;
354 b = ColorString[i].int3;
355 return true;
356 }
357
SetDefaultColorOptions(int num,StringXColor s[])358 static void SetDefaultColorOptions(int num, StringXColor s[])
359 {
360 int i = 0;
361 // Warning: this assumes that CTX::instance()->color_scheme is set...
362 switch(CTX::instance()->colorScheme) {
363 case 1:
364 while(s[i].str) {
365 s[i].function(num, GMSH_SET_DEFAULT | GMSH_SET,
366 CTX::instance()->packColor(s[i].def2[0], s[i].def2[1],
367 s[i].def2[2], s[i].def2[3]));
368 i++;
369 }
370 break;
371 case 2:
372 while(s[i].str) {
373 s[i].function(num, GMSH_SET_DEFAULT | GMSH_SET,
374 CTX::instance()->packColor(s[i].def3[0], s[i].def3[1],
375 s[i].def3[2], s[i].def3[3]));
376 i++;
377 }
378 break;
379 case 3:
380 while(s[i].str) {
381 s[i].function(num, GMSH_SET_DEFAULT | GMSH_SET,
382 CTX::instance()->packColor(s[i].def4[0], s[i].def4[1],
383 s[i].def4[2], s[i].def4[3]));
384 i++;
385 }
386 break;
387 default:
388 while(s[i].str) {
389 s[i].function(num, GMSH_SET_DEFAULT | GMSH_SET,
390 CTX::instance()->packColor(s[i].def1[0], s[i].def1[1],
391 s[i].def1[2], s[i].def1[3]));
392 i++;
393 }
394 break;
395 }
396 }
397
SetColorOptionsGUI(int num,StringXColor s[])398 static void SetColorOptionsGUI(int num, StringXColor s[])
399 {
400 int i = 0;
401 while(s[i].str) {
402 s[i].function(num, GMSH_GUI, 0);
403 i++;
404 }
405 }
406
PrintColorOptions(int num,int level,int diff,int help,StringXColor s[],const char * prefix,FILE * file,std::vector<std::string> * vec)407 static void PrintColorOptions(int num, int level, int diff, int help,
408 StringXColor s[], const char *prefix, FILE *file,
409 std::vector<std::string> *vec)
410 {
411 int i = 0;
412 char tmp[1024];
413 while(s[i].str) {
414 if((s[i].level & level) && !(s[i].level & GMSH_DEPRECATED)) {
415 unsigned int def;
416 switch(CTX::instance()->colorScheme) {
417 case 1:
418 def = CTX::instance()->packColor(s[i].def2[0], s[i].def2[1],
419 s[i].def2[2], s[i].def2[3]);
420 break;
421 case 2:
422 def = CTX::instance()->packColor(s[i].def3[0], s[i].def3[1],
423 s[i].def3[2], s[i].def3[3]);
424 break;
425 case 3:
426 def = CTX::instance()->packColor(s[i].def4[0], s[i].def4[1],
427 s[i].def4[2], s[i].def4[3]);
428 break;
429 default:
430 def = CTX::instance()->packColor(s[i].def1[0], s[i].def1[1],
431 s[i].def1[2], s[i].def1[3]);
432 break;
433 }
434 if(!diff || (s[i].function(num, GMSH_GET, 0) != def)) {
435 sprintf(tmp, "%sColor.%s = {%d,%d,%d};%s%s", prefix, s[i].str,
436 CTX::instance()->unpackRed(s[i].function(num, GMSH_GET, 0)),
437 CTX::instance()->unpackGreen(s[i].function(num, GMSH_GET, 0)),
438 CTX::instance()->unpackBlue(s[i].function(num, GMSH_GET, 0)),
439 help ? " // " : "", help ? s[i].help : "");
440 if(file)
441 fprintf(file, "%s\n", tmp);
442 else if(vec)
443 vec->push_back(std::string(tmp) + '\0' + "color");
444 else
445 Msg::Direct(tmp);
446 }
447 }
448 i++;
449 }
450 }
451
PrintColorOptionsDoc(StringXColor s[],const char * prefix,FILE * file)452 static void PrintColorOptionsDoc(StringXColor s[], const char *prefix,
453 FILE *file)
454 {
455 int i = 0;
456 while(s[i].str) {
457 if(!(s[i].level & GMSH_DEPRECATED)) {
458 fprintf(file, "@item %sColor.%s\n", prefix, s[i].str);
459 fprintf(file, "%s@*\n", s[i].help);
460 fprintf(file, "Default value: @code{@{%d,%d,%d@}}@*\n",
461 CTX::instance()->unpackRed(s[i].function(0, GMSH_GET, 0)),
462 CTX::instance()->unpackGreen(s[i].function(0, GMSH_GET, 0)),
463 CTX::instance()->unpackBlue(s[i].function(0, GMSH_GET, 0)));
464 fprintf(file, "Saved in: @code{%s}\n\n", GetOptionSaveLevel(s[i].level));
465 }
466 i++;
467 }
468 }
469
470 // General routines
471
InitOptions(int num)472 void InitOptions(int num)
473 {
474 CTX::instance()->init();
475
476 // Default string options
477 SetDefaultStringOptions(num, GeneralOptions_String);
478 SetDefaultStringOptions(num, GeometryOptions_String);
479 SetDefaultStringOptions(num, MeshOptions_String);
480 SetDefaultStringOptions(num, SolverOptions_String);
481 SetDefaultStringOptions(num, PostProcessingOptions_String);
482 SetDefaultStringOptions(num, ViewOptions_String);
483 SetDefaultStringOptions(num, PrintOptions_String);
484
485 // Default number options
486 SetDefaultNumberOptions(num, GeneralOptions_Number);
487 SetDefaultNumberOptions(num, GeometryOptions_Number);
488 SetDefaultNumberOptions(num, MeshOptions_Number);
489 SetDefaultNumberOptions(num, SolverOptions_Number);
490 SetDefaultNumberOptions(num, PostProcessingOptions_Number);
491 SetDefaultNumberOptions(num, ViewOptions_Number);
492 SetDefaultNumberOptions(num, PrintOptions_Number);
493
494 // Default color options
495 SetDefaultColorOptions(num, GeneralOptions_Color);
496 SetDefaultColorOptions(num, GeometryOptions_Color);
497 SetDefaultColorOptions(num, MeshOptions_Color);
498 SetDefaultColorOptions(num, SolverOptions_Color);
499 SetDefaultColorOptions(num, PostProcessingOptions_Color);
500 SetDefaultColorOptions(num, ViewOptions_Color);
501 SetDefaultColorOptions(num, PrintOptions_Color);
502 }
503
ReInitOptions(int num)504 void ReInitOptions(int num)
505 {
506 // horrible trick so that opt_view_XXX will act on the reference view
507 #if defined(HAVE_POST)
508 std::vector<PView *> tmp = PView::list;
509 PView::list.clear();
510 #endif
511
512 InitOptions(num);
513
514 #if defined(HAVE_POST)
515 PView::list = tmp;
516 for(std::size_t i = 0; i < PView::list.size(); i++)
517 PView::list[i]->setOptions();
518 #endif
519 }
520
InitOptionsGUI(int num)521 void InitOptionsGUI(int num)
522 {
523 SetStringOptionsGUI(num, GeneralOptions_String);
524 SetStringOptionsGUI(num, GeometryOptions_String);
525 SetStringOptionsGUI(num, MeshOptions_String);
526 SetStringOptionsGUI(num, SolverOptions_String);
527 SetStringOptionsGUI(num, PostProcessingOptions_String);
528 SetStringOptionsGUI(num, PrintOptions_String);
529
530 SetNumberOptionsGUI(num, GeneralOptions_Number);
531 SetNumberOptionsGUI(num, GeometryOptions_Number);
532 SetNumberOptionsGUI(num, MeshOptions_Number);
533 SetNumberOptionsGUI(num, SolverOptions_Number);
534 SetNumberOptionsGUI(num, PostProcessingOptions_Number);
535 SetNumberOptionsGUI(num, PrintOptions_Number);
536
537 SetColorOptionsGUI(num, GeneralOptions_Color);
538 SetColorOptionsGUI(num, GeometryOptions_Color);
539 SetColorOptionsGUI(num, MeshOptions_Color);
540 SetColorOptionsGUI(num, SolverOptions_Color);
541 SetColorOptionsGUI(num, PostProcessingOptions_Color);
542 SetColorOptionsGUI(num, PrintOptions_Color);
543 }
544
PrintOptionCategory(int level,int diff,int help,const char * cat,FILE * file,std::vector<std::string> * vec=nullptr)545 static void PrintOptionCategory(int level, int diff, int help, const char *cat,
546 FILE *file, std::vector<std::string> *vec = nullptr)
547 {
548 if(diff || !help || !(level & GMSH_FULLRC)) return;
549 if(file) {
550 fprintf(file, "//\n");
551 fprintf(file, "// %s\n", cat);
552 fprintf(file, "//\n");
553 }
554 else if(vec) {
555 vec->push_back("//");
556 vec->push_back(std::string("// ") + cat);
557 vec->push_back("//");
558 }
559 else {
560 Msg::Direct("//");
561 Msg::Direct("// %s", cat);
562 Msg::Direct("//");
563 }
564 }
565
GetColorTable(int num)566 GmshColorTable *GetColorTable(int num)
567 {
568 #if defined(HAVE_POST)
569 PViewOptions *opt;
570 if(PView::list.empty() || num < 0 || num > (int)PView::list.size() - 1)
571 opt = PViewOptions::reference();
572 else {
573 opt = PView::list[num]->getOptions();
574 // assume that if we access the colortable we will change it
575 PView::list[num]->setChanged(true);
576 }
577 return &opt->colorTable;
578 #else
579 return 0;
580 #endif
581 }
582
PrintColorTable(int num,int diff,const char * prefix,FILE * file,std::vector<std::string> * vec)583 static void PrintColorTable(int num, int diff, const char *prefix, FILE *file,
584 std::vector<std::string> *vec)
585 {
586 #if defined(HAVE_POST)
587 PViewOptions *opt;
588 if(PView::list.empty() || num < 0 || num > (int)PView::list.size() - 1)
589 opt = PViewOptions::reference();
590 else
591 opt = PView::list[num]->getOptions();
592
593 if(diff) {
594 // compare the current colormap with a vanilla colormap having the
595 // parameters
596 GmshColorTable ref;
597 ColorTable_InitParam(opt->colorTable.ipar[COLORTABLE_NUMBER], &ref);
598 for(int i = 0; i < COLORTABLE_NBMAX_PARAM; i++) {
599 ref.ipar[i] = opt->colorTable.ipar[i];
600 ref.dpar[i] = opt->colorTable.dpar[i];
601 }
602 ColorTable_Recompute(&ref);
603 if(!ColorTable_Diff(&ref, &opt->colorTable)) return;
604 }
605
606 char tmp[1024];
607 sprintf(tmp, "%s = {", prefix);
608 if(file)
609 fprintf(file, "%s\n", tmp);
610 else if(vec)
611 vec->push_back(tmp);
612 else
613 Msg::Direct(tmp);
614 ColorTable_Print(&opt->colorTable, file, vec);
615 sprintf(tmp, "};");
616 if(file)
617 fprintf(file, "%s\n", tmp);
618 else if(vec)
619 vec->push_back(tmp);
620 else
621 Msg::Direct(tmp);
622 #endif
623 }
624
Sanitize_String_Texi(std::string & s)625 void Sanitize_String_Texi(std::string &s)
626 {
627 int i = -1;
628 while((i = s.find('\n', i + 1)) >= 0) {
629 s.insert(i, "@*");
630 i += 2;
631 }
632 i = -1;
633 while((i = s.find_first_of("{}", i + 1)) >= 0) s.insert(i++, "@");
634 }
635
PrintOptions(int num,int level,int diff,int help,const char * filename,std::vector<std::string> * vec)636 void PrintOptions(int num, int level, int diff, int help, const char *filename,
637 std::vector<std::string> *vec)
638 {
639 #if defined(HAVE_FLTK)
640 if(FlGui::available()) FlGui::instance()->storeCurrentWindowsInfo();
641 #endif
642
643 FILE *file;
644
645 if(filename) {
646 file = Fopen(filename, "w");
647 if(!file) {
648 Msg::Error("Unable to open file '%s'", filename);
649 return;
650 }
651 }
652 else
653 file = nullptr;
654
655 if((level & GMSH_SESSIONRC) && file) {
656 fprintf(file, "// Gmsh Session File\n");
657 fprintf(file, "//\n");
658 fprintf(file,
659 "// This file contains session specific info (that is info you\n");
660 fprintf(
661 file,
662 "// want to keep between two Gmsh sessions). You are not supposed\n");
663 fprintf(
664 file,
665 "// to edit it manually, but of course you can. This file will be\n");
666 fprintf(file,
667 "// entirely rewritten every time you quit Gmsh if the option \n");
668 fprintf(file, "// 'General.SaveSession' is set.\n");
669 fprintf(file, "//\n");
670 }
671
672 if((level & GMSH_OPTIONSRC) && file) {
673 fprintf(file, "// Gmsh Option File\n");
674 fprintf(file, "//\n");
675 fprintf(file,
676 "// This file contains configuration options (preferences) that\n");
677 fprintf(file,
678 "// are loaded each time Gmsh is launched. You can create this\n");
679 fprintf(file, "// file by hand, or let Gmsh generate it for you (with\n");
680 fprintf(file, "// 'File->Save Default Options'). This file can also be\n");
681 fprintf(file,
682 "// automatically saved every time you quit Gmsh if the option\n");
683 fprintf(file, "// 'General.SaveOptions' is set.\n");
684 fprintf(file, "//\n");
685 }
686
687 PrintOptionCategory(level, diff, help, "General options (strings)", file,
688 vec);
689 PrintStringOptions(num, level, diff, help, GeneralOptions_String, "General.",
690 file, vec);
691 PrintOptionCategory(level, diff, help, "General options (numbers)", file,
692 vec);
693 PrintNumberOptions(num, level, diff, help, GeneralOptions_Number, "General.",
694 file, vec);
695 PrintOptionCategory(level, diff, help, "General options (colors)", file, vec);
696 PrintColorOptions(num, level, diff, help, GeneralOptions_Color, "General.",
697 file, vec);
698
699 PrintOptionCategory(level, diff, help, "Geometry options (strings)", file,
700 vec);
701 PrintStringOptions(num, level, diff, help, GeometryOptions_String,
702 "Geometry.", file, vec);
703 PrintOptionCategory(level, diff, help, "Geometry options (numbers)", file,
704 vec);
705 PrintNumberOptions(num, level, diff, help, GeometryOptions_Number,
706 "Geometry.", file, vec);
707 PrintOptionCategory(level, diff, help, "Geometry options (colors)", file,
708 vec);
709 PrintColorOptions(num, level, diff, help, GeometryOptions_Color, "Geometry.",
710 file, vec);
711
712 PrintOptionCategory(level, diff, help, "Mesh options (strings)", file, vec);
713 PrintStringOptions(num, level, diff, help, MeshOptions_String, "Mesh.", file,
714 vec);
715 PrintOptionCategory(level, diff, help, "Mesh options (numbers)", file, vec);
716 PrintNumberOptions(num, level, diff, help, MeshOptions_Number, "Mesh.", file,
717 vec);
718 PrintOptionCategory(level, diff, help, "Mesh options (colors)", file, vec);
719 PrintColorOptions(num, level, diff, help, MeshOptions_Color, "Mesh.", file,
720 vec);
721
722 PrintOptionCategory(level, diff, help, "Solver options (strings)", file, vec);
723 PrintStringOptions(num, level, diff, help, SolverOptions_String, "Solver.",
724 file, vec);
725 PrintOptionCategory(level, diff, help, "Solver options (numbers)", file, vec);
726 PrintNumberOptions(num, level, diff, help, SolverOptions_Number, "Solver.",
727 file, vec);
728 PrintOptionCategory(level, diff, help, "Solver options (colors)", file, vec);
729 PrintColorOptions(num, level, diff, help, SolverOptions_Color, "Solver.",
730 file, vec);
731
732 PrintOptionCategory(level, diff, help, "Post-processing options (strings)",
733 file, vec);
734 PrintStringOptions(num, level, diff, help, PostProcessingOptions_String,
735 "PostProcessing.", file, vec);
736 PrintOptionCategory(level, diff, help, "Post-processing options (numbers)",
737 file, vec);
738 PrintNumberOptions(num, level, diff, help, PostProcessingOptions_Number,
739 "PostProcessing.", file, vec);
740 PrintOptionCategory(level, diff, help, "Post-processing options (colors)",
741 file, vec);
742 PrintColorOptions(num, level, diff, help, PostProcessingOptions_Color,
743 "PostProcessing.", file, vec);
744
745 if(level & GMSH_FULLRC) {
746 #if defined(HAVE_POST)
747 for(std::size_t i = 0; i < PView::list.size(); i++) {
748 char tmp[256];
749 sprintf(tmp, "View[%lu].", i);
750 PrintOptionCategory(level, diff, help, "View options (strings)", file,
751 vec);
752 PrintStringOptions(i, level, diff, help, ViewOptions_String, tmp, file,
753 vec);
754 PrintOptionCategory(level, diff, help, "View options (numbers)", file,
755 vec);
756 PrintNumberOptions(i, level, diff, help, ViewOptions_Number, tmp, file,
757 vec);
758 PrintOptionCategory(level, diff, help, "View options (colors)", file,
759 vec);
760 PrintColorOptions(i, level, diff, help, ViewOptions_Color, tmp, file,
761 vec);
762 strcat(tmp, "ColorTable");
763 PrintColorTable(i, diff, tmp, file, vec);
764 }
765 #endif
766 }
767 else if(level & GMSH_OPTIONSRC) {
768 PrintOptionCategory(level, diff, help, "View options (strings)", file, vec);
769 PrintStringOptions(num, level, diff, help, ViewOptions_String, "View.",
770 file, vec);
771 PrintOptionCategory(level, diff, help, "View options (numbers)", file, vec);
772 PrintNumberOptions(num, level, diff, help, ViewOptions_Number, "View.",
773 file, vec);
774 PrintOptionCategory(level, diff, help, "View options (colors)", file, vec);
775 PrintColorOptions(num, level, diff, help, ViewOptions_Color, "View.", file,
776 vec);
777 PrintColorTable(num, diff, "View.ColorTable", file, vec);
778 }
779
780 PrintOptionCategory(level, diff, help, "Print options (strings)", file, vec);
781 PrintStringOptions(num, level, diff, help, PrintOptions_String, "Print.",
782 file, vec);
783 PrintOptionCategory(level, diff, help, "Print options (numbers)", file, vec);
784 PrintNumberOptions(num, level, diff, help, PrintOptions_Number, "Print.",
785 file, vec);
786 PrintOptionCategory(level, diff, help, "Print options (colors)", file, vec);
787 PrintColorOptions(num, level, diff, help, PrintOptions_Color, "Print.", file,
788 vec);
789
790 if(filename) fclose(file);
791 }
792
PrintOptionsDoc()793 void PrintOptionsDoc()
794 {
795 const char *warn =
796 "@c This file was generated by \"gmsh -doc\": do not edit manually!\n\n";
797
798 {
799 FILE *file = Fopen("opt_general.texi", "w");
800 if(!file) {
801 Msg::Error("Unable to open file 'opt_general.texi'");
802 return;
803 }
804 fprintf(file, "%s@ftable @code\n", warn);
805 PrintStringOptionsDoc(GeneralOptions_String, "General.", file);
806 PrintNumberOptionsDoc(GeneralOptions_Number, "General.", file);
807 PrintColorOptionsDoc(GeneralOptions_Color, "General.", file);
808 fprintf(file, "@end ftable\n");
809 fclose(file);
810 }
811 {
812 FILE *file = Fopen("opt_print.texi", "w");
813 if(!file) {
814 Msg::Error("Unable to open file 'opt_print.texi'");
815 return;
816 }
817 fprintf(file, "%s@ftable @code\n", warn);
818 PrintStringOptionsDoc(PrintOptions_String, "Print.", file);
819 PrintNumberOptionsDoc(PrintOptions_Number, "Print.", file);
820 PrintColorOptionsDoc(PrintOptions_Color, "Print.", file);
821 fprintf(file, "@end ftable\n");
822 fclose(file);
823 }
824 {
825 FILE *file = Fopen("opt_geometry.texi", "w");
826 if(!file) {
827 Msg::Error("Unable to open file 'opt_geometry.texi'");
828 return;
829 }
830 fprintf(file, "%s@ftable @code\n", warn);
831 PrintStringOptionsDoc(GeometryOptions_String, "Geometry.", file);
832 PrintNumberOptionsDoc(GeometryOptions_Number, "Geometry.", file);
833 PrintColorOptionsDoc(GeometryOptions_Color, "Geometry.", file);
834 fprintf(file, "@end ftable\n");
835 fclose(file);
836 }
837 {
838 FILE *file = Fopen("opt_mesh.texi", "w");
839 if(!file) {
840 Msg::Error("Unable to open file 'opt_mesh.texi'");
841 return;
842 }
843 fprintf(file, "%s@ftable @code\n", warn);
844 PrintStringOptionsDoc(MeshOptions_String, "Mesh.", file);
845 PrintNumberOptionsDoc(MeshOptions_Number, "Mesh.", file);
846 PrintColorOptionsDoc(MeshOptions_Color, "Mesh.", file);
847 fprintf(file, "@end ftable\n");
848 fclose(file);
849 }
850 {
851 FILE *file = Fopen("opt_solver.texi", "w");
852 if(!file) {
853 Msg::Error("Unable to open file 'opt_solver.texi'");
854 return;
855 }
856 fprintf(file, "%s@ftable @code\n", warn);
857 PrintStringOptionsDoc(SolverOptions_String, "Solver.", file);
858 PrintNumberOptionsDoc(SolverOptions_Number, "Solver.", file);
859 PrintColorOptionsDoc(SolverOptions_Color, "Solver.", file);
860 fprintf(file, "@end ftable\n");
861 fclose(file);
862 }
863 {
864 FILE *file = Fopen("opt_post.texi", "w");
865 if(!file) {
866 Msg::Error("Unable to open file 'opt_post.texi'");
867 return;
868 }
869 fprintf(file, "%s@ftable @code\n", warn);
870 PrintStringOptionsDoc(PostProcessingOptions_String, "PostProcessing.",
871 file);
872 PrintNumberOptionsDoc(PostProcessingOptions_Number, "PostProcessing.",
873 file);
874 PrintColorOptionsDoc(PostProcessingOptions_Color, "PostProcessing.", file);
875 fprintf(file, "@end ftable\n");
876 fclose(file);
877 }
878 {
879 #if defined(HAVE_POST)
880 FILE *file = Fopen("opt_view.texi", "w");
881 if(!file) {
882 Msg::Error("Unable to open file 'opt_view.texi'");
883 return;
884 }
885 fprintf(file, "%s@ftable @code\n", warn);
886 PrintStringOptionsDoc(ViewOptions_String, "View.", file);
887 PrintNumberOptionsDoc(ViewOptions_Number, "View.", file);
888 PrintColorOptionsDoc(ViewOptions_Color, "View.", file);
889 fprintf(file, "@item View.ColorTable\n");
890 fprintf(file, "Color table used to draw the view@*\n");
891 fprintf(file, "Saved in: @code{%s}\n\n",
892 GetOptionSaveLevel(GMSH_FULLRC | GMSH_OPTIONSRC));
893 fprintf(file, "@end ftable\n");
894 fclose(file);
895 #endif
896 }
897 {
898 #if defined(HAVE_PLUGINS)
899 FILE *file = Fopen("opt_plugin.texi", "w");
900 if(!file) {
901 Msg::Error("Unable to open file 'opt_plugin.texi'");
902 return;
903 }
904 fprintf(file, "%s@ftable @code\n", warn);
905 for(auto it =
906 PluginManager::instance()->begin();
907 it != PluginManager::instance()->end(); ++it) {
908 GMSH_Plugin *p = it->second;
909 fprintf(file, "@item Plugin(%s)\n", p->getName().c_str());
910 std::string help = p->getHelp();
911 Sanitize_String_Texi(help);
912 fprintf(file, "%s\n", help.c_str());
913 int m = p->getNbOptionsStr();
914 if(m) {
915 fprintf(file, "String options:\n");
916 fprintf(file, "@table @code\n");
917 for(int i = 0; i < m; i++) {
918 StringXString *sxs = p->getOptionStr(i);
919 fprintf(file, "@item %s\n", sxs->str);
920 fprintf(file, "Default value: @code{\"%s\"}\n", sxs->def.c_str());
921 }
922 fprintf(file, "@end table\n");
923 }
924 int n = p->getNbOptions();
925 if(n) {
926 fprintf(file, "Numeric options:\n");
927 fprintf(file, "@table @code\n");
928 for(int i = 0; i < n; i++) {
929 StringXNumber *sxn = p->getOption(i);
930 fprintf(file, "@item %s\n", sxn->str);
931 fprintf(file, "Default value: @code{%g}\n", sxn->def);
932 }
933 fprintf(file, "@end table\n");
934 }
935 fprintf(file, "\n");
936 }
937 fprintf(file, "@end ftable\n");
938 fclose(file);
939 #endif
940 }
941
942 #if defined(HAVE_MESH)
943 {
944 FILE *file = Fopen("opt_fields.texi", "w");
945 if(!file) {
946 Msg::Error("Unable to open file 'opt_fields.texi'");
947 return;
948 }
949 fprintf(file, "%s@ftable @code\n", warn);
950 FieldManager &fields = *GModel::current()->getFields();
951 for(auto it = fields.mapTypeName.begin(); it != fields.mapTypeName.end();
952 it++) {
953 Field *f = (*it->second)();
954 if(f->isDeprecated()) continue;
955 fprintf(file, "@item %s\n", it->first.c_str());
956 std::string field_description = f->getDescription();
957 Sanitize_String_Texi(field_description);
958 fprintf(file, "%s@*\n", field_description.c_str());
959 if(!f->options.empty()) {
960 fprintf(file, "Options:@*\n");
961 fprintf(file, "@table @code\n");
962 for(auto it2 =
963 f->options.begin(); it2 != f->options.end(); it2++) {
964 if(it2->second->isDeprecated()) continue;
965 fprintf(file, "@item %s\n", it2->first.c_str());
966 std::string val;
967 it2->second->getTextRepresentation(val);
968 Sanitize_String_Texi(val);
969 fprintf(file, "%s@*\ntype: %s@*\ndefault value: @code{%s}\n",
970 it2->second->getDescription().c_str(),
971 it2->second->getTypeName().c_str(), val.c_str());
972 }
973 fprintf(file, "@end table\n\n");
974 }
975 if(!f->callbacks.empty()) {
976 fprintf(file, "Actions:@*\n");
977 fprintf(file, "@table @code\n");
978 for(auto it2 =
979 f->callbacks.begin();
980 it2 != f->callbacks.end(); it2++) {
981 fprintf(file, "@item %s\n", it2->first.c_str());
982 fprintf(file, "%s@*\n", it2->second->getDescription().c_str());
983 }
984 fprintf(file, "@end table\n\n");
985 }
986 }
987 fprintf(file, "@end ftable\n");
988 fclose(file);
989 }
990 #endif
991 {
992 FILE *file = Fopen("shortcuts.texi", "w");
993 if(!file) {
994 Msg::Error("Unable to open file 'shortcuts.texi'");
995 return;
996 }
997 std::vector<std::pair<std::string, std::string> > s =
998 GetShortcutsUsage("Ctrl+");
999 fprintf(file, "%s@table @kbd\n", warn);
1000 for(std::size_t i = 0; i < s.size(); i++)
1001 fprintf(file, "@item %s\n%s\n", s[i].first.c_str(), s[i].second.c_str());
1002 fprintf(file, "@end table\n");
1003 fclose(file);
1004 }
1005 {
1006 FILE *file = Fopen("mouse.texi", "w");
1007 if(!file) {
1008 Msg::Error("Unable to open file 'mouse.texi'");
1009 return;
1010 }
1011 std::vector<std::pair<std::string, std::string> > s = GetMouseUsage();
1012 fprintf(file, "%s@table @kbd\n", warn);
1013 for(std::size_t i = 0; i < s.size(); i++)
1014 fprintf(file, "@item %s\n%s\n", s[i].first.c_str(), s[i].second.c_str());
1015 fprintf(file, "@end table\n");
1016 fclose(file);
1017 }
1018 {
1019 FILE *file = Fopen("commandline.texi", "w");
1020 if(!file) {
1021 Msg::Error("Unable to open file 'commandline.texi'");
1022 return;
1023 }
1024 std::vector<std::pair<std::string, std::string> > s = GetUsage();
1025 fprintf(file, "%s@ftable @code\n", warn);
1026 for(std::size_t i = 0; i < s.size(); i++)
1027 if(s[i].first.size() && s[i].second.size())
1028 fprintf(file, "@item %s\n%s\n", s[i].first.c_str(),
1029 s[i].second.c_str());
1030 else if(s[i].first.size() && s[i].second.empty())
1031 fprintf(file, "@end ftable\n %s\n@ftable @code\n", s[i].first.c_str());
1032 fprintf(file, "@end ftable\n");
1033 fclose(file);
1034 }
1035 }
1036
1037 #define GET_VIEW(error_val) \
1038 PView *view = 0; \
1039 PViewData *data = 0; \
1040 PViewOptions *opt; \
1041 if(PView::list.empty()) \
1042 opt = PViewOptions::reference(); \
1043 else { \
1044 if(num < 0 || num >= (int)PView::list.size()) { \
1045 Msg::Warning("View[%d] does not exist", num); \
1046 return (error_val); \
1047 } \
1048 view = PView::list[num]; \
1049 data = view->getData(); \
1050 opt = view->getOptions(); \
1051 }
1052
1053 #define GET_VIEWo(error_val) \
1054 PView *view = 0; \
1055 PViewOptions *opt; \
1056 if(PView::list.empty()) \
1057 opt = PViewOptions::reference(); \
1058 else { \
1059 if(num < 0 || num >= (int)PView::list.size()) { \
1060 Msg::Warning("View[%d] does not exist", num); \
1061 return (error_val); \
1062 } \
1063 view = PView::list[num]; \
1064 opt = view->getOptions(); \
1065 }
1066
1067 #define GET_VIEWd(error_val) \
1068 PView *view = 0; \
1069 PViewData *data = 0; \
1070 if(!PView::list.empty()) { \
1071 if(num < 0 || num >= (int)PView::list.size()) { \
1072 Msg::Warning("View[%d] does not exist", num); \
1073 return (error_val); \
1074 } \
1075 view = PView::list[num]; \
1076 data = view->getData(); \
1077 }
1078
1079 // String option routines
1080
opt_general_axes_label0(OPT_ARGS_STR)1081 std::string opt_general_axes_label0(OPT_ARGS_STR)
1082 {
1083 if(action & GMSH_SET) CTX::instance()->axesLabel[0] = val;
1084 #if defined(HAVE_FLTK)
1085 if(FlGui::available() && (action & GMSH_GUI))
1086 FlGui::instance()->options->general.input[6]->value(
1087 CTX::instance()->axesLabel[0].c_str());
1088 #endif
1089 return CTX::instance()->axesLabel[0];
1090 }
1091
opt_general_axes_label1(OPT_ARGS_STR)1092 std::string opt_general_axes_label1(OPT_ARGS_STR)
1093 {
1094 if(action & GMSH_SET) CTX::instance()->axesLabel[1] = val;
1095 #if defined(HAVE_FLTK)
1096 if(FlGui::available() && (action & GMSH_GUI))
1097 FlGui::instance()->options->general.input[7]->value(
1098 CTX::instance()->axesLabel[1].c_str());
1099 #endif
1100 return CTX::instance()->axesLabel[1];
1101 }
1102
opt_general_axes_label2(OPT_ARGS_STR)1103 std::string opt_general_axes_label2(OPT_ARGS_STR)
1104 {
1105 if(action & GMSH_SET) CTX::instance()->axesLabel[2] = val;
1106 #if defined(HAVE_FLTK)
1107 if(FlGui::available() && (action & GMSH_GUI))
1108 FlGui::instance()->options->general.input[8]->value(
1109 CTX::instance()->axesLabel[2].c_str());
1110 #endif
1111 return CTX::instance()->axesLabel[2];
1112 }
1113
opt_general_axes_format0(OPT_ARGS_STR)1114 std::string opt_general_axes_format0(OPT_ARGS_STR)
1115 {
1116 if(action & GMSH_SET) CTX::instance()->axesFormat[0] = val;
1117 #if defined(HAVE_FLTK)
1118 if(FlGui::available() && (action & GMSH_GUI))
1119 FlGui::instance()->options->general.input[3]->value(
1120 CTX::instance()->axesFormat[0].c_str());
1121 #endif
1122 return CTX::instance()->axesFormat[0];
1123 }
1124
opt_general_axes_format1(OPT_ARGS_STR)1125 std::string opt_general_axes_format1(OPT_ARGS_STR)
1126 {
1127 if(action & GMSH_SET) CTX::instance()->axesFormat[1] = val;
1128 #if defined(HAVE_FLTK)
1129 if(FlGui::available() && (action & GMSH_GUI))
1130 FlGui::instance()->options->general.input[4]->value(
1131 CTX::instance()->axesFormat[1].c_str());
1132 #endif
1133 return CTX::instance()->axesFormat[1];
1134 }
1135
opt_general_axes_format2(OPT_ARGS_STR)1136 std::string opt_general_axes_format2(OPT_ARGS_STR)
1137 {
1138 if(action & GMSH_SET) CTX::instance()->axesFormat[2] = val;
1139 #if defined(HAVE_FLTK)
1140 if(FlGui::available() && (action & GMSH_GUI))
1141 FlGui::instance()->options->general.input[5]->value(
1142 CTX::instance()->axesFormat[2].c_str());
1143 #endif
1144 return CTX::instance()->axesFormat[2];
1145 }
1146
opt_general_display(OPT_ARGS_STR)1147 std::string opt_general_display(OPT_ARGS_STR)
1148 {
1149 if(action & GMSH_SET) CTX::instance()->display = val;
1150 return CTX::instance()->display;
1151 }
1152
opt_general_background_image_filename(OPT_ARGS_STR)1153 std::string opt_general_background_image_filename(OPT_ARGS_STR)
1154 {
1155 if(action & GMSH_SET) {
1156 #if defined(HAVE_FLTK)
1157 if(CTX::instance()->bgImageFileName != val && FlGui::available()) {
1158 for(std::size_t i = 0; i < FlGui::instance()->graph.size(); i++)
1159 for(std::size_t j = 0; j < FlGui::instance()->graph[i]->gl.size(); j++)
1160 FlGui::instance()
1161 ->graph[i]
1162 ->gl[j]
1163 ->getDrawContext()
1164 ->invalidateBgImageTexture();
1165 }
1166 #endif
1167 CTX::instance()->bgImageFileName = val;
1168 }
1169 return CTX::instance()->bgImageFileName;
1170 }
1171
opt_general_version(OPT_ARGS_STR)1172 std::string opt_general_version(OPT_ARGS_STR) { return GMSH_VERSION; }
1173
opt_general_build_options(OPT_ARGS_STR)1174 std::string opt_general_build_options(OPT_ARGS_STR)
1175 {
1176 std::string s = GMSH_CONFIG_OPTIONS;
1177 s.erase(0, 1);
1178 return s;
1179 }
1180
opt_general_build_info(OPT_ARGS_STR)1181 std::string opt_general_build_info(OPT_ARGS_STR)
1182 {
1183 std::vector<std::string> ss = GetBuildInfo();
1184 std::string s;
1185 for(std::size_t i = 0; i < ss.size(); i++) {
1186 s += ReplaceSubString(" :", ":", ss[i]);
1187 if(i != ss.size() - 1) s += "; ";
1188 }
1189 std::string::size_type pos;
1190 while((pos = s.find(" ")) != std::string::npos) {
1191 s.replace(pos, 2, " ");
1192 }
1193 return s;
1194 }
1195
opt_general_filename(OPT_ARGS_STR)1196 std::string opt_general_filename(OPT_ARGS_STR)
1197 {
1198 return GModel::current()->getFileName();
1199 }
1200
opt_general_executable_filename(OPT_ARGS_STR)1201 std::string opt_general_executable_filename(OPT_ARGS_STR)
1202 {
1203 return CTX::instance()->exeFileName;
1204 }
1205
opt_general_default_filename(OPT_ARGS_STR)1206 std::string opt_general_default_filename(OPT_ARGS_STR)
1207 {
1208 if(action & GMSH_SET) CTX::instance()->defaultFileName = val;
1209 #if defined(HAVE_FLTK)
1210 if(FlGui::available() && (action & GMSH_GUI))
1211 FlGui::instance()->options->general.input[0]->value(
1212 CTX::instance()->defaultFileName.c_str());
1213 #endif
1214 return CTX::instance()->defaultFileName;
1215 }
1216
opt_general_tmp_filename(OPT_ARGS_STR)1217 std::string opt_general_tmp_filename(OPT_ARGS_STR)
1218 {
1219 if(action & GMSH_SET) CTX::instance()->tmpFileName = val;
1220 return CTX::instance()->tmpFileName;
1221 }
1222
opt_general_error_filename(OPT_ARGS_STR)1223 std::string opt_general_error_filename(OPT_ARGS_STR)
1224 {
1225 if(action & GMSH_SET) CTX::instance()->errorFileName = val;
1226 return CTX::instance()->errorFileName;
1227 }
1228
opt_general_session_filename(OPT_ARGS_STR)1229 std::string opt_general_session_filename(OPT_ARGS_STR)
1230 {
1231 if(action & GMSH_SET) CTX::instance()->sessionFileName = val;
1232 return CTX::instance()->sessionFileName;
1233 }
1234
opt_general_options_filename(OPT_ARGS_STR)1235 std::string opt_general_options_filename(OPT_ARGS_STR)
1236 {
1237 if(action & GMSH_SET) CTX::instance()->optionsFileName = val;
1238 return CTX::instance()->optionsFileName;
1239 }
1240
opt_general_recent_file0(OPT_ARGS_STR)1241 std::string opt_general_recent_file0(OPT_ARGS_STR)
1242 {
1243 if(action & GMSH_SET) CTX::instance()->recentFiles[0] = val;
1244 return CTX::instance()->recentFiles[0];
1245 }
1246
opt_general_recent_file1(OPT_ARGS_STR)1247 std::string opt_general_recent_file1(OPT_ARGS_STR)
1248 {
1249 if(action & GMSH_SET) CTX::instance()->recentFiles[1] = val;
1250 return CTX::instance()->recentFiles[1];
1251 }
1252
opt_general_recent_file2(OPT_ARGS_STR)1253 std::string opt_general_recent_file2(OPT_ARGS_STR)
1254 {
1255 if(action & GMSH_SET) CTX::instance()->recentFiles[2] = val;
1256 return CTX::instance()->recentFiles[2];
1257 }
1258
opt_general_recent_file3(OPT_ARGS_STR)1259 std::string opt_general_recent_file3(OPT_ARGS_STR)
1260 {
1261 if(action & GMSH_SET) CTX::instance()->recentFiles[3] = val;
1262 return CTX::instance()->recentFiles[3];
1263 }
1264
opt_general_recent_file4(OPT_ARGS_STR)1265 std::string opt_general_recent_file4(OPT_ARGS_STR)
1266 {
1267 if(action & GMSH_SET) CTX::instance()->recentFiles[4] = val;
1268 return CTX::instance()->recentFiles[4];
1269 }
1270
opt_general_recent_file5(OPT_ARGS_STR)1271 std::string opt_general_recent_file5(OPT_ARGS_STR)
1272 {
1273 if(action & GMSH_SET) CTX::instance()->recentFiles[5] = val;
1274 return CTX::instance()->recentFiles[5];
1275 }
1276
opt_general_recent_file6(OPT_ARGS_STR)1277 std::string opt_general_recent_file6(OPT_ARGS_STR)
1278 {
1279 if(action & GMSH_SET) CTX::instance()->recentFiles[6] = val;
1280 return CTX::instance()->recentFiles[6];
1281 }
1282
opt_general_recent_file7(OPT_ARGS_STR)1283 std::string opt_general_recent_file7(OPT_ARGS_STR)
1284 {
1285 if(action & GMSH_SET) CTX::instance()->recentFiles[7] = val;
1286 return CTX::instance()->recentFiles[7];
1287 }
1288
opt_general_recent_file8(OPT_ARGS_STR)1289 std::string opt_general_recent_file8(OPT_ARGS_STR)
1290 {
1291 if(action & GMSH_SET) CTX::instance()->recentFiles[8] = val;
1292 return CTX::instance()->recentFiles[8];
1293 }
1294
opt_general_recent_file9(OPT_ARGS_STR)1295 std::string opt_general_recent_file9(OPT_ARGS_STR)
1296 {
1297 if(action & GMSH_SET) CTX::instance()->recentFiles[9] = val;
1298 return CTX::instance()->recentFiles[9];
1299 }
1300
opt_general_scripting_languages(OPT_ARGS_STR)1301 std::string opt_general_scripting_languages(OPT_ARGS_STR)
1302 {
1303 if(action & GMSH_SET)
1304 CTX::instance()->scriptLang = SplitString(val, ',', true);
1305 std::string out = "";
1306 for(std::size_t i = 0; i < CTX::instance()->scriptLang.size(); i++) {
1307 if(i) out += ", ";
1308 out += CTX::instance()->scriptLang[i];
1309 }
1310 return out;
1311 }
1312
opt_general_editor(OPT_ARGS_STR)1313 std::string opt_general_editor(OPT_ARGS_STR)
1314 {
1315 if(action & GMSH_SET) CTX::instance()->editor = val;
1316 #if defined(HAVE_FLTK)
1317 if(FlGui::available() && (action & GMSH_GUI))
1318 FlGui::instance()->options->general.input[1]->value(
1319 CTX::instance()->editor.c_str());
1320 #endif
1321 return CTX::instance()->editor;
1322 }
1323
opt_general_watch_file_pattern(OPT_ARGS_STR)1324 std::string opt_general_watch_file_pattern(OPT_ARGS_STR)
1325 {
1326 if(action & GMSH_SET) CTX::instance()->watchFilePattern = val;
1327 return CTX::instance()->watchFilePattern;
1328 }
1329
opt_general_gui_theme(OPT_ARGS_STR)1330 std::string opt_general_gui_theme(OPT_ARGS_STR)
1331 {
1332 if(action & GMSH_SET) CTX::instance()->guiTheme = val;
1333 return CTX::instance()->guiTheme;
1334 }
1335
opt_general_graphics_font(OPT_ARGS_STR)1336 std::string opt_general_graphics_font(OPT_ARGS_STR)
1337 {
1338 if(action & GMSH_SET) CTX::instance()->glFont = val;
1339 #if defined(HAVE_FLTK)
1340 drawContextFltk dc;
1341 int index = dc.getFontIndex(CTX::instance()->glFont.c_str());
1342 if(action & GMSH_SET) {
1343 CTX::instance()->glFont = dc.getFontName(index);
1344 CTX::instance()->glFontEnum = dc.getFontEnum(index);
1345 }
1346 if(FlGui::available() && (action & GMSH_GUI)) {
1347 FlGui::instance()->options->general.choice[1]->value(index);
1348 }
1349 #endif
1350 return CTX::instance()->glFont;
1351 }
1352
opt_general_graphics_font_title(OPT_ARGS_STR)1353 std::string opt_general_graphics_font_title(OPT_ARGS_STR)
1354 {
1355 if(action & GMSH_SET) CTX::instance()->glFontTitle = val;
1356 #if defined(HAVE_FLTK)
1357 drawContextFltk dc;
1358 int index = dc.getFontIndex(CTX::instance()->glFontTitle.c_str());
1359 if(action & GMSH_SET) {
1360 CTX::instance()->glFontTitle = dc.getFontName(index);
1361 CTX::instance()->glFontEnumTitle = dc.getFontEnum(index);
1362 }
1363 if(FlGui::available() && (action & GMSH_GUI)) {
1364 FlGui::instance()->options->general.choice[6]->value(index);
1365 }
1366 #endif
1367 return CTX::instance()->glFontTitle;
1368 }
1369
opt_general_graphics_font_engine(OPT_ARGS_STR)1370 std::string opt_general_graphics_font_engine(OPT_ARGS_STR)
1371 {
1372 if(action & GMSH_SET) CTX::instance()->glFontEngine = val;
1373
1374 #if defined(HAVE_FLTK)
1375 if(action & GMSH_SET) {
1376 drawContextGlobal *old = drawContext::global();
1377 if(!old || old->getName() != CTX::instance()->glFontEngine) {
1378 #if defined(HAVE_CAIRO)
1379 if(CTX::instance()->glFontEngine == "Cairo")
1380 drawContext::setGlobal(new drawContextFltkCairo);
1381 else
1382 #endif
1383 if(CTX::instance()->glFontEngine == "StringTexture")
1384 drawContext::setGlobal(new drawContextFltkStringTexture);
1385 else
1386 drawContext::setGlobal(new drawContextFltk);
1387 if(old) delete old;
1388 }
1389 }
1390 if(FlGui::available() && (action & GMSH_GUI)) {
1391 int index = 0;
1392 #if defined(HAVE_CAIRO)
1393 if(CTX::instance()->glFontEngine == "Cairo") index = 1;
1394 #endif
1395 if(CTX::instance()->glFontEngine == "StringTexture") index = 2;
1396 FlGui::instance()->options->general.choice[7]->value(index);
1397 }
1398 #endif
1399
1400 return CTX::instance()->glFontEngine;
1401 }
1402
opt_geometry_double_clicked_point_command(OPT_ARGS_STR)1403 std::string opt_geometry_double_clicked_point_command(OPT_ARGS_STR)
1404 {
1405 if(action & GMSH_SET) CTX::instance()->geom.doubleClickedPointCommand = val;
1406 return CTX::instance()->geom.doubleClickedPointCommand;
1407 }
1408
opt_geometry_double_clicked_curve_command(OPT_ARGS_STR)1409 std::string opt_geometry_double_clicked_curve_command(OPT_ARGS_STR)
1410 {
1411 if(action & GMSH_SET) CTX::instance()->geom.doubleClickedCurveCommand = val;
1412 return CTX::instance()->geom.doubleClickedCurveCommand;
1413 }
1414
opt_geometry_double_clicked_surface_command(OPT_ARGS_STR)1415 std::string opt_geometry_double_clicked_surface_command(OPT_ARGS_STR)
1416 {
1417 if(action & GMSH_SET) CTX::instance()->geom.doubleClickedSurfaceCommand = val;
1418 return CTX::instance()->geom.doubleClickedSurfaceCommand;
1419 }
1420
opt_geometry_double_clicked_volume_command(OPT_ARGS_STR)1421 std::string opt_geometry_double_clicked_volume_command(OPT_ARGS_STR)
1422 {
1423 if(action & GMSH_SET) CTX::instance()->geom.doubleClickedVolumeCommand = val;
1424 return CTX::instance()->geom.doubleClickedVolumeCommand;
1425 }
1426
opt_geometry_occ_target_unit(OPT_ARGS_STR)1427 std::string opt_geometry_occ_target_unit(OPT_ARGS_STR)
1428 {
1429 if(action & GMSH_SET) CTX::instance()->geom.occTargetUnit = val;
1430 return CTX::instance()->geom.occTargetUnit;
1431 }
1432
opt_solver_socket_name(OPT_ARGS_STR)1433 std::string opt_solver_socket_name(OPT_ARGS_STR)
1434 {
1435 if(action & GMSH_SET) CTX::instance()->solver.socketName = val;
1436 #if defined(HAVE_FLTK)
1437 if(FlGui::available() && (action & GMSH_GUI))
1438 FlGui::instance()->options->solver.input[0]->value(
1439 CTX::instance()->solver.socketName.c_str());
1440 #endif
1441 return CTX::instance()->solver.socketName;
1442 }
1443
opt_solver_name(OPT_ARGS_STR)1444 std::string opt_solver_name(OPT_ARGS_STR)
1445 {
1446 if(num < 0 || num > NUM_SOLVERS - 1) return "";
1447 if(action & GMSH_SET) CTX::instance()->solver.name[num] = val;
1448 return CTX::instance()->solver.name[num];
1449 }
1450
opt_solver_name0(OPT_ARGS_STR)1451 std::string opt_solver_name0(OPT_ARGS_STR)
1452 {
1453 return opt_solver_name(0, action, val);
1454 }
1455
opt_solver_name1(OPT_ARGS_STR)1456 std::string opt_solver_name1(OPT_ARGS_STR)
1457 {
1458 return opt_solver_name(1, action, val);
1459 }
1460
opt_solver_name2(OPT_ARGS_STR)1461 std::string opt_solver_name2(OPT_ARGS_STR)
1462 {
1463 return opt_solver_name(2, action, val);
1464 }
1465
opt_solver_name3(OPT_ARGS_STR)1466 std::string opt_solver_name3(OPT_ARGS_STR)
1467 {
1468 return opt_solver_name(3, action, val);
1469 }
1470
opt_solver_name4(OPT_ARGS_STR)1471 std::string opt_solver_name4(OPT_ARGS_STR)
1472 {
1473 return opt_solver_name(4, action, val);
1474 }
1475
opt_solver_name5(OPT_ARGS_STR)1476 std::string opt_solver_name5(OPT_ARGS_STR)
1477 {
1478 return opt_solver_name(5, action, val);
1479 }
1480
opt_solver_name6(OPT_ARGS_STR)1481 std::string opt_solver_name6(OPT_ARGS_STR)
1482 {
1483 return opt_solver_name(6, action, val);
1484 }
1485
opt_solver_name7(OPT_ARGS_STR)1486 std::string opt_solver_name7(OPT_ARGS_STR)
1487 {
1488 return opt_solver_name(7, action, val);
1489 }
1490
opt_solver_name8(OPT_ARGS_STR)1491 std::string opt_solver_name8(OPT_ARGS_STR)
1492 {
1493 return opt_solver_name(8, action, val);
1494 }
1495
opt_solver_name9(OPT_ARGS_STR)1496 std::string opt_solver_name9(OPT_ARGS_STR)
1497 {
1498 return opt_solver_name(9, action, val);
1499 }
1500
opt_solver_extension(OPT_ARGS_STR)1501 std::string opt_solver_extension(OPT_ARGS_STR)
1502 {
1503 if(num < 0 || num > NUM_SOLVERS - 1) return "";
1504 if(action & GMSH_SET) CTX::instance()->solver.extension[num] = val;
1505 return CTX::instance()->solver.extension[num];
1506 }
1507
opt_solver_extension0(OPT_ARGS_STR)1508 std::string opt_solver_extension0(OPT_ARGS_STR)
1509 {
1510 return opt_solver_extension(0, action, val);
1511 }
1512
opt_solver_extension1(OPT_ARGS_STR)1513 std::string opt_solver_extension1(OPT_ARGS_STR)
1514 {
1515 return opt_solver_extension(1, action, val);
1516 }
1517
opt_solver_extension2(OPT_ARGS_STR)1518 std::string opt_solver_extension2(OPT_ARGS_STR)
1519 {
1520 return opt_solver_extension(2, action, val);
1521 }
1522
opt_solver_extension3(OPT_ARGS_STR)1523 std::string opt_solver_extension3(OPT_ARGS_STR)
1524 {
1525 return opt_solver_extension(3, action, val);
1526 }
1527
opt_solver_extension4(OPT_ARGS_STR)1528 std::string opt_solver_extension4(OPT_ARGS_STR)
1529 {
1530 return opt_solver_extension(4, action, val);
1531 }
1532
opt_solver_extension5(OPT_ARGS_STR)1533 std::string opt_solver_extension5(OPT_ARGS_STR)
1534 {
1535 return opt_solver_extension(5, action, val);
1536 }
1537
opt_solver_extension6(OPT_ARGS_STR)1538 std::string opt_solver_extension6(OPT_ARGS_STR)
1539 {
1540 return opt_solver_extension(6, action, val);
1541 }
1542
opt_solver_extension7(OPT_ARGS_STR)1543 std::string opt_solver_extension7(OPT_ARGS_STR)
1544 {
1545 return opt_solver_extension(7, action, val);
1546 }
1547
opt_solver_extension8(OPT_ARGS_STR)1548 std::string opt_solver_extension8(OPT_ARGS_STR)
1549 {
1550 return opt_solver_extension(8, action, val);
1551 }
1552
opt_solver_extension9(OPT_ARGS_STR)1553 std::string opt_solver_extension9(OPT_ARGS_STR)
1554 {
1555 return opt_solver_extension(9, action, val);
1556 }
1557
opt_solver_executable(OPT_ARGS_STR)1558 std::string opt_solver_executable(OPT_ARGS_STR)
1559 {
1560 if(num < 0 || num > NUM_SOLVERS - 1) return "";
1561 if(action & GMSH_SET) CTX::instance()->solver.executable[num] = val;
1562 return CTX::instance()->solver.executable[num];
1563 }
1564
opt_solver_executable0(OPT_ARGS_STR)1565 std::string opt_solver_executable0(OPT_ARGS_STR)
1566 {
1567 return opt_solver_executable(0, action, val);
1568 }
1569
opt_solver_executable1(OPT_ARGS_STR)1570 std::string opt_solver_executable1(OPT_ARGS_STR)
1571 {
1572 return opt_solver_executable(1, action, val);
1573 }
1574
opt_solver_executable2(OPT_ARGS_STR)1575 std::string opt_solver_executable2(OPT_ARGS_STR)
1576 {
1577 return opt_solver_executable(2, action, val);
1578 }
1579
opt_solver_executable3(OPT_ARGS_STR)1580 std::string opt_solver_executable3(OPT_ARGS_STR)
1581 {
1582 return opt_solver_executable(3, action, val);
1583 }
1584
opt_solver_executable4(OPT_ARGS_STR)1585 std::string opt_solver_executable4(OPT_ARGS_STR)
1586 {
1587 return opt_solver_executable(4, action, val);
1588 }
1589
opt_solver_executable5(OPT_ARGS_STR)1590 std::string opt_solver_executable5(OPT_ARGS_STR)
1591 {
1592 return opt_solver_executable(5, action, val);
1593 }
1594
opt_solver_executable6(OPT_ARGS_STR)1595 std::string opt_solver_executable6(OPT_ARGS_STR)
1596 {
1597 return opt_solver_executable(6, action, val);
1598 }
1599
opt_solver_executable7(OPT_ARGS_STR)1600 std::string opt_solver_executable7(OPT_ARGS_STR)
1601 {
1602 return opt_solver_executable(7, action, val);
1603 }
1604
opt_solver_executable8(OPT_ARGS_STR)1605 std::string opt_solver_executable8(OPT_ARGS_STR)
1606 {
1607 return opt_solver_executable(8, action, val);
1608 }
1609
opt_solver_executable9(OPT_ARGS_STR)1610 std::string opt_solver_executable9(OPT_ARGS_STR)
1611 {
1612 return opt_solver_executable(9, action, val);
1613 }
1614
opt_solver_remote_login(OPT_ARGS_STR)1615 std::string opt_solver_remote_login(OPT_ARGS_STR)
1616 {
1617 if(num < 0 || num > NUM_SOLVERS - 1) return "";
1618 if(action & GMSH_SET) CTX::instance()->solver.remoteLogin[num] = val;
1619 return CTX::instance()->solver.remoteLogin[num];
1620 }
1621
opt_solver_remote_login0(OPT_ARGS_STR)1622 std::string opt_solver_remote_login0(OPT_ARGS_STR)
1623 {
1624 return opt_solver_remote_login(0, action, val);
1625 }
1626
opt_solver_remote_login1(OPT_ARGS_STR)1627 std::string opt_solver_remote_login1(OPT_ARGS_STR)
1628 {
1629 return opt_solver_remote_login(1, action, val);
1630 }
1631
opt_solver_remote_login2(OPT_ARGS_STR)1632 std::string opt_solver_remote_login2(OPT_ARGS_STR)
1633 {
1634 return opt_solver_remote_login(2, action, val);
1635 }
1636
opt_solver_remote_login3(OPT_ARGS_STR)1637 std::string opt_solver_remote_login3(OPT_ARGS_STR)
1638 {
1639 return opt_solver_remote_login(3, action, val);
1640 }
1641
opt_solver_remote_login4(OPT_ARGS_STR)1642 std::string opt_solver_remote_login4(OPT_ARGS_STR)
1643 {
1644 return opt_solver_remote_login(4, action, val);
1645 }
1646
opt_solver_remote_login5(OPT_ARGS_STR)1647 std::string opt_solver_remote_login5(OPT_ARGS_STR)
1648 {
1649 return opt_solver_remote_login(5, action, val);
1650 }
1651
opt_solver_remote_login6(OPT_ARGS_STR)1652 std::string opt_solver_remote_login6(OPT_ARGS_STR)
1653 {
1654 return opt_solver_remote_login(6, action, val);
1655 }
1656
opt_solver_remote_login7(OPT_ARGS_STR)1657 std::string opt_solver_remote_login7(OPT_ARGS_STR)
1658 {
1659 return opt_solver_remote_login(7, action, val);
1660 }
1661
opt_solver_remote_login8(OPT_ARGS_STR)1662 std::string opt_solver_remote_login8(OPT_ARGS_STR)
1663 {
1664 return opt_solver_remote_login(8, action, val);
1665 }
1666
opt_solver_remote_login9(OPT_ARGS_STR)1667 std::string opt_solver_remote_login9(OPT_ARGS_STR)
1668 {
1669 return opt_solver_remote_login(9, action, val);
1670 }
1671
opt_solver_python_interpreter(OPT_ARGS_STR)1672 std::string opt_solver_python_interpreter(OPT_ARGS_STR)
1673 {
1674 if(action & GMSH_SET) CTX::instance()->solver.pythonInterpreter = val;
1675 #if defined(HAVE_FLTK)
1676 if(FlGui::available() && (action & GMSH_GUI))
1677 FlGui::instance()->options->solver.input[1]->value(
1678 CTX::instance()->solver.pythonInterpreter.c_str());
1679 #endif
1680 return CTX::instance()->solver.pythonInterpreter;
1681 }
1682
opt_solver_octave_interpreter(OPT_ARGS_STR)1683 std::string opt_solver_octave_interpreter(OPT_ARGS_STR)
1684 {
1685 if(action & GMSH_SET) CTX::instance()->solver.octaveInterpreter = val;
1686 #if defined(HAVE_FLTK)
1687 if(FlGui::available() && (action & GMSH_GUI))
1688 FlGui::instance()->options->solver.input[2]->value(
1689 CTX::instance()->solver.octaveInterpreter.c_str());
1690 #endif
1691 return CTX::instance()->solver.octaveInterpreter;
1692 }
1693
opt_post_double_clicked_graph_point_command(OPT_ARGS_STR)1694 std::string opt_post_double_clicked_graph_point_command(OPT_ARGS_STR)
1695 {
1696 if(action & GMSH_SET)
1697 CTX::instance()->post.doubleClickedGraphPointCommand = val;
1698 return CTX::instance()->post.doubleClickedGraphPointCommand;
1699 }
1700
1701 #if defined(HAVE_FLTK)
_gui_action_valid(int action,int num)1702 int _gui_action_valid(int action, int num)
1703 {
1704 if(!FlGui::available()) return 0;
1705 return (action & GMSH_GUI) && (num == FlGui::instance()->options->view.index);
1706 }
1707 #endif
1708
opt_view_name(OPT_ARGS_STR)1709 std::string opt_view_name(OPT_ARGS_STR)
1710 {
1711 #if defined(HAVE_POST)
1712 GET_VIEWd("");
1713 if(!data) return "";
1714 if(action & GMSH_SET) {
1715 data->setName(val);
1716 #if defined(HAVE_FLTK)
1717 // change name in GUI for the view and its aliases
1718 if(FlGui::available()) {
1719 for(int i = 0; i < (int)PView::list.size(); i++) {
1720 if((i == num || PView::list[i]->getAliasOf() == view->getTag() ||
1721 PView::list[i]->getTag() == view->getAliasOf()) &&
1722 FlGui::instance()->onelab->getViewButton(i)) {
1723 FlGui::instance()->onelab->getViewButton(i)->copy_label(
1724 data->getName());
1725 FlGui::instance()->onelab->getViewButton(i)->redraw();
1726 }
1727 }
1728 }
1729 #endif
1730 }
1731 #if defined(HAVE_FLTK)
1732 if(_gui_action_valid(action, num)) {
1733 FlGui::instance()->options->view.input[0]->value(data->getName().c_str());
1734 }
1735 #endif
1736 return data->getName();
1737 #else
1738 return "";
1739 #endif
1740 }
1741
opt_view_format(OPT_ARGS_STR)1742 std::string opt_view_format(OPT_ARGS_STR)
1743 {
1744 #if defined(HAVE_POST)
1745 GET_VIEWo("");
1746 if(action & GMSH_SET) { opt->format = val; }
1747 #if defined(HAVE_FLTK)
1748 if(_gui_action_valid(action, num))
1749 FlGui::instance()->options->view.input[1]->value(opt->format.c_str());
1750 #endif
1751 return opt->format;
1752 #else
1753 return "";
1754 #endif
1755 }
1756
opt_view_double_clicked_command(OPT_ARGS_STR)1757 std::string opt_view_double_clicked_command(OPT_ARGS_STR)
1758 {
1759 #if defined(HAVE_POST)
1760 GET_VIEWo("");
1761 if(action & GMSH_SET) { opt->doubleClickedCommand = val; }
1762 return opt->doubleClickedCommand;
1763 #else
1764 return "";
1765 #endif
1766 }
1767
opt_view_group(OPT_ARGS_STR)1768 std::string opt_view_group(OPT_ARGS_STR)
1769 {
1770 #if defined(HAVE_POST)
1771 GET_VIEWo("");
1772 if(action & GMSH_SET) { opt->group = val; }
1773 return opt->group;
1774 #else
1775 return "";
1776 #endif
1777 }
1778
opt_view_filename(OPT_ARGS_STR)1779 std::string opt_view_filename(OPT_ARGS_STR)
1780 {
1781 #if defined(HAVE_POST)
1782 GET_VIEWd("");
1783 if(!data) return "";
1784 return data->getFileName();
1785 #else
1786 return "";
1787 #endif
1788 }
1789
opt_view_axes_label0(OPT_ARGS_STR)1790 std::string opt_view_axes_label0(OPT_ARGS_STR)
1791 {
1792 #if defined(HAVE_POST)
1793 GET_VIEWo("");
1794 if(action & GMSH_SET) { opt->axesLabel[0] = val; }
1795 #if defined(HAVE_FLTK)
1796 if(_gui_action_valid(action, num))
1797 FlGui::instance()->options->view.input[10]->value(
1798 opt->axesLabel[0].c_str());
1799 #endif
1800 return opt->axesLabel[0];
1801 #else
1802 return "";
1803 #endif
1804 }
1805
opt_view_axes_label1(OPT_ARGS_STR)1806 std::string opt_view_axes_label1(OPT_ARGS_STR)
1807 {
1808 #if defined(HAVE_POST)
1809 GET_VIEWo("");
1810 if(action & GMSH_SET) { opt->axesLabel[1] = val; }
1811 #if defined(HAVE_FLTK)
1812 if(_gui_action_valid(action, num))
1813 FlGui::instance()->options->view.input[11]->value(
1814 opt->axesLabel[1].c_str());
1815 #endif
1816 return opt->axesLabel[1];
1817 #else
1818 return "";
1819 #endif
1820 }
1821
opt_view_axes_label2(OPT_ARGS_STR)1822 std::string opt_view_axes_label2(OPT_ARGS_STR)
1823 {
1824 #if defined(HAVE_POST)
1825 GET_VIEWo("");
1826 if(action & GMSH_SET) { opt->axesLabel[2] = val; }
1827 #if defined(HAVE_FLTK)
1828 if(_gui_action_valid(action, num))
1829 FlGui::instance()->options->view.input[12]->value(
1830 opt->axesLabel[2].c_str());
1831 #endif
1832 return opt->axesLabel[2];
1833 #else
1834 return "";
1835 #endif
1836 }
1837
opt_view_axes_format0(OPT_ARGS_STR)1838 std::string opt_view_axes_format0(OPT_ARGS_STR)
1839 {
1840 #if defined(HAVE_POST)
1841 GET_VIEWo("");
1842 if(action & GMSH_SET) { opt->axesFormat[0] = val; }
1843 #if defined(HAVE_FLTK)
1844 if(_gui_action_valid(action, num))
1845 FlGui::instance()->options->view.input[7]->value(
1846 opt->axesFormat[0].c_str());
1847 #endif
1848 return opt->axesFormat[0];
1849 #else
1850 return "";
1851 #endif
1852 }
1853
opt_view_axes_format1(OPT_ARGS_STR)1854 std::string opt_view_axes_format1(OPT_ARGS_STR)
1855 {
1856 #if defined(HAVE_POST)
1857 GET_VIEWo("");
1858 if(action & GMSH_SET) { opt->axesFormat[1] = val; }
1859 #if defined(HAVE_FLTK)
1860 if(_gui_action_valid(action, num))
1861 FlGui::instance()->options->view.input[8]->value(
1862 opt->axesFormat[1].c_str());
1863 #endif
1864 return opt->axesFormat[1];
1865 #else
1866 return "";
1867 #endif
1868 }
1869
opt_view_axes_format2(OPT_ARGS_STR)1870 std::string opt_view_axes_format2(OPT_ARGS_STR)
1871 {
1872 #if defined(HAVE_POST)
1873 GET_VIEWo("");
1874 if(action & GMSH_SET) { opt->axesFormat[2] = val; }
1875 #if defined(HAVE_FLTK)
1876 if(_gui_action_valid(action, num))
1877 FlGui::instance()->options->view.input[9]->value(
1878 opt->axesFormat[2].c_str());
1879 #endif
1880 return opt->axesFormat[2];
1881 #else
1882 return "";
1883 #endif
1884 }
1885
opt_view_gen_raise0(OPT_ARGS_STR)1886 std::string opt_view_gen_raise0(OPT_ARGS_STR)
1887 {
1888 #if defined(HAVE_POST)
1889 GET_VIEWo("");
1890 if(action & GMSH_SET) {
1891 opt->genRaiseX = val;
1892 if(view) view->setChanged(true);
1893 }
1894 #if defined(HAVE_FLTK)
1895 if(_gui_action_valid(action, num))
1896 FlGui::instance()->options->view.input[4]->value(opt->genRaiseX.c_str());
1897 #endif
1898 return opt->genRaiseX;
1899 #else
1900 return "";
1901 #endif
1902 }
1903
opt_view_gen_raise1(OPT_ARGS_STR)1904 std::string opt_view_gen_raise1(OPT_ARGS_STR)
1905 {
1906 #if defined(HAVE_POST)
1907 GET_VIEWo("");
1908 if(action & GMSH_SET) {
1909 opt->genRaiseY = val;
1910 if(view) view->setChanged(true);
1911 }
1912 #if defined(HAVE_FLTK)
1913 if(_gui_action_valid(action, num))
1914 FlGui::instance()->options->view.input[5]->value(opt->genRaiseY.c_str());
1915 #endif
1916 return opt->genRaiseY;
1917 #else
1918 return "";
1919 #endif
1920 }
1921
opt_view_gen_raise2(OPT_ARGS_STR)1922 std::string opt_view_gen_raise2(OPT_ARGS_STR)
1923 {
1924 #if defined(HAVE_POST)
1925 GET_VIEWo("");
1926 if(action & GMSH_SET) {
1927 opt->genRaiseZ = val;
1928 if(view) view->setChanged(true);
1929 }
1930 #if defined(HAVE_FLTK)
1931 if(_gui_action_valid(action, num))
1932 FlGui::instance()->options->view.input[6]->value(opt->genRaiseZ.c_str());
1933 #endif
1934 return opt->genRaiseZ;
1935 #else
1936 return "";
1937 #endif
1938 }
1939
_h2d(char c)1940 int _h2d(char c)
1941 {
1942 switch(c) {
1943 case 'a':
1944 case 'A': return 10;
1945 case 'b':
1946 case 'B': return 11;
1947 case 'c':
1948 case 'C': return 12;
1949 case 'd':
1950 case 'D': return 13;
1951 case 'e':
1952 case 'E': return 14;
1953 case 'f':
1954 case 'F': return 15;
1955 default:
1956 if(c >= '0' && c <= '9')
1957 return c - '0';
1958 else
1959 return 0;
1960 }
1961 }
1962
_string2stipple(std::string str,int & repeat,int & pattern)1963 void _string2stipple(std::string str, int &repeat, int &pattern)
1964 {
1965 // "n*0xabcd"
1966 if(str.size() < 8) {
1967 repeat = 1;
1968 pattern = 0xFFFF;
1969 }
1970 else if(str[1] != '*' || str[2] != '0' || str[3] != 'x') {
1971 // bad format
1972 repeat = 1;
1973 pattern = 0xFFFF;
1974 }
1975 else {
1976 repeat = (int)str[0] - '0';
1977 pattern = 16 * 16 * 16 * _h2d(str[4]) + 16 * 16 * _h2d(str[5]) +
1978 16 * _h2d(str[6]) + _h2d(str[7]);
1979 }
1980 }
1981
opt_view_stipple0(OPT_ARGS_STR)1982 std::string opt_view_stipple0(OPT_ARGS_STR)
1983 {
1984 #if defined(HAVE_POST)
1985 GET_VIEWo("");
1986 if(action & GMSH_SET) {
1987 opt->stippleString[0] = val;
1988 _string2stipple(opt->stippleString[0], opt->stipple[0][0],
1989 opt->stipple[0][1]);
1990 }
1991 return opt->stippleString[0];
1992 #else
1993 return "";
1994 #endif
1995 }
1996
opt_view_stipple1(OPT_ARGS_STR)1997 std::string opt_view_stipple1(OPT_ARGS_STR)
1998 {
1999 #if defined(HAVE_POST)
2000 GET_VIEWo("");
2001 if(action & GMSH_SET) {
2002 opt->stippleString[1] = val;
2003 _string2stipple(opt->stippleString[1], opt->stipple[1][0],
2004 opt->stipple[1][1]);
2005 }
2006 return opt->stippleString[1];
2007 #else
2008 return "";
2009 #endif
2010 }
2011
opt_view_stipple2(OPT_ARGS_STR)2012 std::string opt_view_stipple2(OPT_ARGS_STR)
2013 {
2014 #if defined(HAVE_POST)
2015 GET_VIEWo("");
2016 if(action & GMSH_SET) {
2017 opt->stippleString[2] = val;
2018 _string2stipple(opt->stippleString[2], opt->stipple[2][0],
2019 opt->stipple[2][1]);
2020 }
2021 return opt->stippleString[2];
2022 #else
2023 return "";
2024 #endif
2025 }
2026
opt_view_stipple3(OPT_ARGS_STR)2027 std::string opt_view_stipple3(OPT_ARGS_STR)
2028 {
2029 #if defined(HAVE_POST)
2030 GET_VIEWo("");
2031 if(action & GMSH_SET) {
2032 opt->stippleString[3] = val;
2033 _string2stipple(opt->stippleString[3], opt->stipple[3][0],
2034 opt->stipple[3][1]);
2035 }
2036 return opt->stippleString[3];
2037 #else
2038 return "";
2039 #endif
2040 }
2041
opt_view_stipple4(OPT_ARGS_STR)2042 std::string opt_view_stipple4(OPT_ARGS_STR)
2043 {
2044 #if defined(HAVE_POST)
2045 GET_VIEWo("");
2046 if(action & GMSH_SET) {
2047 opt->stippleString[4] = val;
2048 _string2stipple(opt->stippleString[4], opt->stipple[4][0],
2049 opt->stipple[4][1]);
2050 }
2051 return opt->stippleString[4];
2052 #else
2053 return "";
2054 #endif
2055 }
2056
opt_view_stipple5(OPT_ARGS_STR)2057 std::string opt_view_stipple5(OPT_ARGS_STR)
2058 {
2059 #if defined(HAVE_POST)
2060 GET_VIEWo("");
2061 if(action & GMSH_SET) {
2062 opt->stippleString[5] = val;
2063 _string2stipple(opt->stippleString[5], opt->stipple[5][0],
2064 opt->stipple[5][1]);
2065 }
2066 return opt->stippleString[5];
2067 #else
2068 return "";
2069 #endif
2070 }
2071
opt_view_stipple6(OPT_ARGS_STR)2072 std::string opt_view_stipple6(OPT_ARGS_STR)
2073 {
2074 #if defined(HAVE_POST)
2075 GET_VIEWo("");
2076 if(action & GMSH_SET) {
2077 opt->stippleString[6] = val;
2078 _string2stipple(opt->stippleString[6], opt->stipple[6][0],
2079 opt->stipple[6][1]);
2080 }
2081 return opt->stippleString[6];
2082 #else
2083 return "";
2084 #endif
2085 }
2086
opt_view_stipple7(OPT_ARGS_STR)2087 std::string opt_view_stipple7(OPT_ARGS_STR)
2088 {
2089 #if defined(HAVE_POST)
2090 GET_VIEWo("");
2091 if(action & GMSH_SET) {
2092 opt->stippleString[7] = val;
2093 _string2stipple(opt->stippleString[7], opt->stipple[7][0],
2094 opt->stipple[7][1]);
2095 }
2096 return opt->stippleString[7];
2097 #else
2098 return "";
2099 #endif
2100 }
2101
opt_view_stipple8(OPT_ARGS_STR)2102 std::string opt_view_stipple8(OPT_ARGS_STR)
2103 {
2104 #if defined(HAVE_POST)
2105 GET_VIEWo("");
2106 if(action & GMSH_SET) {
2107 opt->stippleString[8] = val;
2108 _string2stipple(opt->stippleString[8], opt->stipple[8][0],
2109 opt->stipple[8][1]);
2110 }
2111 return opt->stippleString[8];
2112 #else
2113 return "";
2114 #endif
2115 }
2116
opt_view_stipple9(OPT_ARGS_STR)2117 std::string opt_view_stipple9(OPT_ARGS_STR)
2118 {
2119 #if defined(HAVE_POST)
2120 GET_VIEWo("");
2121 if(action & GMSH_SET) {
2122 opt->stippleString[9] = val;
2123 _string2stipple(opt->stippleString[9], opt->stipple[9][0],
2124 opt->stipple[9][1]);
2125 }
2126 return opt->stippleString[9];
2127 #else
2128 return "";
2129 #endif
2130 }
2131
opt_view_attributes(OPT_ARGS_STR)2132 std::string opt_view_attributes(OPT_ARGS_STR)
2133 {
2134 #if defined(HAVE_POST)
2135 GET_VIEWo("");
2136 if(action & GMSH_SET) opt->attributes = val;
2137 return opt->attributes;
2138 #else
2139 return "";
2140 #endif
2141 }
2142
opt_print_parameter_command(OPT_ARGS_STR)2143 std::string opt_print_parameter_command(OPT_ARGS_STR)
2144 {
2145 if(action & GMSH_SET) CTX::instance()->print.parameterCommand = val;
2146 return CTX::instance()->print.parameterCommand;
2147 }
2148
2149 // Numeric option routines
2150
opt_general_abort_on_error(OPT_ARGS_NUM)2151 double opt_general_abort_on_error(OPT_ARGS_NUM)
2152 {
2153 if(action & GMSH_SET) CTX::instance()->abortOnError = (int)val;
2154 return CTX::instance()->abortOnError;
2155 }
2156
opt_general_initial_context(OPT_ARGS_NUM)2157 double opt_general_initial_context(OPT_ARGS_NUM)
2158 {
2159 if(action & GMSH_SET) CTX::instance()->initialContext = (int)val;
2160 return CTX::instance()->initialContext;
2161 }
2162
opt_general_show_options_on_startup(OPT_ARGS_NUM)2163 double opt_general_show_options_on_startup(OPT_ARGS_NUM)
2164 {
2165 if(action & GMSH_SET) CTX::instance()->showOptionsOnStartup = (int)val;
2166 return CTX::instance()->showOptionsOnStartup;
2167 }
2168
opt_general_show_messages_on_startup(OPT_ARGS_NUM)2169 double opt_general_show_messages_on_startup(OPT_ARGS_NUM)
2170 {
2171 if(action & GMSH_SET) CTX::instance()->showMessagesOnStartup = (int)val;
2172 return CTX::instance()->showMessagesOnStartup;
2173 }
2174
opt_general_fontsize(OPT_ARGS_NUM)2175 double opt_general_fontsize(OPT_ARGS_NUM)
2176 {
2177 if(action & GMSH_SET) { CTX::instance()->fontSize = (int)val; }
2178 return CTX::instance()->fontSize;
2179 }
2180
opt_general_gui_color_scheme(OPT_ARGS_NUM)2181 double opt_general_gui_color_scheme(OPT_ARGS_NUM)
2182 {
2183 if(action & GMSH_SET) CTX::instance()->guiColorScheme = (int)val;
2184 #if defined(HAVE_FLTK)
2185 if(FlGui::available() && (action & GMSH_GUI)) {
2186 FlGui::instance()->options->general.butt[21]->value(
2187 CTX::instance()->guiColorScheme);
2188 }
2189 if(action & GMSH_SET && FlGui::available()) {
2190 FlGui::instance()->applyColorScheme(true);
2191 }
2192 #endif
2193 return CTX::instance()->guiColorScheme;
2194 }
2195
opt_general_gui_refresh_rate(OPT_ARGS_NUM)2196 double opt_general_gui_refresh_rate(OPT_ARGS_NUM)
2197 {
2198 if(action & GMSH_SET) CTX::instance()->guiRefreshRate = val;
2199 return CTX::instance()->guiRefreshRate;
2200 }
2201
opt_general_graphics_fontsize(OPT_ARGS_NUM)2202 double opt_general_graphics_fontsize(OPT_ARGS_NUM)
2203 {
2204 if(action & GMSH_SET) CTX::instance()->glFontSize = (int)val;
2205 #if defined(HAVE_FLTK)
2206 if(FlGui::available() && (action & GMSH_GUI))
2207 FlGui::instance()->options->general.value[12]->value(
2208 CTX::instance()->glFontSize);
2209 #endif
2210 return CTX::instance()->glFontSize;
2211 }
2212
opt_general_graphics_fontsize_title(OPT_ARGS_NUM)2213 double opt_general_graphics_fontsize_title(OPT_ARGS_NUM)
2214 {
2215 if(action & GMSH_SET) CTX::instance()->glFontSizeTitle = (int)val;
2216 #if defined(HAVE_FLTK)
2217 if(FlGui::available() && (action & GMSH_GUI))
2218 FlGui::instance()->options->general.value[28]->value(
2219 CTX::instance()->glFontSizeTitle);
2220 #endif
2221 return CTX::instance()->glFontSizeTitle;
2222 }
2223
opt_general_polygon_offset_always(OPT_ARGS_NUM)2224 double opt_general_polygon_offset_always(OPT_ARGS_NUM)
2225 {
2226 if(action & GMSH_SET) CTX::instance()->polygonOffsetAlways = (int)val;
2227 #if defined(HAVE_FLTK)
2228 if(FlGui::available() && (action & GMSH_GUI))
2229 FlGui::instance()->options->general.butt[4]->value(
2230 CTX::instance()->polygonOffsetAlways);
2231 #endif
2232 return CTX::instance()->polygonOffsetAlways;
2233 }
2234
opt_general_polygon_offset_factor(OPT_ARGS_NUM)2235 double opt_general_polygon_offset_factor(OPT_ARGS_NUM)
2236 {
2237 if(action & GMSH_SET) CTX::instance()->polygonOffsetFactor = val;
2238 #if defined(HAVE_FLTK)
2239 if(FlGui::available() && (action & GMSH_GUI))
2240 FlGui::instance()->options->general.value[15]->value(
2241 CTX::instance()->polygonOffsetFactor);
2242 #endif
2243 return CTX::instance()->polygonOffsetFactor;
2244 }
2245
opt_general_polygon_offset_units(OPT_ARGS_NUM)2246 double opt_general_polygon_offset_units(OPT_ARGS_NUM)
2247 {
2248 if(action & GMSH_SET) CTX::instance()->polygonOffsetUnits = val;
2249 #if defined(HAVE_FLTK)
2250 if(FlGui::available() && (action & GMSH_GUI))
2251 FlGui::instance()->options->general.value[16]->value(
2252 CTX::instance()->polygonOffsetUnits);
2253 #endif
2254 return CTX::instance()->polygonOffsetUnits;
2255 }
2256
opt_general_graphics_position0(OPT_ARGS_NUM)2257 double opt_general_graphics_position0(OPT_ARGS_NUM)
2258 {
2259 if(action & GMSH_SET) CTX::instance()->glPosition[0] = (int)val;
2260 return CTX::instance()->glPosition[0];
2261 }
2262
opt_general_graphics_position1(OPT_ARGS_NUM)2263 double opt_general_graphics_position1(OPT_ARGS_NUM)
2264 {
2265 if(action & GMSH_SET) CTX::instance()->glPosition[1] = (int)val;
2266 return CTX::instance()->glPosition[1];
2267 }
2268
opt_general_graphics_size0(OPT_ARGS_NUM)2269 double opt_general_graphics_size0(OPT_ARGS_NUM)
2270 {
2271 if(action & GMSH_SET) {
2272 CTX::instance()->glSize[0] = (int)val;
2273 if(CTX::instance()->glSize[0] <= 0) CTX::instance()->glSize[0] = 600;
2274 }
2275 #if defined(HAVE_FLTK)
2276 if(FlGui::available() && (action & GMSH_GUI)) {
2277 FlGui::instance()->graph[0]->setGlWidth(CTX::instance()->glSize[0]);
2278 }
2279 #endif
2280 return CTX::instance()->glSize[0];
2281 }
2282
opt_general_graphics_size1(OPT_ARGS_NUM)2283 double opt_general_graphics_size1(OPT_ARGS_NUM)
2284 {
2285 if(action & GMSH_SET) {
2286 CTX::instance()->glSize[1] = (int)val;
2287 if(CTX::instance()->glSize[1] <= 0) CTX::instance()->glSize[1] = 600;
2288 }
2289 #if defined(HAVE_FLTK)
2290 if(FlGui::available() && (action & GMSH_GUI)) {
2291 FlGui::instance()->graph[0]->setGlHeight(CTX::instance()->glSize[1]);
2292 }
2293 #endif
2294 return CTX::instance()->glSize[1];
2295 }
2296
opt_general_context_position0(OPT_ARGS_NUM)2297 double opt_general_context_position0(OPT_ARGS_NUM)
2298 {
2299 if(action & GMSH_SET) CTX::instance()->ctxPosition[0] = (int)val;
2300 return CTX::instance()->ctxPosition[0];
2301 }
2302
opt_general_context_position1(OPT_ARGS_NUM)2303 double opt_general_context_position1(OPT_ARGS_NUM)
2304 {
2305 if(action & GMSH_SET) CTX::instance()->ctxPosition[1] = (int)val;
2306 return CTX::instance()->ctxPosition[1];
2307 }
2308
opt_general_file_chooser_position0(OPT_ARGS_NUM)2309 double opt_general_file_chooser_position0(OPT_ARGS_NUM)
2310 {
2311 if(action & GMSH_SET) CTX::instance()->fileChooserPosition[0] = (int)val;
2312 return CTX::instance()->fileChooserPosition[0];
2313 }
2314
opt_general_file_chooser_position1(OPT_ARGS_NUM)2315 double opt_general_file_chooser_position1(OPT_ARGS_NUM)
2316 {
2317 if(action & GMSH_SET) CTX::instance()->fileChooserPosition[1] = (int)val;
2318 return CTX::instance()->fileChooserPosition[1];
2319 }
2320
opt_general_system_menu_bar(OPT_ARGS_NUM)2321 double opt_general_system_menu_bar(OPT_ARGS_NUM)
2322 {
2323 if(action & GMSH_SET) CTX::instance()->systemMenuBar = (int)val;
2324 return CTX::instance()->systemMenuBar;
2325 }
2326
opt_general_native_file_chooser(OPT_ARGS_NUM)2327 double opt_general_native_file_chooser(OPT_ARGS_NUM)
2328 {
2329 if(action & GMSH_SET) CTX::instance()->nativeFileChooser = (int)val;
2330 return CTX::instance()->nativeFileChooser;
2331 }
2332
opt_general_show_module_menu(OPT_ARGS_NUM)2333 double opt_general_show_module_menu(OPT_ARGS_NUM)
2334 {
2335 if(action & GMSH_SET) CTX::instance()->showModuleMenu = (int)val;
2336 return CTX::instance()->showModuleMenu;
2337 }
2338
opt_general_message_size(OPT_ARGS_NUM)2339 double opt_general_message_size(OPT_ARGS_NUM)
2340 {
2341 if(action & GMSH_SET) {
2342 CTX::instance()->msgSize = (int)val;
2343 if(CTX::instance()->msgSize <= 0) CTX::instance()->msgSize = 100;
2344 }
2345 return CTX::instance()->msgSize;
2346 }
2347
opt_general_message_fontsize(OPT_ARGS_NUM)2348 double opt_general_message_fontsize(OPT_ARGS_NUM)
2349 {
2350 if(action & GMSH_SET) {
2351 CTX::instance()->msgFontSize = (int)val;
2352 #if defined(HAVE_FLTK)
2353 if(FlGui::available() && (action & GMSH_GUI)) {
2354 FlGui::instance()->graph[0]->setMessageFontSize(
2355 CTX::instance()->msgFontSize);
2356 }
2357 #endif
2358 }
2359 return CTX::instance()->msgFontSize;
2360 }
2361
opt_general_detached_menu(OPT_ARGS_NUM)2362 double opt_general_detached_menu(OPT_ARGS_NUM)
2363 {
2364 if(action & GMSH_SET) { CTX::instance()->detachedMenu = (int)val; }
2365 #if defined(HAVE_FLTK)
2366 if(FlGui::available() && (action & GMSH_GUI)) {
2367 if(CTX::instance()->detachedMenu)
2368 FlGui::instance()->graph[0]->detachMenu();
2369 else
2370 FlGui::instance()->graph[0]->attachMenu();
2371 }
2372 #endif
2373 return CTX::instance()->detachedMenu;
2374 }
2375
opt_general_detached_process(OPT_ARGS_NUM)2376 double opt_general_detached_process(OPT_ARGS_NUM)
2377 {
2378 if(action & GMSH_SET) CTX::instance()->detachedProcess = (int)val;
2379 return CTX::instance()->detachedProcess;
2380 }
2381
opt_general_menu_size0(OPT_ARGS_NUM)2382 double opt_general_menu_size0(OPT_ARGS_NUM)
2383 {
2384 if(action & GMSH_SET) {
2385 CTX::instance()->menuSize[0] = (int)val;
2386 if(CTX::instance()->menuSize[0] < 0) CTX::instance()->menuSize[0] = 0;
2387 }
2388 #if defined(HAVE_FLTK)
2389 if(FlGui::available() && (action & GMSH_GUI)) {
2390 FlGui::instance()->graph[0]->setMenuWidth(CTX::instance()->menuSize[0]);
2391 }
2392 #endif
2393 return CTX::instance()->menuSize[0];
2394 }
2395
opt_general_menu_size1(OPT_ARGS_NUM)2396 double opt_general_menu_size1(OPT_ARGS_NUM)
2397 {
2398 if(action & GMSH_SET) {
2399 CTX::instance()->menuSize[1] = (int)val;
2400 if(CTX::instance()->menuSize[1] < 0) CTX::instance()->menuSize[1] = 300;
2401 }
2402 return CTX::instance()->menuSize[1];
2403 }
2404
opt_general_menu_position0(OPT_ARGS_NUM)2405 double opt_general_menu_position0(OPT_ARGS_NUM)
2406 {
2407 if(action & GMSH_SET) {
2408 CTX::instance()->menuPosition[0] = (int)val;
2409 if(CTX::instance()->menuPosition[0] < 0)
2410 CTX::instance()->menuPosition[0] = 0;
2411 }
2412 return CTX::instance()->menuPosition[0];
2413 }
2414
opt_general_menu_position1(OPT_ARGS_NUM)2415 double opt_general_menu_position1(OPT_ARGS_NUM)
2416 {
2417 if(action & GMSH_SET) {
2418 CTX::instance()->menuPosition[1] = (int)val;
2419 if(CTX::instance()->menuPosition[1] < 0)
2420 CTX::instance()->menuPosition[1] = 300;
2421 }
2422 return CTX::instance()->menuPosition[1];
2423 }
2424
opt_general_option_position0(OPT_ARGS_NUM)2425 double opt_general_option_position0(OPT_ARGS_NUM)
2426 {
2427 if(action & GMSH_SET) CTX::instance()->optPosition[0] = (int)val;
2428 return CTX::instance()->optPosition[0];
2429 }
2430
opt_general_option_position1(OPT_ARGS_NUM)2431 double opt_general_option_position1(OPT_ARGS_NUM)
2432 {
2433 if(action & GMSH_SET) CTX::instance()->optPosition[1] = (int)val;
2434 return CTX::instance()->optPosition[1];
2435 }
2436
opt_general_plugin_position0(OPT_ARGS_NUM)2437 double opt_general_plugin_position0(OPT_ARGS_NUM)
2438 {
2439 if(action & GMSH_SET) CTX::instance()->pluginPosition[0] = (int)val;
2440 return CTX::instance()->pluginPosition[0];
2441 }
2442
opt_general_plugin_position1(OPT_ARGS_NUM)2443 double opt_general_plugin_position1(OPT_ARGS_NUM)
2444 {
2445 if(action & GMSH_SET) CTX::instance()->pluginPosition[1] = (int)val;
2446 return CTX::instance()->pluginPosition[1];
2447 }
2448
opt_general_plugin_size0(OPT_ARGS_NUM)2449 double opt_general_plugin_size0(OPT_ARGS_NUM)
2450 {
2451 if(action & GMSH_SET) CTX::instance()->pluginSize[0] = (int)val;
2452 return CTX::instance()->pluginSize[0];
2453 }
2454
opt_general_plugin_size1(OPT_ARGS_NUM)2455 double opt_general_plugin_size1(OPT_ARGS_NUM)
2456 {
2457 if(action & GMSH_SET) CTX::instance()->pluginSize[1] = (int)val;
2458 return CTX::instance()->pluginSize[1];
2459 }
2460
opt_general_field_position0(OPT_ARGS_NUM)2461 double opt_general_field_position0(OPT_ARGS_NUM)
2462 {
2463 if(action & GMSH_SET) CTX::instance()->fieldPosition[0] = (int)val;
2464 return CTX::instance()->fieldPosition[0];
2465 }
2466
opt_general_field_position1(OPT_ARGS_NUM)2467 double opt_general_field_position1(OPT_ARGS_NUM)
2468 {
2469 if(action & GMSH_SET) CTX::instance()->fieldPosition[1] = (int)val;
2470 return CTX::instance()->fieldPosition[1];
2471 }
2472
opt_general_field_size0(OPT_ARGS_NUM)2473 double opt_general_field_size0(OPT_ARGS_NUM)
2474 {
2475 if(action & GMSH_SET) CTX::instance()->fieldSize[0] = (int)val;
2476 return CTX::instance()->fieldSize[0];
2477 }
2478
opt_general_field_size1(OPT_ARGS_NUM)2479 double opt_general_field_size1(OPT_ARGS_NUM)
2480 {
2481 if(action & GMSH_SET) CTX::instance()->fieldSize[1] = (int)val;
2482 return CTX::instance()->fieldSize[1];
2483 }
2484
opt_general_extra_position0(OPT_ARGS_NUM)2485 double opt_general_extra_position0(OPT_ARGS_NUM)
2486 {
2487 if(action & GMSH_SET) CTX::instance()->extraPosition[0] = (int)val;
2488 return CTX::instance()->extraPosition[0];
2489 }
2490
opt_general_extra_position1(OPT_ARGS_NUM)2491 double opt_general_extra_position1(OPT_ARGS_NUM)
2492 {
2493 if(action & GMSH_SET) CTX::instance()->extraPosition[1] = (int)val;
2494 return CTX::instance()->extraPosition[1];
2495 }
2496
opt_general_extra_size0(OPT_ARGS_NUM)2497 double opt_general_extra_size0(OPT_ARGS_NUM)
2498 {
2499 if(action & GMSH_SET) CTX::instance()->extraSize[0] = (int)val;
2500 return CTX::instance()->extraSize[0];
2501 }
2502
opt_general_extra_size1(OPT_ARGS_NUM)2503 double opt_general_extra_size1(OPT_ARGS_NUM)
2504 {
2505 if(action & GMSH_SET) CTX::instance()->extraSize[1] = (int)val;
2506 return CTX::instance()->extraSize[1];
2507 }
2508
opt_general_statistics_position0(OPT_ARGS_NUM)2509 double opt_general_statistics_position0(OPT_ARGS_NUM)
2510 {
2511 if(action & GMSH_SET) CTX::instance()->statPosition[0] = (int)val;
2512 return CTX::instance()->statPosition[0];
2513 }
2514
opt_general_statistics_position1(OPT_ARGS_NUM)2515 double opt_general_statistics_position1(OPT_ARGS_NUM)
2516 {
2517 if(action & GMSH_SET) CTX::instance()->statPosition[1] = (int)val;
2518 return CTX::instance()->statPosition[1];
2519 }
2520
opt_general_visibility_position0(OPT_ARGS_NUM)2521 double opt_general_visibility_position0(OPT_ARGS_NUM)
2522 {
2523 if(action & GMSH_SET) CTX::instance()->visPosition[0] = (int)val;
2524 return CTX::instance()->visPosition[0];
2525 }
2526
opt_general_visibility_position1(OPT_ARGS_NUM)2527 double opt_general_visibility_position1(OPT_ARGS_NUM)
2528 {
2529 if(action & GMSH_SET) CTX::instance()->visPosition[1] = (int)val;
2530 return CTX::instance()->visPosition[1];
2531 }
2532
opt_general_clip_position0(OPT_ARGS_NUM)2533 double opt_general_clip_position0(OPT_ARGS_NUM)
2534 {
2535 if(action & GMSH_SET) CTX::instance()->clipPosition[0] = (int)val;
2536 return CTX::instance()->clipPosition[0];
2537 }
2538
opt_general_clip_position1(OPT_ARGS_NUM)2539 double opt_general_clip_position1(OPT_ARGS_NUM)
2540 {
2541 if(action & GMSH_SET) CTX::instance()->clipPosition[1] = (int)val;
2542 return CTX::instance()->clipPosition[1];
2543 }
2544
opt_general_manip_position0(OPT_ARGS_NUM)2545 double opt_general_manip_position0(OPT_ARGS_NUM)
2546 {
2547 if(action & GMSH_SET) CTX::instance()->manipPosition[0] = (int)val;
2548 return CTX::instance()->manipPosition[0];
2549 }
2550
opt_general_manip_position1(OPT_ARGS_NUM)2551 double opt_general_manip_position1(OPT_ARGS_NUM)
2552 {
2553 if(action & GMSH_SET) CTX::instance()->manipPosition[1] = (int)val;
2554 return CTX::instance()->manipPosition[1];
2555 }
2556
opt_general_hot_position0(OPT_ARGS_NUM)2557 double opt_general_hot_position0(OPT_ARGS_NUM)
2558 {
2559 if(action & GMSH_SET) CTX::instance()->hotPosition[0] = (int)val;
2560 return CTX::instance()->hotPosition[0];
2561 }
2562
opt_general_hot_position1(OPT_ARGS_NUM)2563 double opt_general_hot_position1(OPT_ARGS_NUM)
2564 {
2565 if(action & GMSH_SET) CTX::instance()->hotPosition[1] = (int)val;
2566 return CTX::instance()->hotPosition[1];
2567 }
2568
opt_general_high_resolution_graphics(OPT_ARGS_NUM)2569 double opt_general_high_resolution_graphics(OPT_ARGS_NUM)
2570 {
2571 if(action & GMSH_SET) CTX::instance()->highResolutionGraphics = (int)val;
2572 return CTX::instance()->highResolutionGraphics;
2573 }
2574
opt_general_session_save(OPT_ARGS_NUM)2575 double opt_general_session_save(OPT_ARGS_NUM)
2576 {
2577 if(action & GMSH_SET) CTX::instance()->sessionSave = (int)val;
2578 #if defined(HAVE_FLTK)
2579 if(FlGui::available() && (action & GMSH_GUI))
2580 FlGui::instance()->options->general.butt[8]->value(
2581 CTX::instance()->sessionSave);
2582 #endif
2583 return CTX::instance()->sessionSave;
2584 }
2585
opt_general_options_save(OPT_ARGS_NUM)2586 double opt_general_options_save(OPT_ARGS_NUM)
2587 {
2588 if(action & GMSH_SET) CTX::instance()->optionsSave = (int)val;
2589 #if defined(HAVE_FLTK)
2590 if(FlGui::available() && (action & GMSH_GUI))
2591 FlGui::instance()->options->general.butt[9]->value(
2592 CTX::instance()->optionsSave ? 1 : 0);
2593 #endif
2594 return CTX::instance()->optionsSave;
2595 }
2596
opt_general_confirm_overwrite(OPT_ARGS_NUM)2597 double opt_general_confirm_overwrite(OPT_ARGS_NUM)
2598 {
2599 if(action & GMSH_SET) CTX::instance()->confirmOverwrite = (int)val;
2600 #if defined(HAVE_FLTK)
2601 if(FlGui::available() && (action & GMSH_GUI))
2602 FlGui::instance()->options->general.butt[14]->value(
2603 CTX::instance()->confirmOverwrite);
2604 #endif
2605 return CTX::instance()->confirmOverwrite;
2606 }
2607
opt_general_rotation0(OPT_ARGS_NUM)2608 double opt_general_rotation0(OPT_ARGS_NUM)
2609 {
2610 if(action & GMSH_SET) CTX::instance()->tmpRotation[0] = val;
2611 #if defined(HAVE_FLTK)
2612 if(FlGui::available()) {
2613 openglWindow *gl = FlGui::instance()->getCurrentOpenglWindow();
2614 if(action & GMSH_SET) gl->getDrawContext()->r[0] = val;
2615 return gl->getDrawContext()->r[0];
2616 }
2617 #endif
2618 return CTX::instance()->tmpRotation[0];
2619 }
2620
opt_general_rotation1(OPT_ARGS_NUM)2621 double opt_general_rotation1(OPT_ARGS_NUM)
2622 {
2623 if(action & GMSH_SET) CTX::instance()->tmpRotation[1] = val;
2624 #if defined(HAVE_FLTK)
2625 if(FlGui::available()) {
2626 openglWindow *gl = FlGui::instance()->getCurrentOpenglWindow();
2627 if(action & GMSH_SET) gl->getDrawContext()->r[1] = val;
2628 return gl->getDrawContext()->r[1];
2629 }
2630 #endif
2631 return CTX::instance()->tmpRotation[1];
2632 }
2633
opt_general_rotation2(OPT_ARGS_NUM)2634 double opt_general_rotation2(OPT_ARGS_NUM)
2635 {
2636 if(action & GMSH_SET) CTX::instance()->tmpRotation[2] = val;
2637 #if defined(HAVE_FLTK)
2638 if(FlGui::available()) {
2639 openglWindow *gl = FlGui::instance()->getCurrentOpenglWindow();
2640 if(action & GMSH_SET) gl->getDrawContext()->r[2] = val;
2641 return gl->getDrawContext()->r[2];
2642 }
2643 #endif
2644 return CTX::instance()->tmpRotation[2];
2645 }
2646
opt_general_rotation_center0(OPT_ARGS_NUM)2647 double opt_general_rotation_center0(OPT_ARGS_NUM)
2648 {
2649 if(action & GMSH_SET) CTX::instance()->rotationCenter[0] = val;
2650 #if defined(HAVE_FLTK)
2651 if(FlGui::available() && (action & GMSH_GUI))
2652 FlGui::instance()->options->general.value[8]->value(
2653 CTX::instance()->rotationCenter[0]);
2654 #endif
2655 return CTX::instance()->rotationCenter[0];
2656 }
2657
opt_general_rotation_center1(OPT_ARGS_NUM)2658 double opt_general_rotation_center1(OPT_ARGS_NUM)
2659 {
2660 if(action & GMSH_SET) CTX::instance()->rotationCenter[1] = val;
2661 #if defined(HAVE_FLTK)
2662 if(FlGui::available() && (action & GMSH_GUI))
2663 FlGui::instance()->options->general.value[9]->value(
2664 CTX::instance()->rotationCenter[1]);
2665 #endif
2666 return CTX::instance()->rotationCenter[1];
2667 }
2668
opt_general_rotation_center2(OPT_ARGS_NUM)2669 double opt_general_rotation_center2(OPT_ARGS_NUM)
2670 {
2671 if(action & GMSH_SET) CTX::instance()->rotationCenter[2] = val;
2672 #if defined(HAVE_FLTK)
2673 if(FlGui::available() && (action & GMSH_GUI))
2674 FlGui::instance()->options->general.value[10]->value(
2675 CTX::instance()->rotationCenter[2]);
2676 #endif
2677 return CTX::instance()->rotationCenter[2];
2678 }
2679
opt_general_quaternion0(OPT_ARGS_NUM)2680 double opt_general_quaternion0(OPT_ARGS_NUM)
2681 {
2682 if(action & GMSH_SET) CTX::instance()->tmpQuaternion[0] = val;
2683 #if defined(HAVE_FLTK)
2684 if(FlGui::available()) {
2685 openglWindow *gl = FlGui::instance()->getCurrentOpenglWindow();
2686 if(action & GMSH_SET) gl->getDrawContext()->quaternion[0] = val;
2687 if(action & GMSH_GUI) FlGui::instance()->manip->update();
2688 return gl->getDrawContext()->quaternion[0];
2689 }
2690 #endif
2691 return CTX::instance()->tmpQuaternion[0];
2692 }
2693
opt_general_quaternion1(OPT_ARGS_NUM)2694 double opt_general_quaternion1(OPT_ARGS_NUM)
2695 {
2696 if(action & GMSH_SET) CTX::instance()->tmpQuaternion[1] = val;
2697 #if defined(HAVE_FLTK)
2698 if(FlGui::available()) {
2699 openglWindow *gl = FlGui::instance()->getCurrentOpenglWindow();
2700 if(action & GMSH_SET) gl->getDrawContext()->quaternion[1] = val;
2701 if(action & GMSH_GUI) FlGui::instance()->manip->update();
2702 return gl->getDrawContext()->quaternion[1];
2703 }
2704 #endif
2705 return CTX::instance()->tmpQuaternion[1];
2706 }
2707
opt_general_quaternion2(OPT_ARGS_NUM)2708 double opt_general_quaternion2(OPT_ARGS_NUM)
2709 {
2710 if(action & GMSH_SET) CTX::instance()->tmpQuaternion[2] = val;
2711 #if defined(HAVE_FLTK)
2712 if(FlGui::available()) {
2713 openglWindow *gl = FlGui::instance()->getCurrentOpenglWindow();
2714 if(action & GMSH_SET) gl->getDrawContext()->quaternion[2] = val;
2715 if(action & GMSH_GUI) FlGui::instance()->manip->update();
2716 return gl->getDrawContext()->quaternion[2];
2717 }
2718 #endif
2719 return CTX::instance()->tmpQuaternion[2];
2720 }
2721
opt_general_quaternion3(OPT_ARGS_NUM)2722 double opt_general_quaternion3(OPT_ARGS_NUM)
2723 {
2724 if(action & GMSH_SET) CTX::instance()->tmpQuaternion[3] = val;
2725 #if defined(HAVE_FLTK)
2726 if(FlGui::available()) {
2727 openglWindow *gl = FlGui::instance()->getCurrentOpenglWindow();
2728 if(action & GMSH_SET) gl->getDrawContext()->quaternion[3] = val;
2729 if(action & GMSH_GUI) FlGui::instance()->manip->update();
2730 return gl->getDrawContext()->quaternion[3];
2731 }
2732 #endif
2733 return CTX::instance()->tmpQuaternion[3];
2734 }
2735
opt_general_translation0(OPT_ARGS_NUM)2736 double opt_general_translation0(OPT_ARGS_NUM)
2737 {
2738 if(action & GMSH_SET) CTX::instance()->tmpTranslation[0] = val;
2739 #if defined(HAVE_FLTK)
2740 if(FlGui::available()) {
2741 openglWindow *gl = FlGui::instance()->getCurrentOpenglWindow();
2742 if(action & GMSH_SET) gl->getDrawContext()->t[0] = val;
2743 if(action & GMSH_GUI) FlGui::instance()->manip->update();
2744 return gl->getDrawContext()->t[0];
2745 }
2746 #endif
2747 return CTX::instance()->tmpTranslation[0];
2748 }
2749
opt_general_translation1(OPT_ARGS_NUM)2750 double opt_general_translation1(OPT_ARGS_NUM)
2751 {
2752 if(action & GMSH_SET) CTX::instance()->tmpTranslation[1] = val;
2753 #if defined(HAVE_FLTK)
2754 if(FlGui::available()) {
2755 openglWindow *gl = FlGui::instance()->getCurrentOpenglWindow();
2756 if(action & GMSH_SET) gl->getDrawContext()->t[1] = val;
2757 if(action & GMSH_GUI) FlGui::instance()->manip->update();
2758 return gl->getDrawContext()->t[1];
2759 }
2760 #endif
2761 return CTX::instance()->tmpTranslation[1];
2762 }
2763
opt_general_translation2(OPT_ARGS_NUM)2764 double opt_general_translation2(OPT_ARGS_NUM)
2765 {
2766 if(action & GMSH_SET) CTX::instance()->tmpTranslation[2] = val;
2767 #if defined(HAVE_FLTK)
2768 if(FlGui::available()) {
2769 openglWindow *gl = FlGui::instance()->getCurrentOpenglWindow();
2770 if(action & GMSH_SET) gl->getDrawContext()->t[2] = val;
2771 if(action & GMSH_GUI) FlGui::instance()->manip->update();
2772 return gl->getDrawContext()->t[2];
2773 }
2774 #endif
2775 return CTX::instance()->tmpTranslation[2];
2776 }
2777
opt_general_scale0(OPT_ARGS_NUM)2778 double opt_general_scale0(OPT_ARGS_NUM)
2779 {
2780 if(action & GMSH_SET) CTX::instance()->tmpScale[0] = val ? val : 1.0;
2781 #if defined(HAVE_FLTK)
2782 if(FlGui::available()) {
2783 openglWindow *gl = FlGui::instance()->getCurrentOpenglWindow();
2784 if(action & GMSH_SET) gl->getDrawContext()->s[0] = val ? val : 1.0;
2785 if(action & GMSH_GUI) FlGui::instance()->manip->update();
2786 return gl->getDrawContext()->s[0];
2787 }
2788 #endif
2789 return CTX::instance()->tmpScale[0];
2790 }
2791
opt_general_scale1(OPT_ARGS_NUM)2792 double opt_general_scale1(OPT_ARGS_NUM)
2793 {
2794 if(action & GMSH_SET) CTX::instance()->tmpScale[1] = val ? val : 1.0;
2795 #if defined(HAVE_FLTK)
2796 if(FlGui::available()) {
2797 openglWindow *gl = FlGui::instance()->getCurrentOpenglWindow();
2798 if(action & GMSH_SET) gl->getDrawContext()->s[1] = val ? val : 1.0;
2799 if(action & GMSH_GUI) FlGui::instance()->manip->update();
2800 return gl->getDrawContext()->s[1];
2801 }
2802 #endif
2803 return CTX::instance()->tmpScale[1];
2804 }
2805
opt_general_scale2(OPT_ARGS_NUM)2806 double opt_general_scale2(OPT_ARGS_NUM)
2807 {
2808 if(action & GMSH_SET) CTX::instance()->tmpScale[2] = val ? val : 1.0;
2809 #if defined(HAVE_FLTK)
2810 if(FlGui::available()) {
2811 openglWindow *gl = FlGui::instance()->getCurrentOpenglWindow();
2812 if(action & GMSH_SET) gl->getDrawContext()->s[2] = val ? val : 1.0;
2813 if(action & GMSH_GUI) FlGui::instance()->manip->update();
2814 return gl->getDrawContext()->s[2];
2815 }
2816 #endif
2817 return CTX::instance()->tmpScale[2];
2818 }
2819
opt_general_clip_factor(OPT_ARGS_NUM)2820 double opt_general_clip_factor(OPT_ARGS_NUM)
2821 {
2822 if(action & GMSH_SET) {
2823 // should never be zero (or negative)
2824 if(val < 0.01)
2825 CTX::instance()->clipFactor = 0.01;
2826 else
2827 CTX::instance()->clipFactor = val;
2828 }
2829 #if defined(HAVE_FLTK)
2830 if(FlGui::available() && (action & GMSH_GUI))
2831 FlGui::instance()->options->general.value[14]->value(
2832 CTX::instance()->clipFactor);
2833 #endif
2834 return CTX::instance()->clipFactor;
2835 }
2836
opt_general_display_border_factor(OPT_ARGS_NUM)2837 double opt_general_display_border_factor(OPT_ARGS_NUM)
2838 {
2839 if(action & GMSH_SET) CTX::instance()->displayBorderFactor = val;
2840 return CTX::instance()->displayBorderFactor;
2841 }
2842
opt_geometry_reparam_on_face_robust(OPT_ARGS_NUM)2843 double opt_geometry_reparam_on_face_robust(OPT_ARGS_NUM)
2844 {
2845 if(action & GMSH_SET) CTX::instance()->geom.reparamOnFaceRobust = val;
2846 return CTX::instance()->geom.reparamOnFaceRobust;
2847 }
2848
opt_general_point_size(OPT_ARGS_NUM)2849 double opt_general_point_size(OPT_ARGS_NUM)
2850 {
2851 if(action & GMSH_SET) CTX::instance()->pointSize = val;
2852 #if defined(HAVE_FLTK)
2853 if(FlGui::available() && (action & GMSH_GUI))
2854 FlGui::instance()->options->general.value[6]->value(
2855 CTX::instance()->pointSize);
2856 #endif
2857 return CTX::instance()->pointSize;
2858 }
2859
opt_general_line_width(OPT_ARGS_NUM)2860 double opt_general_line_width(OPT_ARGS_NUM)
2861 {
2862 if(action & GMSH_SET) CTX::instance()->lineWidth = val;
2863 #if defined(HAVE_FLTK)
2864 if(FlGui::available() && (action & GMSH_GUI))
2865 FlGui::instance()->options->general.value[7]->value(
2866 CTX::instance()->lineWidth);
2867 #endif
2868 return CTX::instance()->lineWidth;
2869 }
2870
opt_general_shine(OPT_ARGS_NUM)2871 double opt_general_shine(OPT_ARGS_NUM)
2872 {
2873 if(action & GMSH_SET) CTX::instance()->shine = val;
2874 #if defined(HAVE_FLTK)
2875 if(FlGui::available() && (action & GMSH_GUI))
2876 FlGui::instance()->options->general.value[1]->value(CTX::instance()->shine);
2877 #endif
2878 return CTX::instance()->shine;
2879 }
2880
opt_general_shine_exponent(OPT_ARGS_NUM)2881 double opt_general_shine_exponent(OPT_ARGS_NUM)
2882 {
2883 if(action & GMSH_SET) CTX::instance()->shineExponent = val;
2884 #if defined(HAVE_FLTK)
2885 if(FlGui::available() && (action & GMSH_GUI))
2886 FlGui::instance()->options->general.value[0]->value(
2887 CTX::instance()->shineExponent);
2888 #endif
2889 return CTX::instance()->shineExponent;
2890 }
2891
opt_general_verbosity(OPT_ARGS_NUM)2892 double opt_general_verbosity(OPT_ARGS_NUM)
2893 {
2894 if(action & GMSH_SET) { Msg::SetVerbosity((int)val); }
2895 #if defined(HAVE_FLTK)
2896 if(FlGui::available() && (action & GMSH_GUI))
2897 FlGui::instance()->options->general.value[5]->value(Msg::GetVerbosity());
2898 #endif
2899 return Msg::GetVerbosity();
2900 }
2901
opt_general_progress_meter_step(OPT_ARGS_NUM)2902 double opt_general_progress_meter_step(OPT_ARGS_NUM)
2903 {
2904 if(action & GMSH_SET) { Msg::SetProgressMeterStep((int)val); }
2905 return Msg::GetProgressMeterStep();
2906 }
2907
opt_general_nopopup(OPT_ARGS_NUM)2908 double opt_general_nopopup(OPT_ARGS_NUM)
2909 {
2910 if(action & GMSH_SET) CTX::instance()->noPopup = (int)val;
2911 return CTX::instance()->noPopup;
2912 }
2913
opt_general_non_modal_windows(OPT_ARGS_NUM)2914 double opt_general_non_modal_windows(OPT_ARGS_NUM)
2915 {
2916 if(action & GMSH_SET) CTX::instance()->nonModalWindows = (int)val;
2917 return CTX::instance()->nonModalWindows;
2918 }
2919
opt_general_terminal(OPT_ARGS_NUM)2920 double opt_general_terminal(OPT_ARGS_NUM)
2921 {
2922 if(action & GMSH_SET) CTX::instance()->terminal = (int)val;
2923 #if defined(HAVE_FLTK)
2924 if(FlGui::available() && (action & GMSH_GUI))
2925 FlGui::instance()->options->general.butt[7]->value(
2926 CTX::instance()->terminal);
2927 #endif
2928 return CTX::instance()->terminal;
2929 }
2930
opt_general_tooltips(OPT_ARGS_NUM)2931 double opt_general_tooltips(OPT_ARGS_NUM)
2932 {
2933 if(action & GMSH_SET) {
2934 CTX::instance()->tooltips = (int)val;
2935 #if defined(HAVE_FLTK)
2936 if(CTX::instance()->tooltips)
2937 Fl_Tooltip::enable();
2938 else
2939 Fl_Tooltip::disable();
2940 #endif
2941 }
2942 #if defined(HAVE_FLTK)
2943 if(FlGui::available() && (action & GMSH_GUI))
2944 FlGui::instance()->options->general.butt[13]->value(
2945 CTX::instance()->tooltips);
2946 #endif
2947 return CTX::instance()->tooltips;
2948 }
2949
opt_general_input_scrolling(OPT_ARGS_NUM)2950 double opt_general_input_scrolling(OPT_ARGS_NUM)
2951 {
2952 if(action & GMSH_SET) { CTX::instance()->inputScrolling = (int)val; }
2953 return CTX::instance()->inputScrolling;
2954 }
2955
opt_general_orthographic(OPT_ARGS_NUM)2956 double opt_general_orthographic(OPT_ARGS_NUM)
2957 {
2958 if(action & GMSH_SET) CTX::instance()->ortho = (int)val;
2959 #if defined(HAVE_FLTK)
2960 if(FlGui::available() && (action & GMSH_GUI)) {
2961 if(CTX::instance()->ortho) {
2962 FlGui::instance()->options->general.choice[2]->value(0);
2963 if(FlGui::available()) Msg::StatusBar(false, "Orthographic projection");
2964 }
2965 else {
2966 FlGui::instance()->options->general.choice[2]->value(1);
2967 if(FlGui::available()) Msg::StatusBar(false, "Perspective projection");
2968 }
2969 }
2970 #endif
2971 return CTX::instance()->ortho;
2972 }
2973
opt_general_mouse_selection(OPT_ARGS_NUM)2974 double opt_general_mouse_selection(OPT_ARGS_NUM)
2975 {
2976 if(action & GMSH_SET) CTX::instance()->mouseSelection = (int)val;
2977 #if defined(HAVE_FLTK)
2978 if(FlGui::available() && (action & GMSH_GUI)) {
2979 if(CTX::instance()->mouseSelection) {
2980 if(FlGui::available()) Msg::StatusBar(false, "Mouse selection ON");
2981 for(std::size_t i = 0; i < FlGui::instance()->graph.size(); i++)
2982 FlGui::instance()->graph[i]->getSelectionButton()->color(
2983 FL_BACKGROUND_COLOR);
2984 }
2985 else {
2986 if(FlGui::available()) Msg::StatusBar(false, "Mouse selection OFF");
2987 for(std::size_t i = 0; i < FlGui::instance()->graph.size(); i++)
2988 FlGui::instance()->graph[i]->getSelectionButton()->color(FL_RED);
2989 }
2990 for(std::size_t i = 0; i < FlGui::instance()->graph.size(); i++)
2991 FlGui::instance()->graph[i]->getSelectionButton()->redraw();
2992 }
2993 #endif
2994 return CTX::instance()->mouseSelection;
2995 }
2996
opt_general_mouse_hover_meshes(OPT_ARGS_NUM)2997 double opt_general_mouse_hover_meshes(OPT_ARGS_NUM)
2998 {
2999 if(action & GMSH_SET) CTX::instance()->mouseHoverMeshes = (int)val;
3000 #if defined(HAVE_FLTK)
3001 if(FlGui::available() && (action & GMSH_GUI))
3002 FlGui::instance()->options->general.butt[11]->value(
3003 CTX::instance()->mouseHoverMeshes);
3004 #endif
3005 return CTX::instance()->mouseHoverMeshes;
3006 }
3007
opt_general_mouse_invert_zoom(OPT_ARGS_NUM)3008 double opt_general_mouse_invert_zoom(OPT_ARGS_NUM)
3009 {
3010 if(action & GMSH_SET) CTX::instance()->mouseInvertZoom = (int)val;
3011 #if defined(HAVE_FLTK)
3012 if(FlGui::available() && (action & GMSH_GUI))
3013 FlGui::instance()->options->general.butt[22]->value(
3014 CTX::instance()->mouseInvertZoom);
3015 #endif
3016 return CTX::instance()->mouseInvertZoom;
3017 }
3018
opt_general_fast_redraw(OPT_ARGS_NUM)3019 double opt_general_fast_redraw(OPT_ARGS_NUM)
3020 {
3021 if(action & GMSH_SET) CTX::instance()->fastRedraw = (int)val;
3022 #if defined(HAVE_FLTK)
3023 if(FlGui::available() && (action & GMSH_GUI)) {
3024 FlGui::instance()->options->general.butt[2]->value(
3025 CTX::instance()->fastRedraw);
3026 FlGui::instance()->options->activate("fast_redraw");
3027 }
3028 #endif
3029 return CTX::instance()->fastRedraw;
3030 }
3031
opt_general_draw_bounding_box(OPT_ARGS_NUM)3032 double opt_general_draw_bounding_box(OPT_ARGS_NUM)
3033 {
3034 if(action & GMSH_SET) CTX::instance()->drawBBox = (int)val;
3035 #if defined(HAVE_FLTK)
3036 if(FlGui::available() && (action & GMSH_GUI))
3037 FlGui::instance()->options->general.butt[6]->value(
3038 CTX::instance()->drawBBox);
3039 #endif
3040 return CTX::instance()->drawBBox;
3041 }
3042
opt_general_xmin(OPT_ARGS_NUM)3043 double opt_general_xmin(OPT_ARGS_NUM)
3044 {
3045 SBoundingBox3d bb = GModel::current()->bounds();
3046 return bb.empty() ? 0. : bb.min().x();
3047 }
3048
opt_general_xmax(OPT_ARGS_NUM)3049 double opt_general_xmax(OPT_ARGS_NUM)
3050 {
3051 SBoundingBox3d bb = GModel::current()->bounds();
3052 return bb.empty() ? 0. : bb.max().x();
3053 }
3054
opt_general_ymin(OPT_ARGS_NUM)3055 double opt_general_ymin(OPT_ARGS_NUM)
3056 {
3057 SBoundingBox3d bb = GModel::current()->bounds();
3058 return bb.empty() ? 0. : bb.min().y();
3059 }
3060
opt_general_ymax(OPT_ARGS_NUM)3061 double opt_general_ymax(OPT_ARGS_NUM)
3062 {
3063 SBoundingBox3d bb = GModel::current()->bounds();
3064 return bb.empty() ? 0. : bb.max().y();
3065 }
3066
opt_general_zmin(OPT_ARGS_NUM)3067 double opt_general_zmin(OPT_ARGS_NUM)
3068 {
3069 SBoundingBox3d bb = GModel::current()->bounds();
3070 return bb.empty() ? 0. : bb.min().z();
3071 }
3072
opt_general_zmax(OPT_ARGS_NUM)3073 double opt_general_zmax(OPT_ARGS_NUM)
3074 {
3075 SBoundingBox3d bb = GModel::current()->bounds();
3076 return bb.empty() ? 0. : bb.max().z();
3077 }
3078
opt_general_lc(OPT_ARGS_NUM)3079 double opt_general_lc(OPT_ARGS_NUM) { return CTX::instance()->lc; }
3080
opt_general_axes(OPT_ARGS_NUM)3081 double opt_general_axes(OPT_ARGS_NUM)
3082 {
3083 if(action & GMSH_SET) {
3084 CTX::instance()->axes = (int)val;
3085 if(CTX::instance()->axes < 0 || CTX::instance()->axes > 5)
3086 CTX::instance()->axes = 0;
3087 }
3088 #if defined(HAVE_FLTK)
3089 if(FlGui::available() && (action & GMSH_GUI)) {
3090 FlGui::instance()->options->general.choice[4]->value(CTX::instance()->axes);
3091 FlGui::instance()->options->activate("general_axes");
3092 }
3093 #endif
3094 return CTX::instance()->axes;
3095 }
3096
opt_general_axes_mikado(OPT_ARGS_NUM)3097 double opt_general_axes_mikado(OPT_ARGS_NUM)
3098 {
3099 if(action & GMSH_SET) { CTX::instance()->axesMikado = (int)val; }
3100 #if defined(HAVE_FLTK)
3101 if(FlGui::available() && (action & GMSH_GUI))
3102 FlGui::instance()->options->general.butt[16]->value(
3103 CTX::instance()->axesMikado);
3104 #endif
3105 return CTX::instance()->axesMikado;
3106 }
3107
opt_general_axes_auto_position(OPT_ARGS_NUM)3108 double opt_general_axes_auto_position(OPT_ARGS_NUM)
3109 {
3110 if(action & GMSH_SET) CTX::instance()->axesAutoPosition = (int)val;
3111 #if defined(HAVE_FLTK)
3112 if(FlGui::available() && (action & GMSH_GUI)) {
3113 FlGui::instance()->options->general.butt[0]->value(
3114 CTX::instance()->axesAutoPosition);
3115 FlGui::instance()->options->activate("general_axes_auto");
3116 }
3117 #endif
3118 return CTX::instance()->axesAutoPosition;
3119 }
3120
opt_general_axes_tics0(OPT_ARGS_NUM)3121 double opt_general_axes_tics0(OPT_ARGS_NUM)
3122 {
3123 if(action & GMSH_SET) CTX::instance()->axesTics[0] = val;
3124 #if defined(HAVE_FLTK)
3125 if(FlGui::available() && (action & GMSH_GUI))
3126 FlGui::instance()->options->general.value[17]->value(
3127 CTX::instance()->axesTics[0]);
3128 #endif
3129 return CTX::instance()->axesTics[0];
3130 }
3131
opt_general_axes_tics1(OPT_ARGS_NUM)3132 double opt_general_axes_tics1(OPT_ARGS_NUM)
3133 {
3134 if(action & GMSH_SET) CTX::instance()->axesTics[1] = val;
3135 #if defined(HAVE_FLTK)
3136 if(FlGui::available() && (action & GMSH_GUI))
3137 FlGui::instance()->options->general.value[18]->value(
3138 CTX::instance()->axesTics[1]);
3139 #endif
3140 return CTX::instance()->axesTics[1];
3141 }
3142
opt_general_axes_tics2(OPT_ARGS_NUM)3143 double opt_general_axes_tics2(OPT_ARGS_NUM)
3144 {
3145 if(action & GMSH_SET) CTX::instance()->axesTics[2] = val;
3146 #if defined(HAVE_FLTK)
3147 if(FlGui::available() && (action & GMSH_GUI))
3148 FlGui::instance()->options->general.value[19]->value(
3149 CTX::instance()->axesTics[2]);
3150 #endif
3151 return CTX::instance()->axesTics[2];
3152 }
3153
opt_general_axes_xmin(OPT_ARGS_NUM)3154 double opt_general_axes_xmin(OPT_ARGS_NUM)
3155 {
3156 if(action & GMSH_SET) CTX::instance()->axesPosition[0] = val;
3157 #if defined(HAVE_FLTK)
3158 if(FlGui::available() && (action & GMSH_GUI))
3159 FlGui::instance()->options->general.value[20]->value(
3160 CTX::instance()->axesPosition[0]);
3161 #endif
3162 return CTX::instance()->axesPosition[0];
3163 }
3164
opt_general_axes_xmax(OPT_ARGS_NUM)3165 double opt_general_axes_xmax(OPT_ARGS_NUM)
3166 {
3167 if(action & GMSH_SET) CTX::instance()->axesPosition[1] = val;
3168 #if defined(HAVE_FLTK)
3169 if(FlGui::available() && (action & GMSH_GUI))
3170 FlGui::instance()->options->general.value[23]->value(
3171 CTX::instance()->axesPosition[1]);
3172 #endif
3173 return CTX::instance()->axesPosition[1];
3174 }
3175
opt_general_axes_ymin(OPT_ARGS_NUM)3176 double opt_general_axes_ymin(OPT_ARGS_NUM)
3177 {
3178 if(action & GMSH_SET) CTX::instance()->axesPosition[2] = val;
3179 #if defined(HAVE_FLTK)
3180 if(FlGui::available() && (action & GMSH_GUI))
3181 FlGui::instance()->options->general.value[21]->value(
3182 CTX::instance()->axesPosition[2]);
3183 #endif
3184 return CTX::instance()->axesPosition[2];
3185 }
3186
opt_general_axes_ymax(OPT_ARGS_NUM)3187 double opt_general_axes_ymax(OPT_ARGS_NUM)
3188 {
3189 if(action & GMSH_SET) CTX::instance()->axesPosition[3] = val;
3190 #if defined(HAVE_FLTK)
3191 if(FlGui::available() && (action & GMSH_GUI))
3192 FlGui::instance()->options->general.value[24]->value(
3193 CTX::instance()->axesPosition[3]);
3194 #endif
3195 return CTX::instance()->axesPosition[3];
3196 }
3197
opt_general_axes_zmin(OPT_ARGS_NUM)3198 double opt_general_axes_zmin(OPT_ARGS_NUM)
3199 {
3200 if(action & GMSH_SET) CTX::instance()->axesPosition[4] = val;
3201 #if defined(HAVE_FLTK)
3202 if(FlGui::available() && (action & GMSH_GUI))
3203 FlGui::instance()->options->general.value[22]->value(
3204 CTX::instance()->axesPosition[4]);
3205 #endif
3206 return CTX::instance()->axesPosition[4];
3207 }
3208
opt_general_axes_zmax(OPT_ARGS_NUM)3209 double opt_general_axes_zmax(OPT_ARGS_NUM)
3210 {
3211 if(action & GMSH_SET) CTX::instance()->axesPosition[5] = val;
3212 #if defined(HAVE_FLTK)
3213 if(FlGui::available() && (action & GMSH_GUI))
3214 FlGui::instance()->options->general.value[25]->value(
3215 CTX::instance()->axesPosition[5]);
3216 #endif
3217 return CTX::instance()->axesPosition[5];
3218 }
3219
opt_general_axes_force_value(OPT_ARGS_NUM)3220 double opt_general_axes_force_value(OPT_ARGS_NUM)
3221 {
3222 if(action & GMSH_SET) CTX::instance()->axesForceValue = (int)val;
3223 return CTX::instance()->axesForceValue;
3224 }
3225
opt_general_axes_value_xmin(OPT_ARGS_NUM)3226 double opt_general_axes_value_xmin(OPT_ARGS_NUM)
3227 {
3228 if(action & GMSH_SET) CTX::instance()->axesValue[0] = val;
3229 return CTX::instance()->axesValue[0];
3230 }
3231
opt_general_axes_value_xmax(OPT_ARGS_NUM)3232 double opt_general_axes_value_xmax(OPT_ARGS_NUM)
3233 {
3234 if(action & GMSH_SET) CTX::instance()->axesValue[1] = val;
3235 return CTX::instance()->axesValue[1];
3236 }
3237
opt_general_axes_value_ymin(OPT_ARGS_NUM)3238 double opt_general_axes_value_ymin(OPT_ARGS_NUM)
3239 {
3240 if(action & GMSH_SET) CTX::instance()->axesValue[2] = val;
3241 return CTX::instance()->axesValue[2];
3242 }
3243
opt_general_axes_value_ymax(OPT_ARGS_NUM)3244 double opt_general_axes_value_ymax(OPT_ARGS_NUM)
3245 {
3246 if(action & GMSH_SET) CTX::instance()->axesValue[3] = val;
3247 return CTX::instance()->axesValue[3];
3248 }
3249
opt_general_axes_value_zmin(OPT_ARGS_NUM)3250 double opt_general_axes_value_zmin(OPT_ARGS_NUM)
3251 {
3252 if(action & GMSH_SET) CTX::instance()->axesValue[4] = val;
3253 return CTX::instance()->axesValue[4];
3254 }
3255
opt_general_axes_value_zmax(OPT_ARGS_NUM)3256 double opt_general_axes_value_zmax(OPT_ARGS_NUM)
3257 {
3258 if(action & GMSH_SET) CTX::instance()->axesValue[5] = val;
3259 return CTX::instance()->axesValue[5];
3260 }
3261
opt_general_small_axes(OPT_ARGS_NUM)3262 double opt_general_small_axes(OPT_ARGS_NUM)
3263 {
3264 if(action & GMSH_SET) CTX::instance()->smallAxes = (int)val;
3265 #if defined(HAVE_FLTK)
3266 if(FlGui::available() && (action & GMSH_GUI)) {
3267 FlGui::instance()->options->general.butt[1]->value(
3268 CTX::instance()->smallAxes);
3269 FlGui::instance()->options->activate("general_small_axes");
3270 }
3271 #endif
3272 return CTX::instance()->smallAxes;
3273 }
3274
opt_general_small_axes_position0(OPT_ARGS_NUM)3275 double opt_general_small_axes_position0(OPT_ARGS_NUM)
3276 {
3277 if(action & GMSH_SET) CTX::instance()->smallAxesPos[0] = (int)val;
3278 #if defined(HAVE_FLTK)
3279 if(FlGui::available() && (action & GMSH_GUI))
3280 FlGui::instance()->options->general.value[26]->value(
3281 CTX::instance()->smallAxesPos[0]);
3282 #endif
3283 return CTX::instance()->smallAxesPos[0];
3284 }
3285
opt_general_small_axes_position1(OPT_ARGS_NUM)3286 double opt_general_small_axes_position1(OPT_ARGS_NUM)
3287 {
3288 if(action & GMSH_SET) CTX::instance()->smallAxesPos[1] = (int)val;
3289 #if defined(HAVE_FLTK)
3290 if(FlGui::available() && (action & GMSH_GUI))
3291 FlGui::instance()->options->general.value[27]->value(
3292 CTX::instance()->smallAxesPos[1]);
3293 #endif
3294 return CTX::instance()->smallAxesPos[1];
3295 }
3296
opt_general_small_axes_size(OPT_ARGS_NUM)3297 double opt_general_small_axes_size(OPT_ARGS_NUM)
3298 {
3299 if(action & GMSH_SET) CTX::instance()->smallAxesSize = (int)val;
3300 return CTX::instance()->smallAxesSize;
3301 }
3302
opt_general_quadric_subdivisions(OPT_ARGS_NUM)3303 double opt_general_quadric_subdivisions(OPT_ARGS_NUM)
3304 {
3305 if(action & GMSH_SET) CTX::instance()->quadricSubdivisions = (int)val;
3306 #if defined(HAVE_FLTK)
3307 if(FlGui::available()) {
3308 if(action & GMSH_GUI)
3309 FlGui::instance()->options->general.value[11]->value(
3310 CTX::instance()->quadricSubdivisions);
3311 }
3312 #endif
3313 return CTX::instance()->quadricSubdivisions;
3314 }
3315
opt_general_double_buffer(OPT_ARGS_NUM)3316 double opt_general_double_buffer(OPT_ARGS_NUM)
3317 {
3318 if(action & GMSH_SET) {
3319 CTX::instance()->db = (int)val;
3320 #if defined(HAVE_FLTK)
3321 if(FlGui::available()) {
3322 int mode =
3323 FL_RGB | FL_DEPTH | (CTX::instance()->db ? FL_DOUBLE : FL_SINGLE);
3324 if(CTX::instance()->antialiasing) mode |= FL_MULTISAMPLE;
3325 for(std::size_t i = 0; i < FlGui::instance()->graph.size(); i++)
3326 for(std::size_t j = 0; j < FlGui::instance()->graph[i]->gl.size(); j++)
3327 FlGui::instance()->graph[i]->gl[j]->mode(mode);
3328 }
3329 #endif
3330 }
3331 #if defined(HAVE_FLTK)
3332 if(FlGui::available() && (action & GMSH_GUI))
3333 FlGui::instance()->options->general.butt[3]->value(CTX::instance()->db);
3334 #endif
3335 return CTX::instance()->db;
3336 }
3337
opt_general_antialiasing(OPT_ARGS_NUM)3338 double opt_general_antialiasing(OPT_ARGS_NUM)
3339 {
3340 if(action & GMSH_SET) {
3341 CTX::instance()->antialiasing = (int)val;
3342 #if defined(HAVE_FLTK)
3343 if(FlGui::available()) {
3344 int mode =
3345 FL_RGB | FL_DEPTH | (CTX::instance()->db ? FL_DOUBLE : FL_SINGLE);
3346 if(CTX::instance()->antialiasing) mode |= FL_MULTISAMPLE;
3347 for(std::size_t i = 0; i < FlGui::instance()->graph.size(); i++)
3348 for(std::size_t j = 0; j < FlGui::instance()->graph[i]->gl.size(); j++)
3349 FlGui::instance()->graph[i]->gl[j]->mode(mode);
3350 }
3351 #endif
3352 }
3353 #if defined(HAVE_FLTK)
3354 if(FlGui::available() && (action & GMSH_GUI))
3355 FlGui::instance()->options->general.butt[12]->value(
3356 CTX::instance()->antialiasing);
3357 #endif
3358 return CTX::instance()->antialiasing;
3359 }
3360
opt_general_alpha_blending(OPT_ARGS_NUM)3361 double opt_general_alpha_blending(OPT_ARGS_NUM)
3362 {
3363 if(action & GMSH_SET) CTX::instance()->alpha = (int)val;
3364 return CTX::instance()->alpha;
3365 }
3366
opt_general_vector_type(OPT_ARGS_NUM)3367 double opt_general_vector_type(OPT_ARGS_NUM)
3368 {
3369 if(action & GMSH_SET) {
3370 CTX::instance()->vectorType = (int)val;
3371 if(CTX::instance()->vectorType < 1 || CTX::instance()->vectorType > 4)
3372 CTX::instance()->vectorType = 1;
3373 }
3374 #if defined(HAVE_FLTK)
3375 if(FlGui::available() && (action & GMSH_GUI)) {
3376 FlGui::instance()->options->general.choice[0]->value(
3377 CTX::instance()->vectorType - 1);
3378 }
3379 #endif
3380 return CTX::instance()->vectorType;
3381 }
3382
opt_general_arrow_head_radius(OPT_ARGS_NUM)3383 double opt_general_arrow_head_radius(OPT_ARGS_NUM)
3384 {
3385 if(action & GMSH_SET) {
3386 if(val < 0.) val = 0.;
3387 if(val > 1.) val = 1.;
3388 CTX::instance()->arrowRelHeadRadius = val;
3389 }
3390 return CTX::instance()->arrowRelHeadRadius;
3391 }
3392
opt_general_arrow_stem_length(OPT_ARGS_NUM)3393 double opt_general_arrow_stem_length(OPT_ARGS_NUM)
3394 {
3395 if(action & GMSH_SET) {
3396 if(val < 0.) val = 0.;
3397 if(val > 1.) val = 1.;
3398 CTX::instance()->arrowRelStemLength = val;
3399 }
3400 return CTX::instance()->arrowRelStemLength;
3401 }
3402
opt_general_arrow_stem_radius(OPT_ARGS_NUM)3403 double opt_general_arrow_stem_radius(OPT_ARGS_NUM)
3404 {
3405 if(action & GMSH_SET) {
3406 if(val < 0.) val = 0.;
3407 if(val > 1.) val = 1.;
3408 CTX::instance()->arrowRelStemRadius = val;
3409 }
3410 return CTX::instance()->arrowRelStemRadius;
3411 }
3412
opt_general_color_scheme(OPT_ARGS_NUM)3413 double opt_general_color_scheme(OPT_ARGS_NUM)
3414 {
3415 if(action & GMSH_SET) {
3416 CTX::instance()->colorScheme = (int)val;
3417 if(CTX::instance()->colorScheme > 3) CTX::instance()->colorScheme = 0;
3418 SetDefaultColorOptions(0, GeneralOptions_Color);
3419 SetDefaultColorOptions(0, GeometryOptions_Color);
3420 SetDefaultColorOptions(0, MeshOptions_Color);
3421 SetDefaultColorOptions(0, SolverOptions_Color);
3422 SetDefaultColorOptions(0, PostProcessingOptions_Color);
3423 #if defined(HAVE_POST)
3424 for(std::size_t i = 0; i < PView::list.size(); i++)
3425 SetDefaultColorOptions(i, ViewOptions_Color);
3426 #endif
3427 SetDefaultColorOptions(0, PrintOptions_Color);
3428
3429 SetColorOptionsGUI(0, GeneralOptions_Color);
3430 SetColorOptionsGUI(0, GeometryOptions_Color);
3431 SetColorOptionsGUI(0, MeshOptions_Color);
3432 SetColorOptionsGUI(0, SolverOptions_Color);
3433 SetColorOptionsGUI(0, PostProcessingOptions_Color);
3434 #if defined(HAVE_POST)
3435 for(std::size_t i = 0; i < PView::list.size(); i++)
3436 SetColorOptionsGUI(i, ViewOptions_Color);
3437 #endif
3438 SetColorOptionsGUI(0, PrintOptions_Color);
3439
3440 #if defined(HAVE_POST)
3441 // horrible trick so that opt_view_XXX will act on the reference view
3442 std::vector<PView *> tmp = PView::list;
3443 PView::list.clear();
3444 SetDefaultColorOptions(0, ViewOptions_Color);
3445 PView::list = tmp;
3446 #endif
3447 }
3448 #if defined(HAVE_FLTK)
3449 if(FlGui::available() && (action & GMSH_GUI))
3450 FlGui::instance()->options->general.choice[3]->value(
3451 CTX::instance()->colorScheme);
3452 #endif
3453 return CTX::instance()->colorScheme;
3454 }
3455
opt_general_background_gradient(OPT_ARGS_NUM)3456 double opt_general_background_gradient(OPT_ARGS_NUM)
3457 {
3458 if(action & GMSH_SET) {
3459 CTX::instance()->bgGradient = (int)val;
3460 if(CTX::instance()->bgGradient < 0 || CTX::instance()->bgGradient > 3)
3461 CTX::instance()->bgGradient = 0;
3462 }
3463 #if defined(HAVE_FLTK)
3464 if(FlGui::available() && (action & GMSH_GUI))
3465 FlGui::instance()->options->general.choice[5]->value(
3466 CTX::instance()->bgGradient);
3467 #endif
3468 return CTX::instance()->bgGradient;
3469 }
3470
opt_general_background_image_position0(OPT_ARGS_NUM)3471 double opt_general_background_image_position0(OPT_ARGS_NUM)
3472 {
3473 if(action & GMSH_SET) CTX::instance()->bgImagePosition[0] = val;
3474 return CTX::instance()->bgImagePosition[0];
3475 }
3476
opt_general_background_image_position1(OPT_ARGS_NUM)3477 double opt_general_background_image_position1(OPT_ARGS_NUM)
3478 {
3479 if(action & GMSH_SET) CTX::instance()->bgImagePosition[1] = val;
3480 return CTX::instance()->bgImagePosition[1];
3481 }
3482
opt_general_background_image_size0(OPT_ARGS_NUM)3483 double opt_general_background_image_size0(OPT_ARGS_NUM)
3484 {
3485 if(action & GMSH_SET) CTX::instance()->bgImageSize[0] = val;
3486 return CTX::instance()->bgImageSize[0];
3487 }
3488
opt_general_background_image_size1(OPT_ARGS_NUM)3489 double opt_general_background_image_size1(OPT_ARGS_NUM)
3490 {
3491 if(action & GMSH_SET) CTX::instance()->bgImageSize[1] = val;
3492 return CTX::instance()->bgImageSize[1];
3493 }
3494
opt_general_background_image_3d(OPT_ARGS_NUM)3495 double opt_general_background_image_3d(OPT_ARGS_NUM)
3496 {
3497 if(action & GMSH_SET) CTX::instance()->bgImage3d = (int)val;
3498 return CTX::instance()->bgImage3d;
3499 }
3500
opt_general_background_image_page(OPT_ARGS_NUM)3501 double opt_general_background_image_page(OPT_ARGS_NUM)
3502 {
3503 if(action & GMSH_SET) CTX::instance()->bgImagePage = (int)val;
3504 return CTX::instance()->bgImagePage;
3505 }
3506
opt_general_trackball(OPT_ARGS_NUM)3507 double opt_general_trackball(OPT_ARGS_NUM)
3508 {
3509 if(action & GMSH_SET) CTX::instance()->useTrackball = (int)val;
3510 #if defined(HAVE_FLTK)
3511 if(FlGui::available() && (action & GMSH_GUI))
3512 FlGui::instance()->options->general.butt[5]->value(
3513 CTX::instance()->useTrackball);
3514 #endif
3515 return CTX::instance()->useTrackball;
3516 }
3517
opt_general_trackball_hyperbolic_sheet(OPT_ARGS_NUM)3518 double opt_general_trackball_hyperbolic_sheet(OPT_ARGS_NUM)
3519 {
3520 if(action & GMSH_SET) CTX::instance()->trackballHyperbolicSheet = (int)val;
3521 return CTX::instance()->trackballHyperbolicSheet;
3522 }
3523
opt_general_gamepad(OPT_ARGS_NUM)3524 double opt_general_gamepad(OPT_ARGS_NUM)
3525 {
3526 if(action & GMSH_SET) {
3527 if(val) {
3528 if(!CTX::instance()->gamepad) {
3529 CTX::instance()->gamepad = new GamePad();
3530 if(CTX::instance()->gamepad->active)
3531 opt_general_camera_mode(0, GMSH_SET, 1);
3532 }
3533 }
3534 else {
3535 if(CTX::instance()->gamepad) {
3536 delete CTX::instance()->gamepad;
3537 CTX::instance()->gamepad = nullptr;
3538 }
3539 }
3540 }
3541 return CTX::instance()->gamepad ? 1 : 0;
3542 }
3543
opt_general_rotation_center_cg(OPT_ARGS_NUM)3544 double opt_general_rotation_center_cg(OPT_ARGS_NUM)
3545 {
3546 if(action & GMSH_SET) CTX::instance()->rotationCenterCg = (int)val;
3547 #if defined(HAVE_FLTK)
3548 if(FlGui::available() && (action & GMSH_GUI)) {
3549 FlGui::instance()->options->general.butt[15]->value(
3550 CTX::instance()->rotationCenterCg);
3551 FlGui::instance()->options->activate("rotation_center");
3552 }
3553 #endif
3554 return CTX::instance()->rotationCenterCg;
3555 }
3556
opt_general_zoom_factor(OPT_ARGS_NUM)3557 double opt_general_zoom_factor(OPT_ARGS_NUM)
3558 {
3559 if(action & GMSH_SET) CTX::instance()->zoomFactor = val;
3560 return CTX::instance()->zoomFactor;
3561 }
3562
opt_general_expert_mode(OPT_ARGS_NUM)3563 double opt_general_expert_mode(OPT_ARGS_NUM)
3564 {
3565 if(action & GMSH_SET) CTX::instance()->expertMode = (int)val;
3566 #if defined(HAVE_FLTK)
3567 if(FlGui::available() && (action & GMSH_GUI))
3568 FlGui::instance()->options->general.butt[10]->value(
3569 CTX::instance()->expertMode);
3570 #endif
3571 return CTX::instance()->expertMode;
3572 }
3573
3574 #if defined(HAVE_VISUDEV)
opt_general_heavy_visualization(OPT_ARGS_NUM)3575 double opt_general_heavy_visualization(OPT_ARGS_NUM)
3576 {
3577 if(action & GMSH_SET) {
3578 if(CTX::instance()->heavyVisu != val)
3579 CTX::instance()->mesh.changed |= (ENT_CURVE | ENT_SURFACE | ENT_VOLUME);
3580 CTX::instance()->heavyVisu = (int)val;
3581 }
3582 #if defined(HAVE_FLTK)
3583 if(FlGui::available() && (action & GMSH_GUI))
3584 FlGui::instance()->options->general.butt[20]->value(
3585 CTX::instance()->heavyVisu);
3586 #endif
3587 return CTX::instance()->heavyVisu;
3588 }
3589 #endif
3590
opt_general_stereo_mode(OPT_ARGS_NUM)3591 double opt_general_stereo_mode(OPT_ARGS_NUM)
3592 {
3593 if(action & GMSH_SET) CTX::instance()->stereo = (int)val;
3594 if(CTX::instance()->stereo) opt_general_camera_mode(num, action, 1.);
3595 #if defined(HAVE_FLTK)
3596 if(FlGui::available() && (action & GMSH_GUI))
3597 FlGui::instance()->options->general.butt[17]->value(CTX::instance()->stereo);
3598 #endif
3599 return CTX::instance()->stereo;
3600 }
3601
opt_general_eye_sep_ratio(OPT_ARGS_NUM)3602 double opt_general_eye_sep_ratio(OPT_ARGS_NUM)
3603 {
3604 if(action & GMSH_SET) CTX::instance()->eye_sep_ratio = (double)val;
3605 #if defined(HAVE_FLTK)
3606 if(FlGui::available() && (action & GMSH_GUI))
3607 FlGui::instance()->options->general.value[29]->value
3608 (CTX::instance()->eye_sep_ratio) ;
3609 #endif
3610 return CTX::instance()->eye_sep_ratio;
3611 }
3612
opt_general_focallength_ratio(OPT_ARGS_NUM)3613 double opt_general_focallength_ratio(OPT_ARGS_NUM)
3614 {
3615 if(action & GMSH_SET) CTX::instance()->focallength_ratio = (double)val;
3616 #if defined(HAVE_FLTK)
3617 if(FlGui::available() && (action & GMSH_GUI))
3618 FlGui::instance()->options->general.value[30]->value
3619 (CTX::instance()->focallength_ratio);
3620 #endif
3621 return CTX::instance()->focallength_ratio;
3622 }
3623
opt_general_camera_aperture(OPT_ARGS_NUM)3624 double opt_general_camera_aperture(OPT_ARGS_NUM)
3625 {
3626 if(action & GMSH_SET) CTX::instance()->camera_aperture = (double)val;
3627 #if defined(HAVE_FLTK)
3628 if(FlGui::available() && (action & GMSH_GUI))
3629 FlGui::instance()->options->general.value[31]->value
3630 (CTX::instance()->camera_aperture);
3631 #endif
3632 return CTX::instance()->camera_aperture;
3633 }
3634
opt_general_camera_mode(OPT_ARGS_NUM)3635 double opt_general_camera_mode(OPT_ARGS_NUM)
3636 {
3637 if(action & GMSH_SET) CTX::instance()->camera = (int)val;
3638 #if defined(HAVE_FLTK)
3639 if(FlGui::available() && (action & GMSH_GUI)){
3640 FlGui::instance()->options->general.butt[18]->value
3641 (CTX::instance()->camera);
3642 FlGui::instance()->options->activate("general_camera");
3643 }
3644 #endif
3645 return CTX::instance()->camera;
3646 }
3647
opt_general_clip0a(OPT_ARGS_NUM)3648 double opt_general_clip0a(OPT_ARGS_NUM)
3649 {
3650 if(action & GMSH_SET) CTX::instance()->clipPlane[0][0] = val;
3651 #if defined(HAVE_FLTK)
3652 if(FlGui::available() && (action & GMSH_GUI))
3653 FlGui::instance()->clipping->resetBrowser();
3654 #endif
3655 return CTX::instance()->clipPlane[0][0];
3656 }
3657
opt_general_clip0b(OPT_ARGS_NUM)3658 double opt_general_clip0b(OPT_ARGS_NUM)
3659 {
3660 if(action & GMSH_SET) CTX::instance()->clipPlane[0][1] = val;
3661 #if defined(HAVE_FLTK)
3662 if(FlGui::available() && (action & GMSH_GUI))
3663 FlGui::instance()->clipping->resetBrowser();
3664 #endif
3665 return CTX::instance()->clipPlane[0][1];
3666 }
3667
opt_general_clip0c(OPT_ARGS_NUM)3668 double opt_general_clip0c(OPT_ARGS_NUM)
3669 {
3670 if(action & GMSH_SET) CTX::instance()->clipPlane[0][2] = val;
3671 #if defined(HAVE_FLTK)
3672 if(FlGui::available() && (action & GMSH_GUI))
3673 FlGui::instance()->clipping->resetBrowser();
3674 #endif
3675 return CTX::instance()->clipPlane[0][2];
3676 }
3677
opt_general_clip0d(OPT_ARGS_NUM)3678 double opt_general_clip0d(OPT_ARGS_NUM)
3679 {
3680 if(action & GMSH_SET) CTX::instance()->clipPlane[0][3] = val;
3681 #if defined(HAVE_FLTK)
3682 if(FlGui::available() && (action & GMSH_GUI))
3683 FlGui::instance()->clipping->resetBrowser();
3684 #endif
3685 return CTX::instance()->clipPlane[0][3];
3686 }
3687
opt_general_clip1a(OPT_ARGS_NUM)3688 double opt_general_clip1a(OPT_ARGS_NUM)
3689 {
3690 if(action & GMSH_SET) CTX::instance()->clipPlane[1][0] = val;
3691 #if defined(HAVE_FLTK)
3692 if(FlGui::available() && (action & GMSH_GUI))
3693 FlGui::instance()->clipping->resetBrowser();
3694 #endif
3695 return CTX::instance()->clipPlane[1][0];
3696 }
3697
opt_general_clip1b(OPT_ARGS_NUM)3698 double opt_general_clip1b(OPT_ARGS_NUM)
3699 {
3700 if(action & GMSH_SET) CTX::instance()->clipPlane[1][1] = val;
3701 #if defined(HAVE_FLTK)
3702 if(FlGui::available() && (action & GMSH_GUI))
3703 FlGui::instance()->clipping->resetBrowser();
3704 #endif
3705 return CTX::instance()->clipPlane[1][1];
3706 }
3707
opt_general_clip1c(OPT_ARGS_NUM)3708 double opt_general_clip1c(OPT_ARGS_NUM)
3709 {
3710 if(action & GMSH_SET) CTX::instance()->clipPlane[1][2] = val;
3711 #if defined(HAVE_FLTK)
3712 if(FlGui::available() && (action & GMSH_GUI))
3713 FlGui::instance()->clipping->resetBrowser();
3714 #endif
3715 return CTX::instance()->clipPlane[1][2];
3716 }
3717
opt_general_clip1d(OPT_ARGS_NUM)3718 double opt_general_clip1d(OPT_ARGS_NUM)
3719 {
3720 if(action & GMSH_SET) CTX::instance()->clipPlane[1][3] = val;
3721 #if defined(HAVE_FLTK)
3722 if(FlGui::available() && (action & GMSH_GUI))
3723 FlGui::instance()->clipping->resetBrowser();
3724 #endif
3725 return CTX::instance()->clipPlane[1][3];
3726 }
3727
opt_general_clip2a(OPT_ARGS_NUM)3728 double opt_general_clip2a(OPT_ARGS_NUM)
3729 {
3730 if(action & GMSH_SET) CTX::instance()->clipPlane[2][0] = val;
3731 #if defined(HAVE_FLTK)
3732 if(FlGui::available() && (action & GMSH_GUI))
3733 FlGui::instance()->clipping->resetBrowser();
3734 #endif
3735 return CTX::instance()->clipPlane[2][0];
3736 }
3737
opt_general_clip2b(OPT_ARGS_NUM)3738 double opt_general_clip2b(OPT_ARGS_NUM)
3739 {
3740 if(action & GMSH_SET) CTX::instance()->clipPlane[2][1] = val;
3741 #if defined(HAVE_FLTK)
3742 if(FlGui::available() && (action & GMSH_GUI))
3743 FlGui::instance()->clipping->resetBrowser();
3744 #endif
3745 return CTX::instance()->clipPlane[2][1];
3746 }
3747
opt_general_clip2c(OPT_ARGS_NUM)3748 double opt_general_clip2c(OPT_ARGS_NUM)
3749 {
3750 if(action & GMSH_SET) CTX::instance()->clipPlane[2][2] = val;
3751 #if defined(HAVE_FLTK)
3752 if(FlGui::available() && (action & GMSH_GUI))
3753 FlGui::instance()->clipping->resetBrowser();
3754 #endif
3755 return CTX::instance()->clipPlane[2][2];
3756 }
3757
opt_general_clip2d(OPT_ARGS_NUM)3758 double opt_general_clip2d(OPT_ARGS_NUM)
3759 {
3760 if(action & GMSH_SET) CTX::instance()->clipPlane[2][3] = val;
3761 #if defined(HAVE_FLTK)
3762 if(FlGui::available() && (action & GMSH_GUI))
3763 FlGui::instance()->clipping->resetBrowser();
3764 #endif
3765 return CTX::instance()->clipPlane[2][3];
3766 }
3767
opt_general_clip3a(OPT_ARGS_NUM)3768 double opt_general_clip3a(OPT_ARGS_NUM)
3769 {
3770 if(action & GMSH_SET) CTX::instance()->clipPlane[3][0] = val;
3771 #if defined(HAVE_FLTK)
3772 if(FlGui::available() && (action & GMSH_GUI))
3773 FlGui::instance()->clipping->resetBrowser();
3774 #endif
3775 return CTX::instance()->clipPlane[3][0];
3776 }
3777
opt_general_clip3b(OPT_ARGS_NUM)3778 double opt_general_clip3b(OPT_ARGS_NUM)
3779 {
3780 if(action & GMSH_SET) CTX::instance()->clipPlane[3][1] = val;
3781 #if defined(HAVE_FLTK)
3782 if(FlGui::available() && (action & GMSH_GUI))
3783 FlGui::instance()->clipping->resetBrowser();
3784 #endif
3785 return CTX::instance()->clipPlane[3][1];
3786 }
3787
opt_general_clip3c(OPT_ARGS_NUM)3788 double opt_general_clip3c(OPT_ARGS_NUM)
3789 {
3790 if(action & GMSH_SET) CTX::instance()->clipPlane[3][2] = val;
3791 #if defined(HAVE_FLTK)
3792 if(FlGui::available() && (action & GMSH_GUI))
3793 FlGui::instance()->clipping->resetBrowser();
3794 #endif
3795 return CTX::instance()->clipPlane[3][2];
3796 }
3797
opt_general_clip3d(OPT_ARGS_NUM)3798 double opt_general_clip3d(OPT_ARGS_NUM)
3799 {
3800 if(action & GMSH_SET) CTX::instance()->clipPlane[3][3] = val;
3801 #if defined(HAVE_FLTK)
3802 if(FlGui::available() && (action & GMSH_GUI))
3803 FlGui::instance()->clipping->resetBrowser();
3804 #endif
3805 return CTX::instance()->clipPlane[3][3];
3806 }
3807
opt_general_clip4a(OPT_ARGS_NUM)3808 double opt_general_clip4a(OPT_ARGS_NUM)
3809 {
3810 if(action & GMSH_SET) CTX::instance()->clipPlane[4][0] = val;
3811 #if defined(HAVE_FLTK)
3812 if(FlGui::available() && (action & GMSH_GUI))
3813 FlGui::instance()->clipping->resetBrowser();
3814 #endif
3815 return CTX::instance()->clipPlane[4][0];
3816 }
3817
opt_general_clip4b(OPT_ARGS_NUM)3818 double opt_general_clip4b(OPT_ARGS_NUM)
3819 {
3820 if(action & GMSH_SET) CTX::instance()->clipPlane[4][1] = val;
3821 #if defined(HAVE_FLTK)
3822 if(FlGui::available() && (action & GMSH_GUI))
3823 FlGui::instance()->clipping->resetBrowser();
3824 #endif
3825 return CTX::instance()->clipPlane[4][1];
3826 }
3827
opt_general_clip4c(OPT_ARGS_NUM)3828 double opt_general_clip4c(OPT_ARGS_NUM)
3829 {
3830 if(action & GMSH_SET) CTX::instance()->clipPlane[4][2] = val;
3831 #if defined(HAVE_FLTK)
3832 if(FlGui::available() && (action & GMSH_GUI))
3833 FlGui::instance()->clipping->resetBrowser();
3834 #endif
3835 return CTX::instance()->clipPlane[4][2];
3836 }
3837
opt_general_clip4d(OPT_ARGS_NUM)3838 double opt_general_clip4d(OPT_ARGS_NUM)
3839 {
3840 if(action & GMSH_SET) CTX::instance()->clipPlane[4][3] = val;
3841 #if defined(HAVE_FLTK)
3842 if(FlGui::available() && (action & GMSH_GUI))
3843 FlGui::instance()->clipping->resetBrowser();
3844 #endif
3845 return CTX::instance()->clipPlane[4][3];
3846 }
3847
opt_general_clip5a(OPT_ARGS_NUM)3848 double opt_general_clip5a(OPT_ARGS_NUM)
3849 {
3850 if(action & GMSH_SET) CTX::instance()->clipPlane[5][0] = val;
3851 #if defined(HAVE_FLTK)
3852 if(FlGui::available() && (action & GMSH_GUI))
3853 FlGui::instance()->clipping->resetBrowser();
3854 #endif
3855 return CTX::instance()->clipPlane[5][0];
3856 }
3857
opt_general_clip5b(OPT_ARGS_NUM)3858 double opt_general_clip5b(OPT_ARGS_NUM)
3859 {
3860 if(action & GMSH_SET) CTX::instance()->clipPlane[5][1] = val;
3861 #if defined(HAVE_FLTK)
3862 if(FlGui::available() && (action & GMSH_GUI))
3863 FlGui::instance()->clipping->resetBrowser();
3864 #endif
3865 return CTX::instance()->clipPlane[5][1];
3866 }
3867
opt_general_clip5c(OPT_ARGS_NUM)3868 double opt_general_clip5c(OPT_ARGS_NUM)
3869 {
3870 if(action & GMSH_SET) CTX::instance()->clipPlane[5][2] = val;
3871 #if defined(HAVE_FLTK)
3872 if(FlGui::available() && (action & GMSH_GUI))
3873 FlGui::instance()->clipping->resetBrowser();
3874 #endif
3875 return CTX::instance()->clipPlane[5][2];
3876 }
3877
opt_general_clip5d(OPT_ARGS_NUM)3878 double opt_general_clip5d(OPT_ARGS_NUM)
3879 {
3880 if(action & GMSH_SET) CTX::instance()->clipPlane[5][3] = val;
3881 #if defined(HAVE_FLTK)
3882 if(FlGui::available() && (action & GMSH_GUI))
3883 FlGui::instance()->clipping->resetBrowser();
3884 #endif
3885 return CTX::instance()->clipPlane[5][3];
3886 }
3887
opt_general_clip_whole_elements(OPT_ARGS_NUM)3888 double opt_general_clip_whole_elements(OPT_ARGS_NUM)
3889 {
3890 if(action & GMSH_SET) CTX::instance()->clipWholeElements = (int)val;
3891 #if defined(HAVE_FLTK)
3892 if(FlGui::available() && (action & GMSH_GUI)) {
3893 FlGui::instance()->clipping->butt[0]->value(
3894 CTX::instance()->clipWholeElements);
3895 FlGui::instance()->options->activate("clip_whole_elements");
3896 }
3897 #endif
3898 return CTX::instance()->clipWholeElements;
3899 }
3900
opt_general_clip_only_draw_intersecting_volume(OPT_ARGS_NUM)3901 double opt_general_clip_only_draw_intersecting_volume(OPT_ARGS_NUM)
3902 {
3903 if(action & GMSH_SET)
3904 CTX::instance()->clipOnlyDrawIntersectingVolume = (int)val;
3905 #if defined(HAVE_FLTK)
3906 if(FlGui::available() && (action & GMSH_GUI))
3907 FlGui::instance()->clipping->butt[1]->value(
3908 CTX::instance()->clipOnlyDrawIntersectingVolume);
3909 #endif
3910 return CTX::instance()->clipOnlyDrawIntersectingVolume;
3911 }
3912
opt_general_clip_only_volume(OPT_ARGS_NUM)3913 double opt_general_clip_only_volume(OPT_ARGS_NUM)
3914 {
3915 if(action & GMSH_SET) CTX::instance()->clipOnlyVolume = (int)val;
3916 #if defined(HAVE_FLTK)
3917 if(FlGui::available() && (action & GMSH_GUI))
3918 FlGui::instance()->clipping->butt[2]->value(
3919 CTX::instance()->clipOnlyVolume);
3920 #endif
3921 return CTX::instance()->clipOnlyVolume;
3922 }
3923
opt_general_light0(OPT_ARGS_NUM)3924 double opt_general_light0(OPT_ARGS_NUM)
3925 {
3926 if(action & GMSH_SET) CTX::instance()->light[0] = (int)val;
3927 return CTX::instance()->light[0];
3928 }
3929
opt_general_light00(OPT_ARGS_NUM)3930 double opt_general_light00(OPT_ARGS_NUM)
3931 {
3932 if(action & GMSH_SET) CTX::instance()->lightPosition[0][0] = val;
3933 #if defined(HAVE_FLTK)
3934 if(FlGui::available() && (action & GMSH_GUI)) {
3935 FlGui::instance()->options->general.value[2]->value(
3936 CTX::instance()->lightPosition[0][0]);
3937 FlGui::instance()->options->general.sphere->setValue(
3938 CTX::instance()->lightPosition[0][0],
3939 CTX::instance()->lightPosition[0][1],
3940 CTX::instance()->lightPosition[0][2]);
3941 }
3942 #endif
3943 return CTX::instance()->lightPosition[0][0];
3944 }
3945
opt_general_light01(OPT_ARGS_NUM)3946 double opt_general_light01(OPT_ARGS_NUM)
3947 {
3948 if(action & GMSH_SET) CTX::instance()->lightPosition[0][1] = val;
3949 #if defined(HAVE_FLTK)
3950 if(FlGui::available() && (action & GMSH_GUI)) {
3951 FlGui::instance()->options->general.value[3]->value(
3952 CTX::instance()->lightPosition[0][1]);
3953 FlGui::instance()->options->general.sphere->setValue(
3954 CTX::instance()->lightPosition[0][0],
3955 CTX::instance()->lightPosition[0][1],
3956 CTX::instance()->lightPosition[0][2]);
3957 }
3958 #endif
3959 return CTX::instance()->lightPosition[0][1];
3960 }
3961
opt_general_light02(OPT_ARGS_NUM)3962 double opt_general_light02(OPT_ARGS_NUM)
3963 {
3964 if(action & GMSH_SET) CTX::instance()->lightPosition[0][2] = val;
3965 #if defined(HAVE_FLTK)
3966 if(FlGui::available() && (action & GMSH_GUI)) {
3967 FlGui::instance()->options->general.value[4]->value(
3968 CTX::instance()->lightPosition[0][2]);
3969 FlGui::instance()->options->general.sphere->setValue(
3970 CTX::instance()->lightPosition[0][0],
3971 CTX::instance()->lightPosition[0][1],
3972 CTX::instance()->lightPosition[0][2]);
3973 }
3974 #endif
3975 return CTX::instance()->lightPosition[0][2];
3976 }
3977
opt_general_light03(OPT_ARGS_NUM)3978 double opt_general_light03(OPT_ARGS_NUM)
3979 {
3980 if(action & GMSH_SET) CTX::instance()->lightPosition[0][3] = val;
3981 #if defined(HAVE_FLTK)
3982 if(FlGui::available() && (action & GMSH_GUI))
3983 FlGui::instance()->options->general.value[13]->value(
3984 CTX::instance()->lightPosition[0][3]);
3985 #endif
3986 return CTX::instance()->lightPosition[0][3];
3987 }
3988
opt_general_light1(OPT_ARGS_NUM)3989 double opt_general_light1(OPT_ARGS_NUM)
3990 {
3991 if(action & GMSH_SET) CTX::instance()->light[1] = (int)val;
3992 return CTX::instance()->light[1];
3993 }
3994
opt_general_light10(OPT_ARGS_NUM)3995 double opt_general_light10(OPT_ARGS_NUM)
3996 {
3997 if(action & GMSH_SET) CTX::instance()->lightPosition[1][0] = val;
3998 return CTX::instance()->lightPosition[1][0];
3999 }
4000
opt_general_light11(OPT_ARGS_NUM)4001 double opt_general_light11(OPT_ARGS_NUM)
4002 {
4003 if(action & GMSH_SET) CTX::instance()->lightPosition[1][1] = val;
4004 return CTX::instance()->lightPosition[1][1];
4005 }
4006
opt_general_light12(OPT_ARGS_NUM)4007 double opt_general_light12(OPT_ARGS_NUM)
4008 {
4009 if(action & GMSH_SET) CTX::instance()->lightPosition[1][2] = val;
4010 return CTX::instance()->lightPosition[1][2];
4011 }
4012
opt_general_light13(OPT_ARGS_NUM)4013 double opt_general_light13(OPT_ARGS_NUM)
4014 {
4015 if(action & GMSH_SET) CTX::instance()->lightPosition[1][3] = val;
4016 return CTX::instance()->lightPosition[1][3];
4017 }
4018
opt_general_light2(OPT_ARGS_NUM)4019 double opt_general_light2(OPT_ARGS_NUM)
4020 {
4021 if(action & GMSH_SET) CTX::instance()->light[2] = (int)val;
4022 return CTX::instance()->light[2];
4023 }
4024
opt_general_light20(OPT_ARGS_NUM)4025 double opt_general_light20(OPT_ARGS_NUM)
4026 {
4027 if(action & GMSH_SET) CTX::instance()->lightPosition[2][0] = val;
4028 return CTX::instance()->lightPosition[2][0];
4029 }
4030
opt_general_light21(OPT_ARGS_NUM)4031 double opt_general_light21(OPT_ARGS_NUM)
4032 {
4033 if(action & GMSH_SET) CTX::instance()->lightPosition[2][1] = val;
4034 return CTX::instance()->lightPosition[2][1];
4035 }
4036
opt_general_light22(OPT_ARGS_NUM)4037 double opt_general_light22(OPT_ARGS_NUM)
4038 {
4039 if(action & GMSH_SET) CTX::instance()->lightPosition[2][2] = val;
4040 return CTX::instance()->lightPosition[2][2];
4041 }
4042
opt_general_light23(OPT_ARGS_NUM)4043 double opt_general_light23(OPT_ARGS_NUM)
4044 {
4045 if(action & GMSH_SET) CTX::instance()->lightPosition[2][3] = val;
4046 return CTX::instance()->lightPosition[2][3];
4047 }
4048
opt_general_light3(OPT_ARGS_NUM)4049 double opt_general_light3(OPT_ARGS_NUM)
4050 {
4051 if(action & GMSH_SET) CTX::instance()->light[3] = (int)val;
4052 return CTX::instance()->light[3];
4053 }
4054
opt_general_light30(OPT_ARGS_NUM)4055 double opt_general_light30(OPT_ARGS_NUM)
4056 {
4057 if(action & GMSH_SET) CTX::instance()->lightPosition[3][0] = val;
4058 return CTX::instance()->lightPosition[3][0];
4059 }
4060
opt_general_light31(OPT_ARGS_NUM)4061 double opt_general_light31(OPT_ARGS_NUM)
4062 {
4063 if(action & GMSH_SET) CTX::instance()->lightPosition[3][1] = val;
4064 return CTX::instance()->lightPosition[3][1];
4065 }
4066
opt_general_light32(OPT_ARGS_NUM)4067 double opt_general_light32(OPT_ARGS_NUM)
4068 {
4069 if(action & GMSH_SET) CTX::instance()->lightPosition[3][2] = val;
4070 return CTX::instance()->lightPosition[3][2];
4071 }
4072
opt_general_light33(OPT_ARGS_NUM)4073 double opt_general_light33(OPT_ARGS_NUM)
4074 {
4075 if(action & GMSH_SET) CTX::instance()->lightPosition[3][3] = val;
4076 return CTX::instance()->lightPosition[3][3];
4077 }
4078
opt_general_light4(OPT_ARGS_NUM)4079 double opt_general_light4(OPT_ARGS_NUM)
4080 {
4081 if(action & GMSH_SET) CTX::instance()->light[4] = (int)val;
4082 return CTX::instance()->light[4];
4083 }
4084
opt_general_light40(OPT_ARGS_NUM)4085 double opt_general_light40(OPT_ARGS_NUM)
4086 {
4087 if(action & GMSH_SET) CTX::instance()->lightPosition[4][0] = val;
4088 return CTX::instance()->lightPosition[4][0];
4089 }
4090
opt_general_light41(OPT_ARGS_NUM)4091 double opt_general_light41(OPT_ARGS_NUM)
4092 {
4093 if(action & GMSH_SET) CTX::instance()->lightPosition[4][1] = val;
4094 return CTX::instance()->lightPosition[4][1];
4095 }
4096
opt_general_light42(OPT_ARGS_NUM)4097 double opt_general_light42(OPT_ARGS_NUM)
4098 {
4099 if(action & GMSH_SET) CTX::instance()->lightPosition[4][2] = val;
4100 return CTX::instance()->lightPosition[4][2];
4101 }
4102
opt_general_light43(OPT_ARGS_NUM)4103 double opt_general_light43(OPT_ARGS_NUM)
4104 {
4105 if(action & GMSH_SET) CTX::instance()->lightPosition[4][3] = val;
4106 return CTX::instance()->lightPosition[4][3];
4107 }
4108
opt_general_light5(OPT_ARGS_NUM)4109 double opt_general_light5(OPT_ARGS_NUM)
4110 {
4111 if(action & GMSH_SET) CTX::instance()->light[5] = (int)val;
4112 return CTX::instance()->light[5];
4113 }
4114
opt_general_light50(OPT_ARGS_NUM)4115 double opt_general_light50(OPT_ARGS_NUM)
4116 {
4117 if(action & GMSH_SET) CTX::instance()->lightPosition[5][0] = val;
4118 return CTX::instance()->lightPosition[5][0];
4119 }
4120
opt_general_light51(OPT_ARGS_NUM)4121 double opt_general_light51(OPT_ARGS_NUM)
4122 {
4123 if(action & GMSH_SET) CTX::instance()->lightPosition[5][1] = val;
4124 return CTX::instance()->lightPosition[5][1];
4125 }
4126
opt_general_light52(OPT_ARGS_NUM)4127 double opt_general_light52(OPT_ARGS_NUM)
4128 {
4129 if(action & GMSH_SET) CTX::instance()->lightPosition[5][2] = val;
4130 return CTX::instance()->lightPosition[5][2];
4131 }
4132
opt_general_light53(OPT_ARGS_NUM)4133 double opt_general_light53(OPT_ARGS_NUM)
4134 {
4135 if(action & GMSH_SET) CTX::instance()->lightPosition[5][3] = val;
4136 return CTX::instance()->lightPosition[5][3];
4137 }
4138
opt_general_num_threads(OPT_ARGS_NUM)4139 double opt_general_num_threads(OPT_ARGS_NUM)
4140 {
4141 if(action & GMSH_SET) {
4142 if(val > 0) Msg::SetNumThreads(val);
4143 else Msg::SetNumThreads(Msg::GetStartMaxThreads());
4144 }
4145 #if defined(HAVE_FLTK)
4146 if(FlGui::available() && (action & GMSH_GUI))
4147 FlGui::instance()->options->general.value[32]->value(Msg::GetMaxThreads());
4148 #endif
4149 return Msg::GetMaxThreads();
4150 }
4151
opt_geometry_transform(OPT_ARGS_NUM)4152 double opt_geometry_transform(OPT_ARGS_NUM)
4153 {
4154 if(action & GMSH_SET) {
4155 CTX::instance()->geom.useTransform = (int)val;
4156 if(CTX::instance()->geom.useTransform < 0 ||
4157 CTX::instance()->geom.useTransform > 1)
4158 CTX::instance()->geom.useTransform = 0;
4159 }
4160 #if defined(HAVE_FLTK)
4161 if(FlGui::available()) {
4162 if(action & GMSH_GUI)
4163 FlGui::instance()->options->geo.choice[3]->value(
4164 CTX::instance()->geom.useTransform);
4165 if(action & GMSH_SET) {
4166 openglWindow *gl = FlGui::instance()->getCurrentOpenglWindow();
4167 if(CTX::instance()->geom.useTransform == 1) {
4168 drawTransform *tr = new drawTransformScaled(
4169 CTX::instance()->geom.transform, CTX::instance()->geom.offset);
4170 gl->getDrawContext()->setTransform(tr);
4171 }
4172 else {
4173 drawTransform *tr = gl->getDrawContext()->getTransform();
4174 gl->getDrawContext()->setTransform(nullptr);
4175 if(tr) delete tr;
4176 }
4177 }
4178 FlGui::instance()->options->activate("geo_transform");
4179 }
4180 #endif
4181 return CTX::instance()->geom.useTransform;
4182 }
4183
_opt_geometry_transform(OPT_ARGS_NUM,int ii,int jj,int nn)4184 static double _opt_geometry_transform(OPT_ARGS_NUM, int ii, int jj, int nn)
4185 {
4186 if(action & GMSH_SET) CTX::instance()->geom.transform[ii][jj] = val;
4187 #if defined(HAVE_FLTK)
4188 if(FlGui::available()) {
4189 if(action & GMSH_GUI)
4190 FlGui::instance()->options->geo.value[nn]->value(
4191 CTX::instance()->geom.transform[ii][jj]);
4192 if(action & GMSH_SET) {
4193 openglWindow *gl = FlGui::instance()->getCurrentOpenglWindow();
4194 drawTransform *tr = gl->getDrawContext()->getTransform();
4195 if(tr)
4196 tr->setMatrix(CTX::instance()->geom.transform,
4197 CTX::instance()->geom.offset);
4198 }
4199 }
4200 #endif
4201 return CTX::instance()->geom.transform[ii][jj];
4202 }
4203
opt_geometry_transform00(OPT_ARGS_NUM)4204 double opt_geometry_transform00(OPT_ARGS_NUM)
4205 {
4206 return _opt_geometry_transform(num, action, val, 0, 0, 7);
4207 }
4208
opt_geometry_transform01(OPT_ARGS_NUM)4209 double opt_geometry_transform01(OPT_ARGS_NUM)
4210 {
4211 return _opt_geometry_transform(num, action, val, 0, 1, 8);
4212 }
4213
opt_geometry_transform02(OPT_ARGS_NUM)4214 double opt_geometry_transform02(OPT_ARGS_NUM)
4215 {
4216 return _opt_geometry_transform(num, action, val, 0, 2, 9);
4217 }
4218
opt_geometry_transform10(OPT_ARGS_NUM)4219 double opt_geometry_transform10(OPT_ARGS_NUM)
4220 {
4221 return _opt_geometry_transform(num, action, val, 1, 0, 11);
4222 }
4223
opt_geometry_transform11(OPT_ARGS_NUM)4224 double opt_geometry_transform11(OPT_ARGS_NUM)
4225 {
4226 return _opt_geometry_transform(num, action, val, 1, 1, 12);
4227 }
4228
opt_geometry_transform12(OPT_ARGS_NUM)4229 double opt_geometry_transform12(OPT_ARGS_NUM)
4230 {
4231 return _opt_geometry_transform(num, action, val, 1, 2, 13);
4232 }
4233
opt_geometry_transform20(OPT_ARGS_NUM)4234 double opt_geometry_transform20(OPT_ARGS_NUM)
4235 {
4236 return _opt_geometry_transform(num, action, val, 2, 0, 15);
4237 }
4238
opt_geometry_transform21(OPT_ARGS_NUM)4239 double opt_geometry_transform21(OPT_ARGS_NUM)
4240 {
4241 return _opt_geometry_transform(num, action, val, 2, 1, 16);
4242 }
4243
opt_geometry_transform22(OPT_ARGS_NUM)4244 double opt_geometry_transform22(OPT_ARGS_NUM)
4245 {
4246 return _opt_geometry_transform(num, action, val, 2, 2, 17);
4247 }
4248
_opt_geometry_offset(OPT_ARGS_NUM,int ii,int nn)4249 static double _opt_geometry_offset(OPT_ARGS_NUM, int ii, int nn)
4250 {
4251 if(action & GMSH_SET) CTX::instance()->geom.offset[ii] = val;
4252 #if defined(HAVE_FLTK)
4253 if(FlGui::available()) {
4254 if(action & GMSH_GUI)
4255 FlGui::instance()->options->geo.value[nn]->value(
4256 CTX::instance()->geom.offset[ii]);
4257 if(action & GMSH_SET) {
4258 openglWindow *gl = FlGui::instance()->getCurrentOpenglWindow();
4259 drawTransform *tr = gl->getDrawContext()->getTransform();
4260 if(tr)
4261 tr->setMatrix(CTX::instance()->geom.transform,
4262 CTX::instance()->geom.offset);
4263 }
4264 }
4265 #endif
4266 return CTX::instance()->geom.offset[ii];
4267 }
4268
opt_geometry_offset0(OPT_ARGS_NUM)4269 double opt_geometry_offset0(OPT_ARGS_NUM)
4270 {
4271 return _opt_geometry_offset(num, action, val, 0, 10);
4272 }
4273
opt_geometry_offset1(OPT_ARGS_NUM)4274 double opt_geometry_offset1(OPT_ARGS_NUM)
4275 {
4276 return _opt_geometry_offset(num, action, val, 1, 14);
4277 }
4278
opt_geometry_offset2(OPT_ARGS_NUM)4279 double opt_geometry_offset2(OPT_ARGS_NUM)
4280 {
4281 return _opt_geometry_offset(num, action, val, 2, 18);
4282 }
4283
opt_geometry_auto_coherence(OPT_ARGS_NUM)4284 double opt_geometry_auto_coherence(OPT_ARGS_NUM)
4285 {
4286 if(action & GMSH_SET) CTX::instance()->geom.autoCoherence = (int)val;
4287 #if defined(HAVE_FLTK)
4288 if(FlGui::available() && (action & GMSH_GUI))
4289 FlGui::instance()->options->geo.butt[8]->value(
4290 CTX::instance()->geom.autoCoherence);
4291 #endif
4292 return CTX::instance()->geom.autoCoherence;
4293 }
4294
opt_geometry_oriented_physicals(OPT_ARGS_NUM)4295 double opt_geometry_oriented_physicals(OPT_ARGS_NUM)
4296 {
4297 if(action & GMSH_SET) CTX::instance()->geom.orientedPhysicals = (int)val;
4298 return CTX::instance()->geom.orientedPhysicals;
4299 }
4300
opt_geometry_highlight_orphans(OPT_ARGS_NUM)4301 double opt_geometry_highlight_orphans(OPT_ARGS_NUM)
4302 {
4303 if(action & GMSH_SET) CTX::instance()->geom.highlightOrphans = (int)val;
4304 #if defined(HAVE_FLTK)
4305 if(FlGui::available() && (action & GMSH_GUI))
4306 FlGui::instance()->options->geo.butt[10]->value(
4307 CTX::instance()->geom.highlightOrphans);
4308 #endif
4309 return CTX::instance()->geom.highlightOrphans;
4310 }
4311
opt_geometry_tolerance(OPT_ARGS_NUM)4312 double opt_geometry_tolerance(OPT_ARGS_NUM)
4313 {
4314 if(action & GMSH_SET) CTX::instance()->geom.tolerance = val;
4315 #if defined(HAVE_FLTK)
4316 if(FlGui::available() && (action & GMSH_GUI))
4317 FlGui::instance()->options->geo.value[2]->value(
4318 CTX::instance()->geom.tolerance);
4319 #endif
4320 return CTX::instance()->geom.tolerance;
4321 }
4322
opt_geometry_tolerance_boolean(OPT_ARGS_NUM)4323 double opt_geometry_tolerance_boolean(OPT_ARGS_NUM)
4324 {
4325 if(action & GMSH_SET) CTX::instance()->geom.toleranceBoolean = val;
4326 return CTX::instance()->geom.toleranceBoolean;
4327 }
4328
opt_geometry_normals(OPT_ARGS_NUM)4329 double opt_geometry_normals(OPT_ARGS_NUM)
4330 {
4331 if(action & GMSH_SET) CTX::instance()->geom.normals = val;
4332 #if defined(HAVE_FLTK)
4333 if(FlGui::available() && (action & GMSH_GUI))
4334 FlGui::instance()->options->geo.value[0]->value(
4335 CTX::instance()->geom.normals);
4336 #endif
4337 return CTX::instance()->geom.normals;
4338 }
4339
opt_geometry_tangents(OPT_ARGS_NUM)4340 double opt_geometry_tangents(OPT_ARGS_NUM)
4341 {
4342 if(action & GMSH_SET) CTX::instance()->geom.tangents = val;
4343 #if defined(HAVE_FLTK)
4344 if(FlGui::available() && (action & GMSH_GUI))
4345 FlGui::instance()->options->geo.value[1]->value(
4346 CTX::instance()->geom.tangents);
4347 #endif
4348 return CTX::instance()->geom.tangents;
4349 }
4350
opt_geometry_points(OPT_ARGS_NUM)4351 double opt_geometry_points(OPT_ARGS_NUM)
4352 {
4353 if(action & GMSH_SET) CTX::instance()->geom.points = (int)val;
4354 #if defined(HAVE_FLTK)
4355 if(FlGui::available() && (action & GMSH_GUI))
4356 FlGui::instance()->options->geo.butt[0]->value(
4357 CTX::instance()->geom.points);
4358 #endif
4359 return CTX::instance()->geom.points;
4360 }
4361
opt_geometry_curves(OPT_ARGS_NUM)4362 double opt_geometry_curves(OPT_ARGS_NUM)
4363 {
4364 if(action & GMSH_SET) CTX::instance()->geom.curves = (int)val;
4365 #if defined(HAVE_FLTK)
4366 if(FlGui::available() && (action & GMSH_GUI))
4367 FlGui::instance()->options->geo.butt[1]->value(
4368 CTX::instance()->geom.curves);
4369 #endif
4370 return CTX::instance()->geom.curves;
4371 }
4372
opt_geometry_surfaces(OPT_ARGS_NUM)4373 double opt_geometry_surfaces(OPT_ARGS_NUM)
4374 {
4375 if(action & GMSH_SET) CTX::instance()->geom.surfaces = (int)val;
4376 #if defined(HAVE_FLTK)
4377 if(FlGui::available() && (action & GMSH_GUI))
4378 FlGui::instance()->options->geo.butt[2]->value(
4379 CTX::instance()->geom.surfaces);
4380 #endif
4381 return CTX::instance()->geom.surfaces;
4382 }
4383
opt_geometry_volumes(OPT_ARGS_NUM)4384 double opt_geometry_volumes(OPT_ARGS_NUM)
4385 {
4386 if(action & GMSH_SET) CTX::instance()->geom.volumes = (int)val;
4387 #if defined(HAVE_FLTK)
4388 if(FlGui::available() && (action & GMSH_GUI))
4389 FlGui::instance()->options->geo.butt[3]->value(
4390 CTX::instance()->geom.volumes);
4391 #endif
4392 return CTX::instance()->geom.volumes;
4393 }
4394
opt_geometry_point_labels(OPT_ARGS_NUM)4395 double opt_geometry_point_labels(OPT_ARGS_NUM)
4396 {
4397 if(action & GMSH_SET) CTX::instance()->geom.pointLabels = (int)val;
4398 #if defined(HAVE_FLTK)
4399 if(FlGui::available() && (action & GMSH_GUI))
4400 FlGui::instance()->options->geo.butt[4]->value(
4401 CTX::instance()->geom.pointLabels);
4402 #endif
4403 return CTX::instance()->geom.pointLabels;
4404 }
4405
opt_geometry_curve_labels(OPT_ARGS_NUM)4406 double opt_geometry_curve_labels(OPT_ARGS_NUM)
4407 {
4408 if(action & GMSH_SET) CTX::instance()->geom.curveLabels = (int)val;
4409 #if defined(HAVE_FLTK)
4410 if(FlGui::available() && (action & GMSH_GUI))
4411 FlGui::instance()->options->geo.butt[5]->value(
4412 CTX::instance()->geom.curveLabels);
4413 #endif
4414 return CTX::instance()->geom.curveLabels;
4415 }
4416
opt_geometry_surface_labels(OPT_ARGS_NUM)4417 double opt_geometry_surface_labels(OPT_ARGS_NUM)
4418 {
4419 if(action & GMSH_SET) CTX::instance()->geom.surfaceLabels = (int)val;
4420 #if defined(HAVE_FLTK)
4421 if(FlGui::available() && (action & GMSH_GUI))
4422 FlGui::instance()->options->geo.butt[6]->value(
4423 CTX::instance()->geom.surfaceLabels);
4424 #endif
4425 return CTX::instance()->geom.surfaceLabels;
4426 }
4427
opt_geometry_volume_labels(OPT_ARGS_NUM)4428 double opt_geometry_volume_labels(OPT_ARGS_NUM)
4429 {
4430 if(action & GMSH_SET) CTX::instance()->geom.volumeLabels = (int)val;
4431 #if defined(HAVE_FLTK)
4432 if(FlGui::available() && (action & GMSH_GUI))
4433 FlGui::instance()->options->geo.butt[7]->value(
4434 CTX::instance()->geom.volumeLabels);
4435 #endif
4436 return CTX::instance()->geom.volumeLabels;
4437 }
4438
opt_geometry_label_type(OPT_ARGS_NUM)4439 double opt_geometry_label_type(OPT_ARGS_NUM)
4440 {
4441 if(action & GMSH_SET) {
4442 CTX::instance()->geom.labelType = (int)val;
4443 if(CTX::instance()->geom.labelType < 0 ||
4444 CTX::instance()->geom.labelType > 4)
4445 CTX::instance()->geom.labelType = 0;
4446 }
4447 #if defined(HAVE_FLTK)
4448 if(FlGui::available() && (action & GMSH_GUI)) {
4449 FlGui::instance()->options->geo.choice[4]->value(
4450 CTX::instance()->geom.labelType);
4451 }
4452 #endif
4453 return CTX::instance()->geom.labelType;
4454 }
4455
opt_geometry_point_size(OPT_ARGS_NUM)4456 double opt_geometry_point_size(OPT_ARGS_NUM)
4457 {
4458 if(action & GMSH_SET) CTX::instance()->geom.pointSize = val;
4459 #if defined(HAVE_FLTK)
4460 if(FlGui::available() && (action & GMSH_GUI))
4461 FlGui::instance()->options->geo.value[3]->value(
4462 CTX::instance()->geom.pointSize);
4463 #endif
4464 return CTX::instance()->geom.pointSize;
4465 }
4466
opt_geometry_point_sel_size(OPT_ARGS_NUM)4467 double opt_geometry_point_sel_size(OPT_ARGS_NUM)
4468 {
4469 if(action & GMSH_SET) CTX::instance()->geom.selectedPointSize = val;
4470 #if defined(HAVE_FLTK)
4471 if(FlGui::available() && (action & GMSH_GUI))
4472 FlGui::instance()->options->geo.value[5]->value(
4473 CTX::instance()->geom.selectedPointSize);
4474 #endif
4475 return CTX::instance()->geom.selectedPointSize;
4476 }
4477
opt_geometry_point_type(OPT_ARGS_NUM)4478 double opt_geometry_point_type(OPT_ARGS_NUM)
4479 {
4480 if(action & GMSH_SET) { CTX::instance()->geom.pointType = (int)val; }
4481 #if defined(HAVE_FLTK)
4482 if(FlGui::available() && (action & GMSH_GUI)) {
4483 FlGui::instance()->options->geo.choice[0]->value(
4484 CTX::instance()->geom.pointType);
4485 }
4486 #endif
4487 return CTX::instance()->geom.pointType;
4488 }
4489
opt_geometry_curve_width(OPT_ARGS_NUM)4490 double opt_geometry_curve_width(OPT_ARGS_NUM)
4491 {
4492 if(action & GMSH_SET) CTX::instance()->geom.curveWidth = val;
4493 #if defined(HAVE_FLTK)
4494 if(FlGui::available() && (action & GMSH_GUI))
4495 FlGui::instance()->options->geo.value[4]->value(
4496 CTX::instance()->geom.curveWidth);
4497 #endif
4498 return CTX::instance()->geom.curveWidth;
4499 }
4500
opt_geometry_curve_sel_width(OPT_ARGS_NUM)4501 double opt_geometry_curve_sel_width(OPT_ARGS_NUM)
4502 {
4503 if(action & GMSH_SET) CTX::instance()->geom.selectedCurveWidth = val;
4504 #if defined(HAVE_FLTK)
4505 if(FlGui::available() && (action & GMSH_GUI))
4506 FlGui::instance()->options->geo.value[6]->value(
4507 CTX::instance()->geom.selectedCurveWidth);
4508 #endif
4509 return CTX::instance()->geom.selectedCurveWidth;
4510 }
4511
opt_geometry_curve_type(OPT_ARGS_NUM)4512 double opt_geometry_curve_type(OPT_ARGS_NUM)
4513 {
4514 if(action & GMSH_SET) { CTX::instance()->geom.curveType = (int)val; }
4515 #if defined(HAVE_FLTK)
4516 if(FlGui::available() && (action & GMSH_GUI)) {
4517 FlGui::instance()->options->geo.choice[1]->value(
4518 CTX::instance()->geom.curveType);
4519 }
4520 #endif
4521 return CTX::instance()->geom.curveType;
4522 }
4523
opt_geometry_surface_type(OPT_ARGS_NUM)4524 double opt_geometry_surface_type(OPT_ARGS_NUM)
4525 {
4526 if(action & GMSH_SET) {
4527 CTX::instance()->geom.surfaceType = (int)val;
4528 if(CTX::instance()->geom.surfaceType < 0 ||
4529 CTX::instance()->geom.surfaceType > 2)
4530 CTX::instance()->geom.surfaceType = 0;
4531 }
4532 #if defined(HAVE_FLTK)
4533 if(FlGui::available() && (action & GMSH_GUI)) {
4534 FlGui::instance()->options->geo.choice[2]->value(
4535 CTX::instance()->geom.surfaceType);
4536 }
4537 #endif
4538 return CTX::instance()->geom.surfaceType;
4539 }
4540
opt_geometry_light(OPT_ARGS_NUM)4541 double opt_geometry_light(OPT_ARGS_NUM)
4542 {
4543 if(action & GMSH_SET) CTX::instance()->geom.light = (int)val;
4544 #if defined(HAVE_FLTK)
4545 if(FlGui::available() && (action & GMSH_GUI)) {
4546 FlGui::instance()->options->geo.butt[9]->value(CTX::instance()->geom.light);
4547 }
4548 #endif
4549 return CTX::instance()->geom.light;
4550 }
4551
opt_geometry_light_two_side(OPT_ARGS_NUM)4552 double opt_geometry_light_two_side(OPT_ARGS_NUM)
4553 {
4554 if(action & GMSH_SET) CTX::instance()->geom.lightTwoSide = (int)val;
4555 #if defined(HAVE_FLTK)
4556 if(FlGui::available() && (action & GMSH_GUI))
4557 FlGui::instance()->options->geo.butt[15]->value(
4558 CTX::instance()->geom.lightTwoSide);
4559 #endif
4560 return CTX::instance()->geom.lightTwoSide;
4561 }
4562
opt_geometry_occ_auto_embed(OPT_ARGS_NUM)4563 double opt_geometry_occ_auto_embed(OPT_ARGS_NUM)
4564 {
4565 if(action & GMSH_SET) CTX::instance()->geom.occAutoEmbed = val ? 1 : 0;
4566 return CTX::instance()->geom.occAutoEmbed;
4567 }
4568
opt_geometry_occ_auto_fix(OPT_ARGS_NUM)4569 double opt_geometry_occ_auto_fix(OPT_ARGS_NUM)
4570 {
4571 if(action & GMSH_SET) CTX::instance()->geom.occAutoFix = val ? 1 : 0;
4572 return CTX::instance()->geom.occAutoFix;
4573 }
4574
opt_geometry_occ_bounds_use_stl(OPT_ARGS_NUM)4575 double opt_geometry_occ_bounds_use_stl(OPT_ARGS_NUM)
4576 {
4577 if(action & GMSH_SET) CTX::instance()->geom.occBoundsUseSTL = val ? 1 : 0;
4578 return CTX::instance()->geom.occBoundsUseSTL;
4579 }
4580
opt_geometry_occ_disable_stl(OPT_ARGS_NUM)4581 double opt_geometry_occ_disable_stl(OPT_ARGS_NUM)
4582 {
4583 if(action & GMSH_SET) CTX::instance()->geom.occDisableSTL = val ? 1 : 0;
4584 return CTX::instance()->geom.occDisableSTL;
4585 }
4586
opt_geometry_occ_fix_degenerated(OPT_ARGS_NUM)4587 double opt_geometry_occ_fix_degenerated(OPT_ARGS_NUM)
4588 {
4589 if(action & GMSH_SET) CTX::instance()->geom.occFixDegenerated = val ? 1 : 0;
4590 #if defined(HAVE_FLTK)
4591 if(FlGui::available() && (action & GMSH_GUI)) {
4592 FlGui::instance()->options->geo.butt[16]->value(
4593 CTX::instance()->geom.occFixDegenerated);
4594 }
4595 #endif
4596 return CTX::instance()->geom.occFixDegenerated;
4597 }
4598
opt_geometry_occ_fix_small_edges(OPT_ARGS_NUM)4599 double opt_geometry_occ_fix_small_edges(OPT_ARGS_NUM)
4600 {
4601 if(action & GMSH_SET) CTX::instance()->geom.occFixSmallEdges = val ? 1 : 0;
4602 #if defined(HAVE_FLTK)
4603 if(FlGui::available() && (action & GMSH_GUI)) {
4604 FlGui::instance()->options->geo.butt[11]->value(
4605 CTX::instance()->geom.occFixSmallEdges);
4606 }
4607 #endif
4608 return CTX::instance()->geom.occFixSmallEdges;
4609 }
4610
opt_geometry_occ_fix_small_faces(OPT_ARGS_NUM)4611 double opt_geometry_occ_fix_small_faces(OPT_ARGS_NUM)
4612 {
4613 if(action & GMSH_SET) CTX::instance()->geom.occFixSmallFaces = val ? 1 : 0;
4614 #if defined(HAVE_FLTK)
4615 if(FlGui::available() && (action & GMSH_GUI)) {
4616 FlGui::instance()->options->geo.butt[12]->value(
4617 CTX::instance()->geom.occFixSmallFaces);
4618 }
4619 #endif
4620 return CTX::instance()->geom.occFixSmallFaces;
4621 }
4622
opt_geometry_occ_sew_faces(OPT_ARGS_NUM)4623 double opt_geometry_occ_sew_faces(OPT_ARGS_NUM)
4624 {
4625 if(action & GMSH_SET) { CTX::instance()->geom.occSewFaces = val ? 1 : 0; }
4626 #if defined(HAVE_FLTK)
4627 if(FlGui::available() && (action & GMSH_GUI)) {
4628 FlGui::instance()->options->geo.butt[13]->value(
4629 CTX::instance()->geom.occSewFaces);
4630 }
4631 #endif
4632 return CTX::instance()->geom.occSewFaces;
4633 }
4634
opt_geometry_occ_make_solids(OPT_ARGS_NUM)4635 double opt_geometry_occ_make_solids(OPT_ARGS_NUM)
4636 {
4637 if(action & GMSH_SET) { CTX::instance()->geom.occMakeSolids = val ? 1 : 0; }
4638 #if defined(HAVE_FLTK)
4639 if(FlGui::available() && (action & GMSH_GUI)) {
4640 FlGui::instance()->options->geo.butt[14]->value(
4641 CTX::instance()->geom.occMakeSolids);
4642 }
4643 #endif
4644 return CTX::instance()->geom.occMakeSolids;
4645 }
4646
opt_geometry_occ_union_unify(OPT_ARGS_NUM)4647 double opt_geometry_occ_union_unify(OPT_ARGS_NUM)
4648 {
4649 if(action & GMSH_SET) CTX::instance()->geom.occUnionUnify = (int)val;
4650 return CTX::instance()->geom.occUnionUnify;
4651 }
4652
opt_geometry_occ_thrusections_degree(OPT_ARGS_NUM)4653 double opt_geometry_occ_thrusections_degree(OPT_ARGS_NUM)
4654 {
4655 if(action & GMSH_SET) CTX::instance()->geom.occThruSectionsDegree = (int)val;
4656 return CTX::instance()->geom.occThruSectionsDegree;
4657 }
4658
opt_geometry_occ_parallel(OPT_ARGS_NUM)4659 double opt_geometry_occ_parallel(OPT_ARGS_NUM)
4660 {
4661 if(action & GMSH_SET) CTX::instance()->geom.occParallel = (int)val;
4662 return CTX::instance()->geom.occParallel;
4663 }
4664
opt_geometry_occ_boolean_preserve_numbering(OPT_ARGS_NUM)4665 double opt_geometry_occ_boolean_preserve_numbering(OPT_ARGS_NUM)
4666 {
4667 if(action & GMSH_SET)
4668 CTX::instance()->geom.occBooleanPreserveNumbering = (int)val;
4669 return CTX::instance()->geom.occBooleanPreserveNumbering;
4670 }
4671
opt_geometry_occ_scaling(OPT_ARGS_NUM)4672 double opt_geometry_occ_scaling(OPT_ARGS_NUM)
4673 {
4674 if(action & GMSH_SET) CTX::instance()->geom.occScaling = val;
4675 #if defined(HAVE_FLTK)
4676 if(FlGui::available() && (action & GMSH_GUI)) {
4677 FlGui::instance()->options->geo.value[20]->value(
4678 CTX::instance()->geom.occScaling);
4679 }
4680 #endif
4681 return CTX::instance()->geom.occScaling;
4682 }
4683
opt_geometry_occ_import_labels(OPT_ARGS_NUM)4684 double opt_geometry_occ_import_labels(OPT_ARGS_NUM)
4685 {
4686 if(action & GMSH_SET) CTX::instance()->geom.occImportLabels = (int)val;
4687 return CTX::instance()->geom.occImportLabels;
4688 }
4689
opt_geometry_occ_use_generic_closest_point(OPT_ARGS_NUM)4690 double opt_geometry_occ_use_generic_closest_point(OPT_ARGS_NUM)
4691 {
4692 if(action & GMSH_SET) CTX::instance()->geom.occUseGenericClosestPoint = (int)val;
4693 return CTX::instance()->geom.occUseGenericClosestPoint;
4694 }
4695
opt_geometry_old_circle(OPT_ARGS_NUM)4696 double opt_geometry_old_circle(OPT_ARGS_NUM)
4697 {
4698 if(action & GMSH_SET) CTX::instance()->geom.oldCircle = (int)val;
4699 return CTX::instance()->geom.oldCircle;
4700 }
4701
opt_geometry_old_ruled_surface(OPT_ARGS_NUM)4702 double opt_geometry_old_ruled_surface(OPT_ARGS_NUM)
4703 {
4704 if(action & GMSH_SET) CTX::instance()->geom.oldRuledSurface = (int)val;
4705 return CTX::instance()->geom.oldRuledSurface;
4706 }
4707
opt_geometry_old_newreg(OPT_ARGS_NUM)4708 double opt_geometry_old_newreg(OPT_ARGS_NUM)
4709 {
4710 if(action & GMSH_SET) CTX::instance()->geom.oldNewreg = (int)val;
4711 return CTX::instance()->geom.oldNewreg;
4712 }
4713
opt_geometry_num_sub_edges(OPT_ARGS_NUM)4714 double opt_geometry_num_sub_edges(OPT_ARGS_NUM)
4715 {
4716 if(action & GMSH_SET) {
4717 CTX::instance()->geom.numSubEdges = (int)val;
4718 if(CTX::instance()->geom.numSubEdges < 1)
4719 CTX::instance()->geom.numSubEdges = 1;
4720 }
4721 #if defined(HAVE_FLTK)
4722 if(FlGui::available() && (action & GMSH_GUI)) {
4723 FlGui::instance()->options->geo.value[19]->value(
4724 CTX::instance()->geom.numSubEdges);
4725 }
4726 #endif
4727 return CTX::instance()->geom.numSubEdges;
4728 }
4729
opt_geometry_extrude_spline_points(OPT_ARGS_NUM)4730 double opt_geometry_extrude_spline_points(OPT_ARGS_NUM)
4731 {
4732 if(action & GMSH_SET) CTX::instance()->geom.extrudeSplinePoints = (int)val;
4733 return CTX::instance()->geom.extrudeSplinePoints;
4734 }
4735
opt_geometry_extrude_return_lateral(OPT_ARGS_NUM)4736 double opt_geometry_extrude_return_lateral(OPT_ARGS_NUM)
4737 {
4738 if(action & GMSH_SET) CTX::instance()->geom.extrudeReturnLateral = (int)val;
4739 return CTX::instance()->geom.extrudeReturnLateral;
4740 }
4741
opt_geometry_scaling_factor(OPT_ARGS_NUM)4742 double opt_geometry_scaling_factor(OPT_ARGS_NUM)
4743 {
4744 if(action & GMSH_SET) CTX::instance()->geom.scalingFactor = val;
4745 return CTX::instance()->geom.scalingFactor;
4746 }
4747
opt_geometry_snap_points(OPT_ARGS_NUM)4748 double opt_geometry_snap_points(OPT_ARGS_NUM)
4749 {
4750 if(action & GMSH_SET) CTX::instance()->geom.snapPoints = val;
4751 return CTX::instance()->geom.snapPoints;
4752 }
4753
opt_geometry_snap0(OPT_ARGS_NUM)4754 double opt_geometry_snap0(OPT_ARGS_NUM)
4755 {
4756 if(action & GMSH_SET) CTX::instance()->geom.snap[0] = val;
4757 #if defined(HAVE_FLTK)
4758 if(FlGui::available() && (action & GMSH_GUI))
4759 FlGui::instance()->elementaryContext->value[0]->value(
4760 CTX::instance()->geom.snap[0]);
4761 #endif
4762 return CTX::instance()->geom.snap[0];
4763 }
4764
opt_geometry_snap1(OPT_ARGS_NUM)4765 double opt_geometry_snap1(OPT_ARGS_NUM)
4766 {
4767 if(action & GMSH_SET) CTX::instance()->geom.snap[1] = val;
4768 #if defined(HAVE_FLTK)
4769 if(FlGui::available() && (action & GMSH_GUI))
4770 FlGui::instance()->elementaryContext->value[1]->value(
4771 CTX::instance()->geom.snap[1]);
4772 #endif
4773 return CTX::instance()->geom.snap[1];
4774 }
4775
opt_geometry_snap2(OPT_ARGS_NUM)4776 double opt_geometry_snap2(OPT_ARGS_NUM)
4777 {
4778 if(action & GMSH_SET) CTX::instance()->geom.snap[2] = val;
4779 #if defined(HAVE_FLTK)
4780 if(FlGui::available() && (action & GMSH_GUI))
4781 FlGui::instance()->elementaryContext->value[2]->value(
4782 CTX::instance()->geom.snap[2]);
4783 #endif
4784 return CTX::instance()->geom.snap[2];
4785 }
4786
opt_geometry_clip(OPT_ARGS_NUM)4787 double opt_geometry_clip(OPT_ARGS_NUM)
4788 {
4789 if(action & GMSH_SET) CTX::instance()->geom.clip = (int)val;
4790 #if defined(HAVE_FLTK)
4791 if(FlGui::available() && (action & GMSH_GUI))
4792 FlGui::instance()->clipping->resetBrowser();
4793 #endif
4794 return CTX::instance()->geom.clip;
4795 }
4796
opt_geometry_copy_meshing_method(OPT_ARGS_NUM)4797 double opt_geometry_copy_meshing_method(OPT_ARGS_NUM)
4798 {
4799 if(action & GMSH_SET) CTX::instance()->geom.copyMeshingMethod = (int)val;
4800 return CTX::instance()->geom.copyMeshingMethod;
4801 }
4802
opt_geometry_double_clicked_entity_tag(OPT_ARGS_NUM)4803 double opt_geometry_double_clicked_entity_tag(OPT_ARGS_NUM)
4804 {
4805 if(action & GMSH_SET) CTX::instance()->geom.doubleClickedEntityTag = (int)val;
4806 return CTX::instance()->geom.doubleClickedEntityTag;
4807 }
4808
opt_geometry_exact_extrusion(OPT_ARGS_NUM)4809 double opt_geometry_exact_extrusion(OPT_ARGS_NUM)
4810 {
4811 if(action & GMSH_SET) CTX::instance()->geom.exactExtrusion = (int)val;
4812 return CTX::instance()->geom.exactExtrusion;
4813 }
4814
opt_geometry_match_geom_and_mesh(OPT_ARGS_NUM)4815 double opt_geometry_match_geom_and_mesh(OPT_ARGS_NUM)
4816 {
4817 if(action & GMSH_SET) CTX::instance()->geom.matchGeomAndMesh = (int)val;
4818 return CTX::instance()->geom.matchGeomAndMesh;
4819 }
4820
opt_geometry_match_mesh_scale_factor(OPT_ARGS_NUM)4821 double opt_geometry_match_mesh_scale_factor(OPT_ARGS_NUM)
4822 {
4823 if(action & GMSH_SET)
4824 CTX::instance()->geom.matchMeshScaleFactor = (double)val;
4825 return CTX::instance()->geom.matchMeshScaleFactor;
4826 }
4827
opt_geometry_match_mesh_tolerance(OPT_ARGS_NUM)4828 double opt_geometry_match_mesh_tolerance(OPT_ARGS_NUM)
4829 {
4830 if(action & GMSH_SET) CTX::instance()->geom.matchMeshTolerance = (double)val;
4831 return CTX::instance()->geom.matchMeshTolerance;
4832 }
4833
opt_mesh_optimize(OPT_ARGS_NUM)4834 double opt_mesh_optimize(OPT_ARGS_NUM)
4835 {
4836 if(action & GMSH_SET) {
4837 if(!(action & GMSH_SET_DEFAULT) &&
4838 (int)val != CTX::instance()->mesh.optimize)
4839 Msg::SetOnelabChanged(2);
4840 CTX::instance()->mesh.optimize = (int)val;
4841 }
4842 #if defined(HAVE_FLTK)
4843 if(FlGui::available() && (action & GMSH_GUI))
4844 FlGui::instance()->options->mesh.butt[2]->value(
4845 CTX::instance()->mesh.optimize);
4846 #endif
4847 return CTX::instance()->mesh.optimize;
4848 }
4849
opt_mesh_optimize_threshold(OPT_ARGS_NUM)4850 double opt_mesh_optimize_threshold(OPT_ARGS_NUM)
4851 {
4852 if(action & GMSH_SET) {
4853 if(!(action & GMSH_SET_DEFAULT) &&
4854 val != CTX::instance()->mesh.optimizeThreshold)
4855 Msg::SetOnelabChanged(2);
4856 CTX::instance()->mesh.optimizeThreshold = val;
4857 }
4858 return CTX::instance()->mesh.optimizeThreshold;
4859 }
4860
opt_mesh_optimize_netgen(OPT_ARGS_NUM)4861 double opt_mesh_optimize_netgen(OPT_ARGS_NUM)
4862 {
4863 if(action & GMSH_SET) {
4864 if(!(action & GMSH_SET_DEFAULT) &&
4865 (int)val != CTX::instance()->mesh.optimizeNetgen)
4866 Msg::SetOnelabChanged(2);
4867 CTX::instance()->mesh.optimizeNetgen = (int)val;
4868 }
4869 #if defined(HAVE_FLTK)
4870 if(FlGui::available() && (action & GMSH_GUI))
4871 FlGui::instance()->options->mesh.butt[24]->value(
4872 CTX::instance()->mesh.optimizeNetgen);
4873 #endif
4874 return CTX::instance()->mesh.optimizeNetgen;
4875 }
4876
opt_mesh_refine_steps(OPT_ARGS_NUM)4877 double opt_mesh_refine_steps(OPT_ARGS_NUM)
4878 {
4879 if(action & GMSH_SET) {
4880 if(!(action & GMSH_SET_DEFAULT) &&
4881 (int)val != CTX::instance()->mesh.refineSteps)
4882 Msg::SetOnelabChanged(2);
4883 CTX::instance()->mesh.refineSteps = (int)val;
4884 }
4885 return CTX::instance()->mesh.refineSteps;
4886 }
4887
opt_mesh_renumber(OPT_ARGS_NUM)4888 double opt_mesh_renumber(OPT_ARGS_NUM)
4889 {
4890 if(action & GMSH_SET) CTX::instance()->mesh.renumber = (int)val;
4891 return CTX::instance()->mesh.renumber;
4892 }
4893
opt_mesh_normals(OPT_ARGS_NUM)4894 double opt_mesh_normals(OPT_ARGS_NUM)
4895 {
4896 if(action & GMSH_SET) { CTX::instance()->mesh.normals = val; }
4897 #if defined(HAVE_FLTK)
4898 if(FlGui::available() && (action & GMSH_GUI))
4899 FlGui::instance()->options->mesh.value[8]->value(
4900 CTX::instance()->mesh.normals);
4901 #endif
4902 return CTX::instance()->mesh.normals;
4903 }
4904
opt_mesh_num_sub_edges(OPT_ARGS_NUM)4905 double opt_mesh_num_sub_edges(OPT_ARGS_NUM)
4906 {
4907 if(action & GMSH_SET) {
4908 if(CTX::instance()->mesh.numSubEdges != val)
4909 CTX::instance()->mesh.changed |= (ENT_CURVE | ENT_SURFACE | ENT_VOLUME);
4910 CTX::instance()->mesh.numSubEdges = (int)val;
4911 if(CTX::instance()->mesh.numSubEdges < 1)
4912 CTX::instance()->mesh.numSubEdges = 1;
4913 }
4914 #if defined(HAVE_FLTK)
4915 if(FlGui::available() && (action & GMSH_GUI))
4916 FlGui::instance()->options->mesh.value[14]->value(
4917 CTX::instance()->mesh.numSubEdges);
4918 #endif
4919 return CTX::instance()->mesh.numSubEdges;
4920 }
4921
opt_mesh_tangents(OPT_ARGS_NUM)4922 double opt_mesh_tangents(OPT_ARGS_NUM)
4923 {
4924 if(action & GMSH_SET) { CTX::instance()->mesh.tangents = val; }
4925 #if defined(HAVE_FLTK)
4926 if(FlGui::available() && (action & GMSH_GUI))
4927 FlGui::instance()->options->mesh.value[13]->value(
4928 CTX::instance()->mesh.tangents);
4929 #endif
4930 return CTX::instance()->mesh.tangents;
4931 }
4932
opt_mesh_explode(OPT_ARGS_NUM)4933 double opt_mesh_explode(OPT_ARGS_NUM)
4934 {
4935 if(action & GMSH_SET) {
4936 if(CTX::instance()->mesh.explode != val)
4937 CTX::instance()->mesh.changed |= (ENT_CURVE | ENT_SURFACE | ENT_VOLUME);
4938 CTX::instance()->mesh.explode = val;
4939 }
4940 #if defined(HAVE_FLTK)
4941 if(FlGui::available() && (action & GMSH_GUI))
4942 FlGui::instance()->options->mesh.value[9]->value(
4943 CTX::instance()->mesh.explode);
4944 #endif
4945 return CTX::instance()->mesh.explode;
4946 }
4947
opt_mesh_scaling_factor(OPT_ARGS_NUM)4948 double opt_mesh_scaling_factor(OPT_ARGS_NUM)
4949 {
4950 if(action & GMSH_SET) {
4951 if(!(action & GMSH_SET_DEFAULT) &&
4952 val != CTX::instance()->mesh.scalingFactor)
4953 Msg::SetOnelabChanged(2);
4954 CTX::instance()->mesh.scalingFactor = val;
4955 }
4956 return CTX::instance()->mesh.scalingFactor;
4957 }
4958
opt_mesh_lc_factor(OPT_ARGS_NUM)4959 double opt_mesh_lc_factor(OPT_ARGS_NUM)
4960 {
4961 if(action & GMSH_SET) {
4962 if(val > 0) {
4963 if(!(action & GMSH_SET_DEFAULT) && val != CTX::instance()->mesh.lcFactor)
4964 Msg::SetOnelabChanged(2);
4965 CTX::instance()->mesh.lcFactor = val;
4966 if(CTX::instance()->mesh.lcFactor <= 0.0){
4967 Msg::Error("Mesh element size factor must be > 0");
4968 CTX::instance()->mesh.lcFactor = 1.;
4969 }
4970 }
4971 }
4972 #if defined(HAVE_FLTK)
4973 if(FlGui::available() && (action & GMSH_GUI))
4974 FlGui::instance()->options->mesh.value[2]->value(
4975 CTX::instance()->mesh.lcFactor);
4976 #endif
4977 return CTX::instance()->mesh.lcFactor;
4978 }
4979
opt_mesh_lc_min(OPT_ARGS_NUM)4980 double opt_mesh_lc_min(OPT_ARGS_NUM)
4981 {
4982 if(action & GMSH_SET) {
4983 if(!(action & GMSH_SET_DEFAULT) && val != CTX::instance()->mesh.lcMin)
4984 Msg::SetOnelabChanged(2);
4985 CTX::instance()->mesh.lcMin = val;
4986 }
4987 #if defined(HAVE_FLTK)
4988 if(FlGui::available() && (action & GMSH_GUI))
4989 FlGui::instance()->options->mesh.value[25]->value(
4990 CTX::instance()->mesh.lcMin);
4991 #endif
4992 return CTX::instance()->mesh.lcMin;
4993 }
4994
opt_mesh_lc_max(OPT_ARGS_NUM)4995 double opt_mesh_lc_max(OPT_ARGS_NUM)
4996 {
4997 if(action & GMSH_SET) {
4998 if(!(action & GMSH_SET_DEFAULT) && val != CTX::instance()->mesh.lcMax)
4999 Msg::SetOnelabChanged(2);
5000 CTX::instance()->mesh.lcMax = val;
5001 }
5002 #if defined(HAVE_FLTK)
5003 if(FlGui::available() && (action & GMSH_GUI))
5004 FlGui::instance()->options->mesh.value[26]->value(
5005 CTX::instance()->mesh.lcMax);
5006 #endif
5007 return CTX::instance()->mesh.lcMax;
5008 }
5009
opt_mesh_tolerance_edge_length(OPT_ARGS_NUM)5010 double opt_mesh_tolerance_edge_length(OPT_ARGS_NUM)
5011 {
5012 if(action & GMSH_SET) {
5013 if(!(action & GMSH_SET_DEFAULT) &&
5014 val != CTX::instance()->mesh.toleranceEdgeLength)
5015 Msg::SetOnelabChanged(2);
5016 CTX::instance()->mesh.toleranceEdgeLength = val;
5017 }
5018 return CTX::instance()->mesh.toleranceEdgeLength;
5019 }
5020
opt_mesh_tolerance_initial_delaunay(OPT_ARGS_NUM)5021 double opt_mesh_tolerance_initial_delaunay(OPT_ARGS_NUM)
5022 {
5023 if(action & GMSH_SET) {
5024 if(!(action & GMSH_SET_DEFAULT) &&
5025 val != CTX::instance()->mesh.toleranceInitialDelaunay)
5026 Msg::SetOnelabChanged(2);
5027 CTX::instance()->mesh.toleranceInitialDelaunay = val;
5028 }
5029 return CTX::instance()->mesh.toleranceInitialDelaunay;
5030 }
5031
opt_mesh_lc_from_curvature(OPT_ARGS_NUM)5032 double opt_mesh_lc_from_curvature(OPT_ARGS_NUM)
5033 {
5034 if(action & GMSH_SET) {
5035 if(!(action & GMSH_SET_DEFAULT) &&
5036 (int)val != CTX::instance()->mesh.lcFromCurvature)
5037 Msg::SetOnelabChanged(2);
5038 CTX::instance()->mesh.lcFromCurvature = (int)val;
5039 }
5040 #if defined(HAVE_FLTK)
5041 if(FlGui::available() && (action & GMSH_GUI)) {
5042 FlGui::instance()->options->mesh.value[1]->value(
5043 CTX::instance()->mesh.lcFromCurvature);
5044 }
5045 #endif
5046 return CTX::instance()->mesh.lcFromCurvature;
5047 }
5048
opt_mesh_lc_from_curvature_iso(OPT_ARGS_NUM)5049 double opt_mesh_lc_from_curvature_iso(OPT_ARGS_NUM)
5050 {
5051 if(action & GMSH_SET) {
5052 if(!(action & GMSH_SET_DEFAULT) &&
5053 (int)val != CTX::instance()->mesh.lcFromCurvatureIso)
5054 Msg::SetOnelabChanged(2);
5055 CTX::instance()->mesh.lcFromCurvatureIso = (int)val;
5056 }
5057 return CTX::instance()->mesh.lcFromCurvatureIso;
5058 }
5059
opt_mesh_lc_from_points(OPT_ARGS_NUM)5060 double opt_mesh_lc_from_points(OPT_ARGS_NUM)
5061 {
5062 if(action & GMSH_SET) {
5063 if(!(action & GMSH_SET_DEFAULT) &&
5064 (int)val != CTX::instance()->mesh.lcFromPoints)
5065 Msg::SetOnelabChanged(2);
5066 CTX::instance()->mesh.lcFromPoints = (int)val;
5067 }
5068 #if defined(HAVE_FLTK)
5069 if(FlGui::available() && (action & GMSH_GUI)) {
5070 FlGui::instance()->options->mesh.butt[5]->value(
5071 CTX::instance()->mesh.lcFromPoints ? 1 : 0);
5072 }
5073 #endif
5074 return CTX::instance()->mesh.lcFromPoints;
5075 }
5076
opt_mesh_lc_from_parametric_points(OPT_ARGS_NUM)5077 double opt_mesh_lc_from_parametric_points(OPT_ARGS_NUM)
5078 {
5079 if(action & GMSH_SET) {
5080 if(!(action & GMSH_SET_DEFAULT) &&
5081 (int)val != CTX::instance()->mesh.lcFromParametricPoints)
5082 Msg::SetOnelabChanged(2);
5083 CTX::instance()->mesh.lcFromParametricPoints = (int)val;
5084 }
5085 #if defined(HAVE_FLTK)
5086 if(FlGui::available() && (action & GMSH_GUI))
5087 FlGui::instance()->options->mesh.butt[26]->value(
5088 CTX::instance()->mesh.lcFromParametricPoints ? 1 : 0);
5089 #endif
5090 return CTX::instance()->mesh.lcFromParametricPoints;
5091 }
5092
opt_mesh_lc_extend_from_boundary(OPT_ARGS_NUM)5093 double opt_mesh_lc_extend_from_boundary(OPT_ARGS_NUM)
5094 {
5095 if(action & GMSH_SET) {
5096 if(!(action & GMSH_SET_DEFAULT) &&
5097 (int)val != CTX::instance()->mesh.lcExtendFromBoundary)
5098 Msg::SetOnelabChanged(2);
5099 CTX::instance()->mesh.lcExtendFromBoundary = (int)val;
5100 }
5101 #if defined(HAVE_FLTK)
5102 if(FlGui::available() && (action & GMSH_GUI))
5103 FlGui::instance()->options->mesh.butt[16]->value(
5104 CTX::instance()->mesh.lcExtendFromBoundary ? 1 : 0);
5105 #endif
5106 return CTX::instance()->mesh.lcExtendFromBoundary;
5107 }
5108
opt_mesh_lc_integration_precision(OPT_ARGS_NUM)5109 double opt_mesh_lc_integration_precision(OPT_ARGS_NUM)
5110 {
5111 if(action & GMSH_SET) {
5112 if(!(action & GMSH_SET_DEFAULT) &&
5113 val != CTX::instance()->mesh.lcIntegrationPrecision)
5114 Msg::SetOnelabChanged(2);
5115 CTX::instance()->mesh.lcIntegrationPrecision = val;
5116 }
5117 return CTX::instance()->mesh.lcIntegrationPrecision;
5118 }
5119
opt_mesh_rand_factor(OPT_ARGS_NUM)5120 double opt_mesh_rand_factor(OPT_ARGS_NUM)
5121 {
5122 if(action & GMSH_SET) {
5123 if(!(action & GMSH_SET_DEFAULT) && val != CTX::instance()->mesh.randFactor)
5124 Msg::SetOnelabChanged(2);
5125 CTX::instance()->mesh.randFactor = val;
5126 }
5127 return CTX::instance()->mesh.randFactor;
5128 }
5129
opt_mesh_rand_factor3d(OPT_ARGS_NUM)5130 double opt_mesh_rand_factor3d(OPT_ARGS_NUM)
5131 {
5132 if(action & GMSH_SET) {
5133 if(!(action & GMSH_SET_DEFAULT) &&
5134 val != CTX::instance()->mesh.randFactor3d)
5135 Msg::SetOnelabChanged(2);
5136 CTX::instance()->mesh.randFactor3d = val;
5137 }
5138 return CTX::instance()->mesh.randFactor3d;
5139 }
5140
opt_mesh_quality_type(OPT_ARGS_NUM)5141 double opt_mesh_quality_type(OPT_ARGS_NUM)
5142 {
5143 if(action & GMSH_SET) {
5144 if(CTX::instance()->mesh.qualityType != val)
5145 CTX::instance()->mesh.changed |= (ENT_CURVE | ENT_SURFACE | ENT_VOLUME);
5146 CTX::instance()->mesh.qualityType = (int)val;
5147 if(CTX::instance()->mesh.qualityType < 0 ||
5148 CTX::instance()->mesh.qualityType > 3)
5149 CTX::instance()->mesh.qualityType = 0;
5150 }
5151 #if defined(HAVE_FLTK)
5152 if(FlGui::available() && (action & GMSH_GUI)) {
5153 FlGui::instance()->options->mesh.choice[6]->value(
5154 CTX::instance()->mesh.qualityType);
5155 }
5156 #endif
5157 return CTX::instance()->mesh.qualityType;
5158 }
5159
opt_mesh_quality_inf(OPT_ARGS_NUM)5160 double opt_mesh_quality_inf(OPT_ARGS_NUM)
5161 {
5162 if(action & GMSH_SET) {
5163 if(CTX::instance()->mesh.qualityInf != val)
5164 CTX::instance()->mesh.changed |= (ENT_CURVE | ENT_SURFACE | ENT_VOLUME);
5165 CTX::instance()->mesh.qualityInf = val;
5166 }
5167 #if defined(HAVE_FLTK)
5168 if(FlGui::available() && (action & GMSH_GUI))
5169 FlGui::instance()->options->mesh.value[4]->value(
5170 CTX::instance()->mesh.qualityInf);
5171 #endif
5172 return CTX::instance()->mesh.qualityInf;
5173 }
5174
opt_mesh_quality_sup(OPT_ARGS_NUM)5175 double opt_mesh_quality_sup(OPT_ARGS_NUM)
5176 {
5177 if(action & GMSH_SET) {
5178 if(CTX::instance()->mesh.qualitySup != val)
5179 CTX::instance()->mesh.changed |= (ENT_CURVE | ENT_SURFACE | ENT_VOLUME);
5180 CTX::instance()->mesh.qualitySup = val;
5181 }
5182 #if defined(HAVE_FLTK)
5183 if(FlGui::available() && (action & GMSH_GUI))
5184 FlGui::instance()->options->mesh.value[5]->value(
5185 CTX::instance()->mesh.qualitySup);
5186 #endif
5187 return CTX::instance()->mesh.qualitySup;
5188 }
5189
opt_mesh_radius_inf(OPT_ARGS_NUM)5190 double opt_mesh_radius_inf(OPT_ARGS_NUM)
5191 {
5192 if(action & GMSH_SET) {
5193 if(CTX::instance()->mesh.radiusInf != val)
5194 CTX::instance()->mesh.changed |= (ENT_CURVE | ENT_SURFACE | ENT_VOLUME);
5195 CTX::instance()->mesh.radiusInf = val;
5196 }
5197 #if defined(HAVE_FLTK)
5198 if(FlGui::available() && (action & GMSH_GUI))
5199 FlGui::instance()->options->mesh.value[6]->value(
5200 CTX::instance()->mesh.radiusInf);
5201 #endif
5202 return CTX::instance()->mesh.radiusInf;
5203 }
5204
opt_mesh_radius_sup(OPT_ARGS_NUM)5205 double opt_mesh_radius_sup(OPT_ARGS_NUM)
5206 {
5207 if(action & GMSH_SET) {
5208 if(CTX::instance()->mesh.radiusSup != val)
5209 CTX::instance()->mesh.changed |= (ENT_CURVE | ENT_SURFACE | ENT_VOLUME);
5210 CTX::instance()->mesh.radiusSup = val;
5211 }
5212 #if defined(HAVE_FLTK)
5213 if(FlGui::available() && (action & GMSH_GUI))
5214 FlGui::instance()->options->mesh.value[7]->value(
5215 CTX::instance()->mesh.radiusSup);
5216 #endif
5217 return CTX::instance()->mesh.radiusSup;
5218 }
5219
opt_mesh_label_type(OPT_ARGS_NUM)5220 double opt_mesh_label_type(OPT_ARGS_NUM)
5221 {
5222 if(action & GMSH_SET) {
5223 CTX::instance()->mesh.labelType = (int)val;
5224 if(CTX::instance()->mesh.labelType < 0 ||
5225 CTX::instance()->mesh.labelType > 4)
5226 CTX::instance()->mesh.labelType = 0;
5227 }
5228 #if defined(HAVE_FLTK)
5229 if(FlGui::available() && (action & GMSH_GUI)) {
5230 FlGui::instance()->options->mesh.choice[7]->value(
5231 CTX::instance()->mesh.labelType);
5232 }
5233 #endif
5234 return CTX::instance()->mesh.labelType;
5235 }
5236
opt_mesh_first_element_tag(OPT_ARGS_NUM)5237 double opt_mesh_first_element_tag(OPT_ARGS_NUM)
5238 {
5239 if(action & GMSH_SET) {
5240 CTX::instance()->mesh.firstElementTag = (val > 1) ? (int)val : 1;
5241 }
5242 return CTX::instance()->mesh.firstElementTag;
5243 }
5244
opt_mesh_first_node_tag(OPT_ARGS_NUM)5245 double opt_mesh_first_node_tag(OPT_ARGS_NUM)
5246 {
5247 if(action & GMSH_SET) {
5248 CTX::instance()->mesh.firstNodeTag = (val > 1) ? (int)val : 1;
5249 }
5250 return CTX::instance()->mesh.firstNodeTag;
5251 }
5252
opt_mesh_nodes(OPT_ARGS_NUM)5253 double opt_mesh_nodes(OPT_ARGS_NUM)
5254 {
5255 if(action & GMSH_SET) { CTX::instance()->mesh.nodes = (int)val; }
5256 #if defined(HAVE_FLTK)
5257 if(FlGui::available() && (action & GMSH_GUI))
5258 FlGui::instance()->options->mesh.butt[6]->value(
5259 CTX::instance()->mesh.nodes);
5260 #endif
5261 return CTX::instance()->mesh.nodes;
5262 }
5263
opt_mesh_lines(OPT_ARGS_NUM)5264 double opt_mesh_lines(OPT_ARGS_NUM)
5265 {
5266 if(action & GMSH_SET) {
5267 if(CTX::instance()->mesh.lines != val)
5268 CTX::instance()->mesh.changed |= ENT_CURVE;
5269 CTX::instance()->mesh.lines = (int)val;
5270 }
5271 #if defined(HAVE_FLTK)
5272 if(FlGui::available() && (action & GMSH_GUI))
5273 FlGui::instance()->options->mesh.butt[7]->value(
5274 CTX::instance()->mesh.lines);
5275 #endif
5276 return CTX::instance()->mesh.lines;
5277 }
5278
opt_mesh_triangles(OPT_ARGS_NUM)5279 double opt_mesh_triangles(OPT_ARGS_NUM)
5280 {
5281 if(action & GMSH_SET) {
5282 if(CTX::instance()->mesh.triangles != val)
5283 CTX::instance()->mesh.changed |= ENT_SURFACE;
5284 CTX::instance()->mesh.triangles = (int)val;
5285 }
5286 #if defined(HAVE_FLTK)
5287 if(FlGui::available() && (action & GMSH_GUI)) {
5288 if(CTX::instance()->mesh.triangles)
5289 ((Fl_Menu_Item *)FlGui::instance()->options->mesh.menu->menu())[0].set();
5290 else
5291 ((Fl_Menu_Item *)FlGui::instance()->options->mesh.menu->menu())[0]
5292 .clear();
5293 }
5294 #endif
5295 return CTX::instance()->mesh.triangles;
5296 }
5297
opt_mesh_quadrangles(OPT_ARGS_NUM)5298 double opt_mesh_quadrangles(OPT_ARGS_NUM)
5299 {
5300 if(action & GMSH_SET) {
5301 if(CTX::instance()->mesh.quadrangles != val)
5302 CTX::instance()->mesh.changed |= ENT_SURFACE;
5303 CTX::instance()->mesh.quadrangles = (int)val;
5304 }
5305 #if defined(HAVE_FLTK)
5306 if(FlGui::available() && (action & GMSH_GUI)) {
5307 if(CTX::instance()->mesh.quadrangles)
5308 ((Fl_Menu_Item *)FlGui::instance()->options->mesh.menu->menu())[1].set();
5309 else
5310 ((Fl_Menu_Item *)FlGui::instance()->options->mesh.menu->menu())[1]
5311 .clear();
5312 }
5313 #endif
5314 return CTX::instance()->mesh.quadrangles;
5315 }
5316
opt_mesh_tetrahedra(OPT_ARGS_NUM)5317 double opt_mesh_tetrahedra(OPT_ARGS_NUM)
5318 {
5319 if(action & GMSH_SET) {
5320 if(CTX::instance()->mesh.tetrahedra != val)
5321 CTX::instance()->mesh.changed |= ENT_VOLUME;
5322 CTX::instance()->mesh.tetrahedra = (int)val;
5323 }
5324 #if defined(HAVE_FLTK)
5325 if(FlGui::available() && (action & GMSH_GUI)) {
5326 if(CTX::instance()->mesh.tetrahedra)
5327 ((Fl_Menu_Item *)FlGui::instance()->options->mesh.menu->menu())[2].set();
5328 else
5329 ((Fl_Menu_Item *)FlGui::instance()->options->mesh.menu->menu())[2]
5330 .clear();
5331 }
5332 #endif
5333 return CTX::instance()->mesh.tetrahedra;
5334 }
5335
opt_mesh_hexahedra(OPT_ARGS_NUM)5336 double opt_mesh_hexahedra(OPT_ARGS_NUM)
5337 {
5338 if(action & GMSH_SET) {
5339 if(CTX::instance()->mesh.hexahedra != val)
5340 CTX::instance()->mesh.changed |= ENT_VOLUME;
5341 CTX::instance()->mesh.hexahedra = (int)val;
5342 }
5343 #if defined(HAVE_FLTK)
5344 if(FlGui::available() && (action & GMSH_GUI)) {
5345 if(CTX::instance()->mesh.hexahedra)
5346 ((Fl_Menu_Item *)FlGui::instance()->options->mesh.menu->menu())[3].set();
5347 else
5348 ((Fl_Menu_Item *)FlGui::instance()->options->mesh.menu->menu())[3]
5349 .clear();
5350 }
5351 #endif
5352 return CTX::instance()->mesh.hexahedra;
5353 }
5354
opt_mesh_prisms(OPT_ARGS_NUM)5355 double opt_mesh_prisms(OPT_ARGS_NUM)
5356 {
5357 if(action & GMSH_SET) {
5358 if(CTX::instance()->mesh.prisms != val)
5359 CTX::instance()->mesh.changed |= ENT_VOLUME;
5360 CTX::instance()->mesh.prisms = (int)val;
5361 }
5362 #if defined(HAVE_FLTK)
5363 if(FlGui::available() && (action & GMSH_GUI)) {
5364 if(CTX::instance()->mesh.prisms)
5365 ((Fl_Menu_Item *)FlGui::instance()->options->mesh.menu->menu())[4].set();
5366 else
5367 ((Fl_Menu_Item *)FlGui::instance()->options->mesh.menu->menu())[4]
5368 .clear();
5369 }
5370 #endif
5371 return CTX::instance()->mesh.prisms;
5372 }
5373
opt_mesh_pyramids(OPT_ARGS_NUM)5374 double opt_mesh_pyramids(OPT_ARGS_NUM)
5375 {
5376 if(action & GMSH_SET) {
5377 if(CTX::instance()->mesh.pyramids != val)
5378 CTX::instance()->mesh.changed |= ENT_VOLUME;
5379 CTX::instance()->mesh.pyramids = (int)val;
5380 }
5381 #if defined(HAVE_FLTK)
5382 if(FlGui::available() && (action & GMSH_GUI)) {
5383 if(CTX::instance()->mesh.pyramids)
5384 ((Fl_Menu_Item *)FlGui::instance()->options->mesh.menu->menu())[5].set();
5385 else
5386 ((Fl_Menu_Item *)FlGui::instance()->options->mesh.menu->menu())[5]
5387 .clear();
5388 }
5389 #endif
5390 return CTX::instance()->mesh.pyramids;
5391 }
5392
opt_mesh_trihedra(OPT_ARGS_NUM)5393 double opt_mesh_trihedra(OPT_ARGS_NUM)
5394 {
5395 if(action & GMSH_SET) {
5396 if(CTX::instance()->mesh.trihedra != val)
5397 CTX::instance()->mesh.changed |= ENT_VOLUME;
5398 CTX::instance()->mesh.trihedra = (int)val;
5399 }
5400 #if defined(HAVE_FLTK)
5401 if(FlGui::available() && (action & GMSH_GUI)) {
5402 if(CTX::instance()->mesh.trihedra)
5403 ((Fl_Menu_Item *)FlGui::instance()->options->mesh.menu->menu())[6].set();
5404 else
5405 ((Fl_Menu_Item *)FlGui::instance()->options->mesh.menu->menu())[6]
5406 .clear();
5407 }
5408 #endif
5409 return CTX::instance()->mesh.trihedra;
5410 }
5411
opt_mesh_surface_edges(OPT_ARGS_NUM)5412 double opt_mesh_surface_edges(OPT_ARGS_NUM)
5413 {
5414 if(action & GMSH_SET) {
5415 if(CTX::instance()->mesh.surfaceEdges != val)
5416 CTX::instance()->mesh.changed |= ENT_SURFACE;
5417 CTX::instance()->mesh.surfaceEdges = (int)val;
5418 }
5419 #if defined(HAVE_FLTK)
5420 if(FlGui::available() && (action & GMSH_GUI))
5421 FlGui::instance()->options->mesh.butt[8]->value(
5422 CTX::instance()->mesh.surfaceEdges);
5423 #endif
5424 return CTX::instance()->mesh.surfaceEdges;
5425 }
5426
opt_mesh_surface_faces(OPT_ARGS_NUM)5427 double opt_mesh_surface_faces(OPT_ARGS_NUM)
5428 {
5429 if(action & GMSH_SET) {
5430 if(CTX::instance()->mesh.surfaceFaces != val)
5431 CTX::instance()->mesh.changed |= ENT_SURFACE;
5432 CTX::instance()->mesh.surfaceFaces = (int)val;
5433 }
5434 #if defined(HAVE_FLTK)
5435 if(FlGui::available() && (action & GMSH_GUI))
5436 FlGui::instance()->options->mesh.butt[9]->value(
5437 CTX::instance()->mesh.surfaceFaces);
5438 #endif
5439 return CTX::instance()->mesh.surfaceFaces;
5440 }
5441
opt_mesh_volume_edges(OPT_ARGS_NUM)5442 double opt_mesh_volume_edges(OPT_ARGS_NUM)
5443 {
5444 if(action & GMSH_SET) {
5445 if(CTX::instance()->mesh.volumeEdges != val)
5446 CTX::instance()->mesh.changed |= ENT_VOLUME;
5447 CTX::instance()->mesh.volumeEdges = (int)val;
5448 }
5449 #if defined(HAVE_FLTK)
5450 if(FlGui::available() && (action & GMSH_GUI))
5451 FlGui::instance()->options->mesh.butt[10]->value(
5452 CTX::instance()->mesh.volumeEdges);
5453 #endif
5454 return CTX::instance()->mesh.volumeEdges;
5455 }
5456
opt_mesh_volume_faces(OPT_ARGS_NUM)5457 double opt_mesh_volume_faces(OPT_ARGS_NUM)
5458 {
5459 if(action & GMSH_SET) {
5460 if(CTX::instance()->mesh.volumeFaces != val)
5461 CTX::instance()->mesh.changed |= ENT_VOLUME;
5462 CTX::instance()->mesh.volumeFaces = (int)val;
5463 }
5464 #if defined(HAVE_FLTK)
5465 if(FlGui::available() && (action & GMSH_GUI))
5466 FlGui::instance()->options->mesh.butt[11]->value(
5467 CTX::instance()->mesh.volumeFaces);
5468 #endif
5469 return CTX::instance()->mesh.volumeFaces;
5470 }
5471
opt_mesh_node_labels(OPT_ARGS_NUM)5472 double opt_mesh_node_labels(OPT_ARGS_NUM)
5473 {
5474 if(action & GMSH_SET) { CTX::instance()->mesh.nodeLabels = (int)val; }
5475 #if defined(HAVE_FLTK)
5476 if(FlGui::available() && (action & GMSH_GUI))
5477 FlGui::instance()->options->mesh.butt[12]->value(
5478 CTX::instance()->mesh.nodeLabels);
5479 #endif
5480 return CTX::instance()->mesh.nodeLabels;
5481 }
5482
opt_mesh_line_labels(OPT_ARGS_NUM)5483 double opt_mesh_line_labels(OPT_ARGS_NUM)
5484 {
5485 if(action & GMSH_SET) { CTX::instance()->mesh.lineLabels = (int)val; }
5486 #if defined(HAVE_FLTK)
5487 if(FlGui::available() && (action & GMSH_GUI))
5488 FlGui::instance()->options->mesh.butt[13]->value(
5489 CTX::instance()->mesh.lineLabels);
5490 #endif
5491 return CTX::instance()->mesh.lineLabels;
5492 }
5493
opt_mesh_surface_labels(OPT_ARGS_NUM)5494 double opt_mesh_surface_labels(OPT_ARGS_NUM)
5495 {
5496 if(action & GMSH_SET) { CTX::instance()->mesh.surfaceLabels = (int)val; }
5497 #if defined(HAVE_FLTK)
5498 if(FlGui::available() && (action & GMSH_GUI))
5499 FlGui::instance()->options->mesh.butt[14]->value(
5500 CTX::instance()->mesh.surfaceLabels);
5501 #endif
5502 return CTX::instance()->mesh.surfaceLabels;
5503 }
5504
opt_mesh_volume_labels(OPT_ARGS_NUM)5505 double opt_mesh_volume_labels(OPT_ARGS_NUM)
5506 {
5507 if(action & GMSH_SET) { CTX::instance()->mesh.volumeLabels = (int)val; }
5508 #if defined(HAVE_FLTK)
5509 if(FlGui::available() && (action & GMSH_GUI))
5510 FlGui::instance()->options->mesh.butt[15]->value(
5511 CTX::instance()->mesh.volumeLabels);
5512 #endif
5513 return CTX::instance()->mesh.volumeLabels;
5514 }
5515
opt_mesh_node_size(OPT_ARGS_NUM)5516 double opt_mesh_node_size(OPT_ARGS_NUM)
5517 {
5518 if(action & GMSH_SET) { CTX::instance()->mesh.nodeSize = val; }
5519 #if defined(HAVE_FLTK)
5520 if(FlGui::available() && (action & GMSH_GUI))
5521 FlGui::instance()->options->mesh.value[10]->value(
5522 CTX::instance()->mesh.nodeSize);
5523 #endif
5524 return CTX::instance()->mesh.nodeSize;
5525 }
5526
opt_mesh_node_type(OPT_ARGS_NUM)5527 double opt_mesh_node_type(OPT_ARGS_NUM)
5528 {
5529 if(action & GMSH_SET) { CTX::instance()->mesh.nodeType = (int)val; }
5530 #if defined(HAVE_FLTK)
5531 if(FlGui::available() && (action & GMSH_GUI)) {
5532 FlGui::instance()->options->mesh.choice[0]->value(
5533 CTX::instance()->mesh.nodeType ? 1 : 0);
5534 }
5535 #endif
5536 return CTX::instance()->mesh.nodeType;
5537 }
5538
opt_mesh_line_width(OPT_ARGS_NUM)5539 double opt_mesh_line_width(OPT_ARGS_NUM)
5540 {
5541 if(action & GMSH_SET) { CTX::instance()->mesh.lineWidth = val; }
5542 #if defined(HAVE_FLTK)
5543 if(FlGui::available() && (action & GMSH_GUI))
5544 FlGui::instance()->options->mesh.value[11]->value(
5545 CTX::instance()->mesh.lineWidth);
5546 #endif
5547 return CTX::instance()->mesh.lineWidth;
5548 }
5549
opt_mesh_label_sampling(OPT_ARGS_NUM)5550 double opt_mesh_label_sampling(OPT_ARGS_NUM)
5551 {
5552 if(action & GMSH_SET) { CTX::instance()->mesh.labelSampling = (int)val; }
5553 #if defined(HAVE_FLTK)
5554 if(FlGui::available() && (action & GMSH_GUI))
5555 FlGui::instance()->options->mesh.value[12]->value(
5556 CTX::instance()->mesh.labelSampling);
5557 #endif
5558 return CTX::instance()->mesh.labelSampling;
5559 }
5560
opt_mesh_smooth_normals(OPT_ARGS_NUM)5561 double opt_mesh_smooth_normals(OPT_ARGS_NUM)
5562 {
5563 if(action & GMSH_SET) {
5564 if(CTX::instance()->mesh.smoothNormals != val)
5565 CTX::instance()->mesh.changed |= ENT_SURFACE;
5566 CTX::instance()->mesh.smoothNormals = (int)val;
5567 }
5568 #if defined(HAVE_FLTK)
5569 if(FlGui::available() && (action & GMSH_GUI))
5570 FlGui::instance()->options->mesh.butt[19]->value(
5571 CTX::instance()->mesh.smoothNormals);
5572 #endif
5573 return CTX::instance()->mesh.smoothNormals;
5574 }
5575
opt_mesh_smooth_ratio(OPT_ARGS_NUM)5576 double opt_mesh_smooth_ratio(OPT_ARGS_NUM)
5577 {
5578 if(action & GMSH_SET) CTX::instance()->mesh.smoothRatio = val;
5579 return CTX::instance()->mesh.smoothRatio;
5580 }
5581
opt_mesh_aniso_max(OPT_ARGS_NUM)5582 double opt_mesh_aniso_max(OPT_ARGS_NUM)
5583 {
5584 if(action & GMSH_SET) CTX::instance()->mesh.anisoMax = val;
5585 return CTX::instance()->mesh.anisoMax;
5586 }
5587
opt_mesh_angle_smooth_normals(OPT_ARGS_NUM)5588 double opt_mesh_angle_smooth_normals(OPT_ARGS_NUM)
5589 {
5590 if(action & GMSH_SET) {
5591 if(CTX::instance()->mesh.angleSmoothNormals != val)
5592 CTX::instance()->mesh.changed |= ENT_SURFACE;
5593 CTX::instance()->mesh.angleSmoothNormals = val;
5594 }
5595 #if defined(HAVE_FLTK)
5596 if(FlGui::available() && (action & GMSH_GUI))
5597 FlGui::instance()->options->mesh.value[18]->value(
5598 CTX::instance()->mesh.angleSmoothNormals);
5599 #endif
5600 return CTX::instance()->mesh.angleSmoothNormals;
5601 }
5602
opt_mesh_light(OPT_ARGS_NUM)5603 double opt_mesh_light(OPT_ARGS_NUM)
5604 {
5605 if(action & GMSH_SET) CTX::instance()->mesh.light = (int)val;
5606 #if defined(HAVE_FLTK)
5607 if(FlGui::available() && (action & GMSH_GUI)) {
5608 FlGui::instance()->options->mesh.butt[17]->value(
5609 CTX::instance()->mesh.light);
5610 FlGui::instance()->options->activate("mesh_light");
5611 }
5612 #endif
5613 return CTX::instance()->mesh.light;
5614 }
5615
opt_mesh_light_lines(OPT_ARGS_NUM)5616 double opt_mesh_light_lines(OPT_ARGS_NUM)
5617 {
5618 if(action & GMSH_SET) {
5619 if(CTX::instance()->mesh.lightLines != (int)val)
5620 CTX::instance()->mesh.changed |= ENT_SURFACE | ENT_VOLUME;
5621 CTX::instance()->mesh.lightLines = (int)val;
5622 if(CTX::instance()->mesh.lightLines < 0 ||
5623 CTX::instance()->mesh.lightLines > 2)
5624 CTX::instance()->mesh.lightLines = 1;
5625 }
5626 #if defined(HAVE_FLTK)
5627 if(FlGui::available() && (action & GMSH_GUI))
5628 FlGui::instance()->options->mesh.choice[10]->value(
5629 CTX::instance()->mesh.lightLines);
5630 #endif
5631 return CTX::instance()->mesh.lightLines;
5632 }
5633
opt_mesh_light_two_side(OPT_ARGS_NUM)5634 double opt_mesh_light_two_side(OPT_ARGS_NUM)
5635 {
5636 if(action & GMSH_SET) CTX::instance()->mesh.lightTwoSide = (int)val;
5637 #if defined(HAVE_FLTK)
5638 if(FlGui::available() && (action & GMSH_GUI))
5639 FlGui::instance()->options->mesh.butt[18]->value(
5640 CTX::instance()->mesh.lightTwoSide);
5641 #endif
5642 return CTX::instance()->mesh.lightTwoSide;
5643 }
5644
opt_mesh_file_format(OPT_ARGS_NUM)5645 double opt_mesh_file_format(OPT_ARGS_NUM)
5646 {
5647 if(action & GMSH_SET) CTX::instance()->mesh.fileFormat = (int)val;
5648 return CTX::instance()->mesh.fileFormat;
5649 }
5650
opt_mesh_newton_convergence_test_xyz(OPT_ARGS_NUM)5651 double opt_mesh_newton_convergence_test_xyz(OPT_ARGS_NUM)
5652 {
5653 if(action & GMSH_SET)
5654 CTX::instance()->mesh.NewtonConvergenceTestXYZ = (int)val;
5655 return CTX::instance()->mesh.NewtonConvergenceTestXYZ;
5656 }
5657
opt_mesh_msh_file_version(OPT_ARGS_NUM)5658 double opt_mesh_msh_file_version(OPT_ARGS_NUM)
5659 {
5660 if(action & GMSH_SET) CTX::instance()->mesh.mshFileVersion = val;
5661 return CTX::instance()->mesh.mshFileVersion;
5662 }
5663
opt_mesh_med_file_minor_version(OPT_ARGS_NUM)5664 double opt_mesh_med_file_minor_version(OPT_ARGS_NUM)
5665 {
5666 if(action & GMSH_SET) CTX::instance()->mesh.medFileMinorVersion = val;
5667 return CTX::instance()->mesh.medFileMinorVersion;
5668 }
5669
opt_mesh_med_import_groups_of_nodes(OPT_ARGS_NUM)5670 double opt_mesh_med_import_groups_of_nodes(OPT_ARGS_NUM)
5671 {
5672 if(action & GMSH_SET) CTX::instance()->mesh.medImportGroupsOfNodes = (int)val;
5673 return CTX::instance()->mesh.medImportGroupsOfNodes;
5674 }
5675
opt_mesh_med_single_model(OPT_ARGS_NUM)5676 double opt_mesh_med_single_model(OPT_ARGS_NUM)
5677 {
5678 if(action & GMSH_SET) CTX::instance()->mesh.medSingleModel = (int)val;
5679 return CTX::instance()->mesh.medSingleModel;
5680 }
5681
opt_mesh_partition_split_mesh_files(OPT_ARGS_NUM)5682 double opt_mesh_partition_split_mesh_files(OPT_ARGS_NUM)
5683 {
5684 if(action & GMSH_SET)
5685 CTX::instance()->mesh.partitionSplitMeshFiles = (int)val;
5686 return CTX::instance()->mesh.partitionSplitMeshFiles;
5687 }
5688
opt_mesh_partition_save_topology_file(OPT_ARGS_NUM)5689 double opt_mesh_partition_save_topology_file(OPT_ARGS_NUM)
5690 {
5691 if(action & GMSH_SET)
5692 CTX::instance()->mesh.partitionSaveTopologyFile = (int)val;
5693 return CTX::instance()->mesh.partitionSaveTopologyFile;
5694 }
5695
opt_mesh_partition_hex_weight(OPT_ARGS_NUM)5696 double opt_mesh_partition_hex_weight(OPT_ARGS_NUM)
5697 {
5698 if(action & GMSH_SET) CTX::instance()->mesh.partitionHexWeight = (int)val;
5699 return CTX::instance()->mesh.partitionHexWeight;
5700 }
5701
opt_mesh_partition_pri_weight(OPT_ARGS_NUM)5702 double opt_mesh_partition_pri_weight(OPT_ARGS_NUM)
5703 {
5704 if(action & GMSH_SET) CTX::instance()->mesh.partitionPriWeight = (int)val;
5705 return CTX::instance()->mesh.partitionPriWeight;
5706 }
5707
opt_mesh_partition_pyr_weight(OPT_ARGS_NUM)5708 double opt_mesh_partition_pyr_weight(OPT_ARGS_NUM)
5709 {
5710 if(action & GMSH_SET) CTX::instance()->mesh.partitionPyrWeight = (int)val;
5711 return CTX::instance()->mesh.partitionPyrWeight;
5712 }
5713
opt_mesh_partition_trih_weight(OPT_ARGS_NUM)5714 double opt_mesh_partition_trih_weight(OPT_ARGS_NUM)
5715 {
5716 if(action & GMSH_SET) CTX::instance()->mesh.partitionTrihWeight = (int)val;
5717 return CTX::instance()->mesh.partitionTrihWeight;
5718 }
5719
opt_mesh_partition_qua_weight(OPT_ARGS_NUM)5720 double opt_mesh_partition_qua_weight(OPT_ARGS_NUM)
5721 {
5722 if(action & GMSH_SET) CTX::instance()->mesh.partitionQuaWeight = (int)val;
5723 return CTX::instance()->mesh.partitionQuaWeight;
5724 }
5725
opt_mesh_partition_tet_weight(OPT_ARGS_NUM)5726 double opt_mesh_partition_tet_weight(OPT_ARGS_NUM)
5727 {
5728 if(action & GMSH_SET) CTX::instance()->mesh.partitionTetWeight = (int)val;
5729 return CTX::instance()->mesh.partitionTetWeight;
5730 }
5731
opt_mesh_partition_tri_weight(OPT_ARGS_NUM)5732 double opt_mesh_partition_tri_weight(OPT_ARGS_NUM)
5733 {
5734 if(action & GMSH_SET) CTX::instance()->mesh.partitionTriWeight = (int)val;
5735 return CTX::instance()->mesh.partitionTriWeight;
5736 }
5737
opt_mesh_partition_line_weight(OPT_ARGS_NUM)5738 double opt_mesh_partition_line_weight(OPT_ARGS_NUM)
5739 {
5740 if(action & GMSH_SET) CTX::instance()->mesh.partitionLinWeight = (int)val;
5741 return CTX::instance()->mesh.partitionLinWeight;
5742 }
5743
opt_mesh_partition_create_physicals(OPT_ARGS_NUM)5744 double opt_mesh_partition_create_physicals(OPT_ARGS_NUM)
5745 {
5746 if(action & GMSH_SET) CTX::instance()->mesh.partitionCreatePhysicals = val;
5747 return CTX::instance()->mesh.partitionCreatePhysicals;
5748 }
5749
opt_mesh_partition_create_topology(OPT_ARGS_NUM)5750 double opt_mesh_partition_create_topology(OPT_ARGS_NUM)
5751 {
5752 if(action & GMSH_SET) CTX::instance()->mesh.partitionCreateTopology = val;
5753 return CTX::instance()->mesh.partitionCreateTopology;
5754 }
5755
opt_mesh_partition_create_ghost_cells(OPT_ARGS_NUM)5756 double opt_mesh_partition_create_ghost_cells(OPT_ARGS_NUM)
5757 {
5758 if(action & GMSH_SET) CTX::instance()->mesh.partitionCreateGhostCells = val;
5759 return CTX::instance()->mesh.partitionCreateGhostCells;
5760 }
5761
opt_mesh_partition_old_style_msh2(OPT_ARGS_NUM)5762 double opt_mesh_partition_old_style_msh2(OPT_ARGS_NUM)
5763 {
5764 if(action & GMSH_SET) CTX::instance()->mesh.partitionOldStyleMsh2 = val;
5765 return CTX::instance()->mesh.partitionOldStyleMsh2;
5766 }
5767
opt_mesh_partition_convert_msh2(OPT_ARGS_NUM)5768 double opt_mesh_partition_convert_msh2(OPT_ARGS_NUM)
5769 {
5770 if(action & GMSH_SET) CTX::instance()->mesh.partitionConvertMsh2 = val;
5771 return CTX::instance()->mesh.partitionConvertMsh2;
5772 }
5773
opt_mesh_create_topology_msh2(OPT_ARGS_NUM)5774 double opt_mesh_create_topology_msh2(OPT_ARGS_NUM)
5775 {
5776 if(action & GMSH_SET) CTX::instance()->mesh.createTopologyMsh2 = val;
5777 return CTX::instance()->mesh.createTopologyMsh2;
5778 }
5779
opt_mesh_binary(OPT_ARGS_NUM)5780 double opt_mesh_binary(OPT_ARGS_NUM)
5781 {
5782 if(action & GMSH_SET) CTX::instance()->mesh.binary = (int)val;
5783 return CTX::instance()->mesh.binary;
5784 }
5785
opt_mesh_boundary_layer_fan_elements(OPT_ARGS_NUM)5786 double opt_mesh_boundary_layer_fan_elements(OPT_ARGS_NUM)
5787 {
5788 if(action & GMSH_SET) {
5789 int n = (int)val;
5790 if(n < 0) n = 0;
5791 CTX::instance()->mesh.boundaryLayerFanElements = n;
5792 }
5793 return CTX::instance()->mesh.boundaryLayerFanElements;
5794 }
5795
opt_mesh_smooth_cross_field(OPT_ARGS_NUM)5796 double opt_mesh_smooth_cross_field(OPT_ARGS_NUM)
5797 {
5798 if(action & GMSH_SET) CTX::instance()->mesh.smoothCrossField = (int)val;
5799 return CTX::instance()->mesh.smoothCrossField;
5800 }
5801
opt_mesh_cross_field_closest_point(OPT_ARGS_NUM)5802 double opt_mesh_cross_field_closest_point(OPT_ARGS_NUM)
5803 {
5804 if(action & GMSH_SET) CTX::instance()->mesh.crossFieldClosestPoint = (int)val;
5805 return CTX::instance()->mesh.crossFieldClosestPoint;
5806 }
5807
opt_mesh_bdf_field_format(OPT_ARGS_NUM)5808 double opt_mesh_bdf_field_format(OPT_ARGS_NUM)
5809 {
5810 if(action & GMSH_SET) {
5811 CTX::instance()->mesh.bdfFieldFormat = (int)val;
5812 if(CTX::instance()->mesh.bdfFieldFormat < 0 ||
5813 CTX::instance()->mesh.bdfFieldFormat > 2)
5814 CTX::instance()->mesh.bdfFieldFormat = 1;
5815 }
5816 return CTX::instance()->mesh.bdfFieldFormat;
5817 }
5818
opt_mesh_stl_remove_duplicate_triangles(OPT_ARGS_NUM)5819 double opt_mesh_stl_remove_duplicate_triangles(OPT_ARGS_NUM)
5820 {
5821 if(action & GMSH_SET) {
5822 CTX::instance()->mesh.stlRemoveDuplicateTriangles = (int)val;
5823 }
5824 return CTX::instance()->mesh.stlRemoveDuplicateTriangles;
5825 }
5826
opt_mesh_stl_one_solid_per_surface(OPT_ARGS_NUM)5827 double opt_mesh_stl_one_solid_per_surface(OPT_ARGS_NUM)
5828 {
5829 if(action & GMSH_SET) {
5830 CTX::instance()->mesh.stlOneSolidPerSurface = (int)val;
5831 }
5832 return CTX::instance()->mesh.stlOneSolidPerSurface;
5833 }
5834
opt_mesh_stl_linear_deflection(OPT_ARGS_NUM)5835 double opt_mesh_stl_linear_deflection(OPT_ARGS_NUM)
5836 {
5837 if(action & GMSH_SET) { CTX::instance()->mesh.stlLinearDeflection = val; }
5838 return CTX::instance()->mesh.stlLinearDeflection;
5839 }
5840
opt_mesh_stl_angular_deflection(OPT_ARGS_NUM)5841 double opt_mesh_stl_angular_deflection(OPT_ARGS_NUM)
5842 {
5843 if(action & GMSH_SET) { CTX::instance()->mesh.stlAngularDeflection = val; }
5844 return CTX::instance()->mesh.stlAngularDeflection;
5845 }
5846
opt_mesh_nb_smoothing(OPT_ARGS_NUM)5847 double opt_mesh_nb_smoothing(OPT_ARGS_NUM)
5848 {
5849 if(action & GMSH_SET) CTX::instance()->mesh.nbSmoothing = (int)val;
5850 #if defined(HAVE_FLTK)
5851 if(FlGui::available() && (action & GMSH_GUI))
5852 FlGui::instance()->options->mesh.value[0]->value(
5853 CTX::instance()->mesh.nbSmoothing);
5854 #endif
5855 return CTX::instance()->mesh.nbSmoothing;
5856 }
5857
opt_mesh_algo2d(OPT_ARGS_NUM)5858 double opt_mesh_algo2d(OPT_ARGS_NUM)
5859 {
5860 if(action & GMSH_SET) {
5861 if(!(action & GMSH_SET_DEFAULT) && (int)val != CTX::instance()->mesh.algo2d)
5862 Msg::SetOnelabChanged(2);
5863 CTX::instance()->mesh.algo2d = (int)val;
5864 }
5865 #if defined(HAVE_FLTK)
5866 if(FlGui::available() && (action & GMSH_GUI)) {
5867 switch(CTX::instance()->mesh.algo2d) {
5868 case ALGO_2D_MESHADAPT:
5869 FlGui::instance()->options->mesh.choice[2]->value(1);
5870 break;
5871 case ALGO_2D_DELAUNAY:
5872 FlGui::instance()->options->mesh.choice[2]->value(2);
5873 break;
5874 case ALGO_2D_FRONTAL:
5875 FlGui::instance()->options->mesh.choice[2]->value(3);
5876 break;
5877 case ALGO_2D_BAMG:
5878 FlGui::instance()->options->mesh.choice[2]->value(4);
5879 break;
5880 case ALGO_2D_FRONTAL_QUAD:
5881 FlGui::instance()->options->mesh.choice[2]->value(5);
5882 break;
5883 case ALGO_2D_PACK_PRLGRMS:
5884 FlGui::instance()->options->mesh.choice[2]->value(6);
5885 break;
5886 case ALGO_2D_QUAD_QUASI_STRUCT:
5887 FlGui::instance()->options->mesh.choice[2]->value(7);
5888 break;
5889 case ALGO_2D_INITIAL_ONLY:
5890 FlGui::instance()->options->mesh.choice[2]->value(8);
5891 break;
5892 case ALGO_2D_AUTO:
5893 default: FlGui::instance()->options->mesh.choice[2]->value(0); break;
5894 }
5895 }
5896 #endif
5897 return CTX::instance()->mesh.algo2d;
5898 }
5899
opt_mesh_algo_switch_on_failure(OPT_ARGS_NUM)5900 double opt_mesh_algo_switch_on_failure(OPT_ARGS_NUM)
5901 {
5902 if(action & GMSH_SET) {
5903 CTX::instance()->mesh.algoSwitchOnFailure = (int)val;
5904 }
5905 return CTX::instance()->mesh.algoSwitchOnFailure;
5906 }
5907
opt_mesh_max_retries(OPT_ARGS_NUM)5908 double opt_mesh_max_retries(OPT_ARGS_NUM)
5909 {
5910 if(action & GMSH_SET) { CTX::instance()->mesh.maxRetries = (int)val; }
5911 return CTX::instance()->mesh.maxRetries;
5912 }
5913
opt_mesh_algo_recombine(OPT_ARGS_NUM)5914 double opt_mesh_algo_recombine(OPT_ARGS_NUM)
5915 {
5916 if(action & GMSH_SET) {
5917 if(!(action & GMSH_SET_DEFAULT) &&
5918 (int)val != CTX::instance()->mesh.algoRecombine)
5919 Msg::SetOnelabChanged(2);
5920 CTX::instance()->mesh.algoRecombine = (int)val;
5921 if(CTX::instance()->mesh.algoRecombine < 0 ||
5922 CTX::instance()->mesh.algoRecombine > 4)
5923 CTX::instance()->mesh.algoRecombine = 0;
5924 }
5925 #if defined(HAVE_FLTK)
5926 if(FlGui::available() && (action & GMSH_GUI)) {
5927 FlGui::instance()->options->mesh.choice[1]->value(
5928 CTX::instance()->mesh.algoRecombine);
5929 }
5930 #endif
5931 return CTX::instance()->mesh.algoRecombine;
5932 }
5933
opt_mesh_recombine_all(OPT_ARGS_NUM)5934 double opt_mesh_recombine_all(OPT_ARGS_NUM)
5935 {
5936 if(action & GMSH_SET) {
5937 if(!(action & GMSH_SET_DEFAULT) &&
5938 (int)val != CTX::instance()->mesh.recombineAll)
5939 Msg::SetOnelabChanged(2);
5940 CTX::instance()->mesh.recombineAll = (int)val;
5941 }
5942 #if defined(HAVE_FLTK)
5943 if(FlGui::available() && (action & GMSH_GUI))
5944 FlGui::instance()->options->mesh.butt[21]->value(
5945 CTX::instance()->mesh.recombineAll);
5946 #endif
5947 return CTX::instance()->mesh.recombineAll;
5948 }
5949
opt_mesh_recombine_optimize_topology(OPT_ARGS_NUM)5950 double opt_mesh_recombine_optimize_topology(OPT_ARGS_NUM)
5951 {
5952 if(action & GMSH_SET) {
5953 CTX::instance()->mesh.recombineOptimizeTopology = (int)val;
5954 }
5955 return CTX::instance()->mesh.recombineOptimizeTopology;
5956 }
5957
opt_mesh_recombine3d_all(OPT_ARGS_NUM)5958 double opt_mesh_recombine3d_all(OPT_ARGS_NUM)
5959 {
5960 if(action & GMSH_SET) {
5961 if(!(action & GMSH_SET_DEFAULT) &&
5962 (int)val != CTX::instance()->mesh.recombine3DAll)
5963 Msg::SetOnelabChanged(2);
5964 CTX::instance()->mesh.recombine3DAll = (int)val;
5965 }
5966 return CTX::instance()->mesh.recombine3DAll;
5967 }
5968
opt_mesh_recombine3d_level(OPT_ARGS_NUM)5969 double opt_mesh_recombine3d_level(OPT_ARGS_NUM)
5970 {
5971 if(action & GMSH_SET) { CTX::instance()->mesh.recombine3DLevel = (int)val; }
5972 return CTX::instance()->mesh.recombine3DLevel;
5973 }
5974
opt_mesh_recombine3d_conformity(OPT_ARGS_NUM)5975 double opt_mesh_recombine3d_conformity(OPT_ARGS_NUM)
5976 {
5977 if(action & GMSH_SET) {
5978 CTX::instance()->mesh.recombine3DConformity = (int)val;
5979 }
5980 return CTX::instance()->mesh.recombine3DConformity;
5981 }
5982
opt_mesh_flexible_transfinite(OPT_ARGS_NUM)5983 double opt_mesh_flexible_transfinite(OPT_ARGS_NUM)
5984 {
5985 if(action & GMSH_SET) {
5986 CTX::instance()->mesh.flexibleTransfinite = (int)val;
5987 }
5988 return CTX::instance()->mesh.flexibleTransfinite;
5989 }
5990
opt_mesh_algo_subdivide(OPT_ARGS_NUM)5991 double opt_mesh_algo_subdivide(OPT_ARGS_NUM)
5992 {
5993 if(action & GMSH_SET) {
5994 if(!(action & GMSH_SET_DEFAULT) &&
5995 (int)val != CTX::instance()->mesh.algoSubdivide)
5996 Msg::SetOnelabChanged(2);
5997 CTX::instance()->mesh.algoSubdivide = (int)val;
5998 if(CTX::instance()->mesh.algoSubdivide < 0 &&
5999 CTX::instance()->mesh.algoSubdivide > 2)
6000 CTX::instance()->mesh.algoSubdivide = 0;
6001 }
6002 #if defined(HAVE_FLTK)
6003 if(FlGui::available() && (action & GMSH_GUI)) {
6004 FlGui::instance()->options->mesh.choice[5]->value(
6005 CTX::instance()->mesh.algoSubdivide);
6006 }
6007 #endif
6008 return CTX::instance()->mesh.algoSubdivide;
6009 }
6010
opt_mesh_algo3d(OPT_ARGS_NUM)6011 double opt_mesh_algo3d(OPT_ARGS_NUM)
6012 {
6013 if(action & GMSH_SET) {
6014 if(!(action & GMSH_SET_DEFAULT) && (int)val != CTX::instance()->mesh.algo3d)
6015 Msg::SetOnelabChanged(2);
6016 CTX::instance()->mesh.algo3d = (int)val;
6017 // "New Delaunay" is now simply "Delaunay"
6018 if(CTX::instance()->mesh.algo3d == 2)
6019 CTX::instance()->mesh.algo3d = 1;
6020 }
6021 #if defined(HAVE_FLTK)
6022 if(FlGui::available() && (action & GMSH_GUI)) {
6023 switch(CTX::instance()->mesh.algo3d) {
6024 case ALGO_3D_FRONTAL:
6025 FlGui::instance()->options->mesh.choice[3]->value(1);
6026 break;
6027 case ALGO_3D_HXT:
6028 FlGui::instance()->options->mesh.choice[3]->value(2);
6029 break;
6030 case ALGO_3D_MMG3D:
6031 FlGui::instance()->options->mesh.choice[3]->value(3);
6032 break;
6033 case ALGO_3D_INITIAL_ONLY:
6034 FlGui::instance()->options->mesh.choice[3]->value(4);
6035 break;
6036 case ALGO_3D_DELAUNAY:
6037 default: FlGui::instance()->options->mesh.choice[3]->value(0); break;
6038 }
6039 }
6040 #endif
6041 return CTX::instance()->mesh.algo3d;
6042 }
6043
opt_mesh_mesh_only_visible(OPT_ARGS_NUM)6044 double opt_mesh_mesh_only_visible(OPT_ARGS_NUM)
6045 {
6046 if(action & GMSH_SET) {
6047 if(!(action & GMSH_SET_DEFAULT) &&
6048 (int)val != CTX::instance()->mesh.meshOnlyVisible)
6049 Msg::SetOnelabChanged(2);
6050 CTX::instance()->mesh.meshOnlyVisible = (int)val;
6051 }
6052 return CTX::instance()->mesh.meshOnlyVisible;
6053 }
6054
opt_mesh_mesh_only_empty(OPT_ARGS_NUM)6055 double opt_mesh_mesh_only_empty(OPT_ARGS_NUM)
6056 {
6057 if(action & GMSH_SET) {
6058 if(!(action & GMSH_SET_DEFAULT) &&
6059 (int)val != CTX::instance()->mesh.meshOnlyEmpty)
6060 Msg::SetOnelabChanged(2);
6061 CTX::instance()->mesh.meshOnlyEmpty = (int)val;
6062 }
6063 return CTX::instance()->mesh.meshOnlyEmpty;
6064 }
6065
opt_mesh_min_circle_nodes(OPT_ARGS_NUM)6066 double opt_mesh_min_circle_nodes(OPT_ARGS_NUM)
6067 {
6068 if(action & GMSH_SET) {
6069 if(!(action & GMSH_SET_DEFAULT) &&
6070 (int)val != CTX::instance()->mesh.minCircleNodes)
6071 Msg::SetOnelabChanged(2);
6072 CTX::instance()->mesh.minCircleNodes = (int)val;
6073 }
6074 return CTX::instance()->mesh.minCircleNodes;
6075 }
6076
opt_mesh_allow_swap_edge_angle(OPT_ARGS_NUM)6077 double opt_mesh_allow_swap_edge_angle(OPT_ARGS_NUM)
6078 {
6079 if(action & GMSH_SET) CTX::instance()->mesh.allowSwapEdgeAngle = val;
6080 return CTX::instance()->mesh.allowSwapEdgeAngle;
6081 }
6082
opt_mesh_min_curve_nodes(OPT_ARGS_NUM)6083 double opt_mesh_min_curve_nodes(OPT_ARGS_NUM)
6084 {
6085 if(action & GMSH_SET) CTX::instance()->mesh.minCurveNodes = (int)val;
6086 return CTX::instance()->mesh.minCurveNodes;
6087 }
6088
opt_mesh_order(OPT_ARGS_NUM)6089 double opt_mesh_order(OPT_ARGS_NUM)
6090 {
6091 if(action & GMSH_SET) {
6092 if(!(action & GMSH_SET_DEFAULT) && (int)val != CTX::instance()->mesh.order)
6093 Msg::SetOnelabChanged(2);
6094 CTX::instance()->mesh.order = (int)val;
6095 }
6096 #if defined(HAVE_FLTK)
6097 if(FlGui::available() && (action & GMSH_GUI))
6098 FlGui::instance()->options->mesh.value[3]->value(
6099 CTX::instance()->mesh.order);
6100 #endif
6101 return CTX::instance()->mesh.order;
6102 }
6103
opt_mesh_ho_optimize(OPT_ARGS_NUM)6104 double opt_mesh_ho_optimize(OPT_ARGS_NUM)
6105 {
6106 if(action & GMSH_SET) CTX::instance()->mesh.hoOptimize = (int)val;
6107 #if defined(HAVE_FLTK)
6108 if(FlGui::available() && (action & GMSH_GUI))
6109 FlGui::instance()->options->mesh.butt[3]->value(
6110 CTX::instance()->mesh.hoOptimize == 2 ? 1 : 0);
6111 #endif
6112 return CTX::instance()->mesh.hoOptimize;
6113 }
6114
opt_mesh_ho_periodic(OPT_ARGS_NUM)6115 double opt_mesh_ho_periodic(OPT_ARGS_NUM)
6116 {
6117 if(action & GMSH_SET) CTX::instance()->mesh.hoPeriodic = (int)val;
6118 return CTX::instance()->mesh.hoPeriodic;
6119 }
6120
opt_mesh_ho_save_periodic(OPT_ARGS_NUM)6121 double opt_mesh_ho_save_periodic(OPT_ARGS_NUM)
6122 {
6123 if(action & GMSH_SET) CTX::instance()->mesh.hoSavePeriodic = (int)val;
6124 return CTX::instance()->mesh.hoSavePeriodic;
6125 }
6126
opt_mesh_ho_nlayers(OPT_ARGS_NUM)6127 double opt_mesh_ho_nlayers(OPT_ARGS_NUM)
6128 {
6129 if(action & GMSH_SET) CTX::instance()->mesh.hoNLayers = (int)val;
6130 return CTX::instance()->mesh.hoNLayers;
6131 }
6132
opt_mesh_ho_threshold_min(OPT_ARGS_NUM)6133 double opt_mesh_ho_threshold_min(OPT_ARGS_NUM)
6134 {
6135 if(action & GMSH_SET) CTX::instance()->mesh.hoThresholdMin = val;
6136 return CTX::instance()->mesh.hoThresholdMin;
6137 }
6138
opt_mesh_ho_threshold_max(OPT_ARGS_NUM)6139 double opt_mesh_ho_threshold_max(OPT_ARGS_NUM)
6140 {
6141 if(action & GMSH_SET) CTX::instance()->mesh.hoThresholdMax = val;
6142 return CTX::instance()->mesh.hoThresholdMax;
6143 }
6144
opt_mesh_ho_prim_surf_mesh(OPT_ARGS_NUM)6145 double opt_mesh_ho_prim_surf_mesh(OPT_ARGS_NUM)
6146 {
6147 if(action & GMSH_SET) CTX::instance()->mesh.hoPrimSurfMesh = (int)val;
6148 return CTX::instance()->mesh.hoPrimSurfMesh;
6149 }
6150
opt_mesh_ho_dist_cad(OPT_ARGS_NUM)6151 double opt_mesh_ho_dist_cad(OPT_ARGS_NUM)
6152 {
6153 if(action & GMSH_SET) CTX::instance()->mesh.hoDistCAD = (int)val;
6154 return CTX::instance()->mesh.hoDistCAD;
6155 }
6156
opt_mesh_ho_iter_max(OPT_ARGS_NUM)6157 double opt_mesh_ho_iter_max(OPT_ARGS_NUM)
6158 {
6159 if(action & GMSH_SET) CTX::instance()->mesh.hoIterMax = (int)val;
6160 return CTX::instance()->mesh.hoIterMax;
6161 }
6162
opt_mesh_ho_pass_max(OPT_ARGS_NUM)6163 double opt_mesh_ho_pass_max(OPT_ARGS_NUM)
6164 {
6165 if(action & GMSH_SET) CTX::instance()->mesh.hoPassMax = (int)val;
6166 return CTX::instance()->mesh.hoPassMax;
6167 }
6168
opt_mesh_ho_poisson(OPT_ARGS_NUM)6169 double opt_mesh_ho_poisson(OPT_ARGS_NUM)
6170 {
6171 if(action & GMSH_SET) {
6172 double ratio = val;
6173 if(ratio <= -1.0)
6174 ratio = -0.999;
6175 else if(ratio >= 0.5)
6176 ratio = 0.499;
6177 CTX::instance()->mesh.hoPoissonRatio = ratio;
6178 }
6179 return CTX::instance()->mesh.hoPoissonRatio;
6180 }
6181
opt_mesh_ho_fast_new_algo(OPT_ARGS_NUM)6182 double opt_mesh_ho_fast_new_algo(OPT_ARGS_NUM)
6183 {
6184 if(action & GMSH_SET)
6185 CTX::instance()->mesh.hoNewFastCurvingAlgo = !(val == 0.);
6186 return CTX::instance()->mesh.hoNewFastCurvingAlgo ? 1. : 0.;
6187 }
6188
opt_mesh_ho_curve_outer_BL(OPT_ARGS_NUM)6189 double opt_mesh_ho_curve_outer_BL(OPT_ARGS_NUM)
6190 {
6191 if(action & GMSH_SET) CTX::instance()->mesh.hoCurveOuterBL = (int)val;
6192 return CTX::instance()->mesh.hoCurveOuterBL;
6193 }
6194
opt_mesh_ho_max_rho(OPT_ARGS_NUM)6195 double opt_mesh_ho_max_rho(OPT_ARGS_NUM)
6196 {
6197 if(action & GMSH_SET) CTX::instance()->mesh.hoMaxRho = val;
6198 return CTX::instance()->mesh.hoMaxRho;
6199 }
6200
opt_mesh_ho_max_angle(OPT_ARGS_NUM)6201 double opt_mesh_ho_max_angle(OPT_ARGS_NUM)
6202 {
6203 if(action & GMSH_SET) CTX::instance()->mesh.hoMaxAngle = val;
6204 return CTX::instance()->mesh.hoMaxAngle;
6205 }
6206
opt_mesh_ho_max_in_angle(OPT_ARGS_NUM)6207 double opt_mesh_ho_max_in_angle(OPT_ARGS_NUM)
6208 {
6209 if(action & GMSH_SET) CTX::instance()->mesh.hoMaxInnerAngle = val;
6210 return CTX::instance()->mesh.hoMaxInnerAngle;
6211 }
6212
opt_mesh_second_order_linear(OPT_ARGS_NUM)6213 double opt_mesh_second_order_linear(OPT_ARGS_NUM)
6214 {
6215 if(action & GMSH_SET) {
6216 if(!(action & GMSH_SET_DEFAULT) &&
6217 (int)val != CTX::instance()->mesh.secondOrderLinear)
6218 Msg::SetOnelabChanged(2);
6219 CTX::instance()->mesh.secondOrderLinear = (int)val;
6220 }
6221 return CTX::instance()->mesh.secondOrderLinear;
6222 }
6223
opt_mesh_second_order_incomplete(OPT_ARGS_NUM)6224 double opt_mesh_second_order_incomplete(OPT_ARGS_NUM)
6225 {
6226 if(action & GMSH_SET) {
6227 if(!(action & GMSH_SET_DEFAULT) &&
6228 (int)val != CTX::instance()->mesh.secondOrderIncomplete)
6229 Msg::SetOnelabChanged(2);
6230 CTX::instance()->mesh.secondOrderIncomplete = (int)val;
6231 }
6232 #if defined(HAVE_FLTK)
6233 if(FlGui::available() && (action & GMSH_GUI))
6234 FlGui::instance()->options->mesh.butt[4]->value(
6235 CTX::instance()->mesh.secondOrderIncomplete);
6236 #endif
6237 return CTX::instance()->mesh.secondOrderIncomplete;
6238 }
6239
opt_mesh_cgns_import_order(OPT_ARGS_NUM)6240 double opt_mesh_cgns_import_order(OPT_ARGS_NUM)
6241 {
6242 if(action & GMSH_SET) {
6243 int value = std::min((int)val, 4);
6244 CTX::instance()->mesh.cgnsImportOrder = value;
6245 }
6246 return CTX::instance()->mesh.cgnsImportOrder;
6247 }
6248
opt_mesh_cgns_import_ignore_bc(OPT_ARGS_NUM)6249 double opt_mesh_cgns_import_ignore_bc(OPT_ARGS_NUM)
6250 {
6251 if(action & GMSH_SET) {
6252 CTX::instance()->mesh.cgnsImportIgnoreBC = (int)val;
6253 }
6254 return CTX::instance()->mesh.cgnsImportIgnoreBC;
6255 }
6256
opt_mesh_cgns_import_ignore_solution(OPT_ARGS_NUM)6257 double opt_mesh_cgns_import_ignore_solution(OPT_ARGS_NUM)
6258 {
6259 if(action & GMSH_SET) {
6260 CTX::instance()->mesh.cgnsImportIgnoreSolution = (int)val;
6261 }
6262 return CTX::instance()->mesh.cgnsImportIgnoreSolution;
6263 }
6264
opt_mesh_cgns_construct_topology(OPT_ARGS_NUM)6265 double opt_mesh_cgns_construct_topology(OPT_ARGS_NUM)
6266 {
6267 if(action & GMSH_SET) {
6268 CTX::instance()->mesh.cgnsConstructTopology = (int)val;
6269 }
6270 return CTX::instance()->mesh.cgnsConstructTopology;
6271 }
6272
opt_mesh_cgns_export_cpex0045(OPT_ARGS_NUM)6273 double opt_mesh_cgns_export_cpex0045(OPT_ARGS_NUM)
6274 {
6275 if(action & GMSH_SET) {
6276 CTX::instance()->mesh.cgnsExportCPEX0045 = (int)val;
6277 }
6278 return CTX::instance()->mesh.cgnsExportCPEX0045;
6279 }
6280
opt_mesh_cgns_export_structured(OPT_ARGS_NUM)6281 double opt_mesh_cgns_export_structured(OPT_ARGS_NUM)
6282 {
6283 if(action & GMSH_SET) {
6284 CTX::instance()->mesh.cgnsExportStructured = (int)val;
6285 }
6286 return CTX::instance()->mesh.cgnsExportStructured;
6287 }
6288
opt_mesh_dual(OPT_ARGS_NUM)6289 double opt_mesh_dual(OPT_ARGS_NUM)
6290 {
6291 if(action & GMSH_SET) { CTX::instance()->mesh.dual = (int)val; }
6292 return CTX::instance()->mesh.dual;
6293 }
6294
opt_mesh_voronoi(OPT_ARGS_NUM)6295 double opt_mesh_voronoi(OPT_ARGS_NUM)
6296 {
6297 if(action & GMSH_SET) { CTX::instance()->mesh.voronoi = (int)val; }
6298 return CTX::instance()->mesh.voronoi;
6299 }
6300
opt_mesh_draw_skin_only(OPT_ARGS_NUM)6301 double opt_mesh_draw_skin_only(OPT_ARGS_NUM)
6302 {
6303 if(action & GMSH_SET) { CTX::instance()->mesh.drawSkinOnly = (int)val; }
6304 return CTX::instance()->mesh.drawSkinOnly;
6305 }
6306
opt_mesh_save_all(OPT_ARGS_NUM)6307 double opt_mesh_save_all(OPT_ARGS_NUM)
6308 {
6309 if(action & GMSH_SET) CTX::instance()->mesh.saveAll = (int)val;
6310 return CTX::instance()->mesh.saveAll;
6311 }
6312
opt_mesh_save_element_tag_type(OPT_ARGS_NUM)6313 double opt_mesh_save_element_tag_type(OPT_ARGS_NUM)
6314 {
6315 if(action & GMSH_SET) CTX::instance()->mesh.saveElementTagType = (int)val;
6316 return CTX::instance()->mesh.saveElementTagType;
6317 }
6318
opt_mesh_save_parametric(OPT_ARGS_NUM)6319 double opt_mesh_save_parametric(OPT_ARGS_NUM)
6320 {
6321 if(action & GMSH_SET) CTX::instance()->mesh.saveParametric = val ? 1 : 0;
6322 return CTX::instance()->mesh.saveParametric;
6323 }
6324
opt_mesh_save_topology(OPT_ARGS_NUM)6325 double opt_mesh_save_topology(OPT_ARGS_NUM)
6326 {
6327 if(action & GMSH_SET) CTX::instance()->mesh.saveTopology = val ? 1 : 0;
6328 return CTX::instance()->mesh.saveTopology;
6329 }
6330
opt_mesh_read_groups_of_elements(OPT_ARGS_NUM)6331 double opt_mesh_read_groups_of_elements(OPT_ARGS_NUM)
6332 {
6333 if(action & GMSH_SET) CTX::instance()->mesh.readGroupsOfElements = (int)val;
6334 return CTX::instance()->mesh.readGroupsOfElements;
6335 }
6336
opt_mesh_save_groups_of_elements(OPT_ARGS_NUM)6337 double opt_mesh_save_groups_of_elements(OPT_ARGS_NUM)
6338 {
6339 if(action & GMSH_SET) CTX::instance()->mesh.saveGroupsOfElements = (int)val;
6340 return CTX::instance()->mesh.saveGroupsOfElements;
6341 }
6342
opt_mesh_save_groups_of_nodes(OPT_ARGS_NUM)6343 double opt_mesh_save_groups_of_nodes(OPT_ARGS_NUM)
6344 {
6345 if(action & GMSH_SET) CTX::instance()->mesh.saveGroupsOfNodes = (int)val;
6346 return CTX::instance()->mesh.saveGroupsOfNodes;
6347 }
6348
opt_mesh_color_carousel(OPT_ARGS_NUM)6349 double opt_mesh_color_carousel(OPT_ARGS_NUM)
6350 {
6351 if(action & GMSH_SET) {
6352 // vertex arrays need to be regenerated only when we color by
6353 // element type or by partition
6354 if(CTX::instance()->mesh.colorCarousel != (int)val &&
6355 ((val == 0. || val == 3.) || CTX::instance()->pickElements))
6356 CTX::instance()->mesh.changed |= (ENT_CURVE | ENT_SURFACE | ENT_VOLUME);
6357 CTX::instance()->mesh.colorCarousel = (int)val;
6358 if(CTX::instance()->mesh.colorCarousel < 0 ||
6359 CTX::instance()->mesh.colorCarousel > 3)
6360 CTX::instance()->mesh.colorCarousel = 0;
6361 }
6362 #if defined(HAVE_FLTK)
6363 if(FlGui::available() && (action & GMSH_GUI)) {
6364 FlGui::instance()->options->mesh.choice[4]->value(
6365 CTX::instance()->mesh.colorCarousel);
6366 drawContext::global()->resetFontTextures();
6367 }
6368 #endif
6369 return CTX::instance()->mesh.colorCarousel;
6370 }
6371
opt_mesh_compound_classify(OPT_ARGS_NUM)6372 double opt_mesh_compound_classify(OPT_ARGS_NUM)
6373 {
6374 if(action & GMSH_SET) CTX::instance()->mesh.compoundClassify = (int)val;
6375 return CTX::instance()->mesh.compoundClassify;
6376 }
6377
opt_mesh_compound_lc_factor(OPT_ARGS_NUM)6378 double opt_mesh_compound_lc_factor(OPT_ARGS_NUM)
6379 {
6380 if(action & GMSH_SET) CTX::instance()->mesh.compoundLcFactor = val;
6381 return CTX::instance()->mesh.compoundLcFactor;
6382 }
6383
opt_mesh_random_seed(OPT_ARGS_NUM)6384 double opt_mesh_random_seed(OPT_ARGS_NUM)
6385 {
6386 if(action & GMSH_SET) CTX::instance()->mesh.randomSeed = (unsigned int)val;
6387 return CTX::instance()->mesh.randomSeed;
6388 }
6389
opt_mesh_switch_elem_tags(OPT_ARGS_NUM)6390 double opt_mesh_switch_elem_tags(OPT_ARGS_NUM)
6391 {
6392 if(action & GMSH_SET) CTX::instance()->mesh.switchElementTags = val ? 1 : 0;
6393 return CTX::instance()->mesh.switchElementTags;
6394 }
6395
opt_mesh_zone_definition(OPT_ARGS_NUM)6396 double opt_mesh_zone_definition(OPT_ARGS_NUM)
6397 {
6398 if(action & GMSH_SET) {
6399 CTX::instance()->mesh.zoneDefinition = (int)val;
6400 if((CTX::instance()->mesh.zoneDefinition < 0 ||
6401 CTX::instance()->mesh.zoneDefinition > 2) ||
6402 (CTX::instance()->mesh.zoneDefinition == 1))
6403 CTX::instance()->mesh.zoneDefinition = 0;
6404 }
6405 return CTX::instance()->mesh.zoneDefinition;
6406 }
6407
6408 #if !defined(HAVE_MESH)
GetStatistics(double stat[50])6409 static void GetStatistics(double stat[50])
6410 {
6411 for(int i = 0; i < 50; i++) stat[i] = 0;
6412 }
6413 #endif
6414
opt_mesh_nb_nodes(OPT_ARGS_NUM)6415 double opt_mesh_nb_nodes(OPT_ARGS_NUM)
6416 {
6417 double s[50];
6418 GetStatistics(s);
6419 return s[4];
6420 }
6421
opt_mesh_nb_triangles(OPT_ARGS_NUM)6422 double opt_mesh_nb_triangles(OPT_ARGS_NUM)
6423 {
6424 double s[50];
6425 GetStatistics(s);
6426 return s[7];
6427 }
6428
opt_mesh_nb_quadrangles(OPT_ARGS_NUM)6429 double opt_mesh_nb_quadrangles(OPT_ARGS_NUM)
6430 {
6431 double s[50];
6432 GetStatistics(s);
6433 return s[8];
6434 }
6435
opt_mesh_nb_tetrahedra(OPT_ARGS_NUM)6436 double opt_mesh_nb_tetrahedra(OPT_ARGS_NUM)
6437 {
6438 double s[50];
6439 GetStatistics(s);
6440 return s[9];
6441 }
6442
opt_mesh_nb_hexahedra(OPT_ARGS_NUM)6443 double opt_mesh_nb_hexahedra(OPT_ARGS_NUM)
6444 {
6445 double s[50];
6446 GetStatistics(s);
6447 return s[10];
6448 }
6449
opt_mesh_nb_prisms(OPT_ARGS_NUM)6450 double opt_mesh_nb_prisms(OPT_ARGS_NUM)
6451 {
6452 double s[50];
6453 GetStatistics(s);
6454 return s[11];
6455 }
6456
opt_mesh_nb_pyramids(OPT_ARGS_NUM)6457 double opt_mesh_nb_pyramids(OPT_ARGS_NUM)
6458 {
6459 double s[50];
6460 GetStatistics(s);
6461 return s[12];
6462 }
6463
opt_mesh_nb_trihedra(OPT_ARGS_NUM)6464 double opt_mesh_nb_trihedra(OPT_ARGS_NUM)
6465 {
6466 double s[50];
6467 GetStatistics(s);
6468 return s[13];
6469 }
6470
opt_mesh_cpu_time(OPT_ARGS_NUM)6471 double opt_mesh_cpu_time(OPT_ARGS_NUM)
6472 {
6473 double s[50];
6474 GetStatistics(s);
6475 return s[14] + s[15] + s[16];
6476 }
6477
opt_mesh_partition_num(OPT_ARGS_NUM)6478 double opt_mesh_partition_num(OPT_ARGS_NUM)
6479 {
6480 if(action & GMSH_SET) {
6481 const int ival = std::max(0, (int)val);
6482 CTX::instance()->mesh.numPartitions = ival;
6483 CTX::instance()->mesh.metisAlgorithm = (ival <= 8) ? 1 : 2;
6484 }
6485 return CTX::instance()->mesh.numPartitions;
6486 }
6487
opt_mesh_partition_metis_algorithm(OPT_ARGS_NUM)6488 double opt_mesh_partition_metis_algorithm(OPT_ARGS_NUM)
6489 {
6490 if(action & GMSH_SET) CTX::instance()->mesh.metisAlgorithm = (int)val;
6491 return CTX::instance()->mesh.metisAlgorithm;
6492 }
6493
opt_mesh_partition_metis_edge_matching(OPT_ARGS_NUM)6494 double opt_mesh_partition_metis_edge_matching(OPT_ARGS_NUM)
6495 {
6496 if(action & GMSH_SET) CTX::instance()->mesh.metisEdgeMatching = (int)val;
6497 return CTX::instance()->mesh.metisEdgeMatching;
6498 }
6499
opt_mesh_partition_metis_refinement_algorithm(OPT_ARGS_NUM)6500 double opt_mesh_partition_metis_refinement_algorithm(OPT_ARGS_NUM)
6501 {
6502 if(action & GMSH_SET)
6503 CTX::instance()->mesh.metisRefinementAlgorithm = (int)val;
6504 return CTX::instance()->mesh.metisRefinementAlgorithm;
6505 }
6506
opt_mesh_partition_metis_max_load_imbalance(OPT_ARGS_NUM)6507 double opt_mesh_partition_metis_max_load_imbalance(OPT_ARGS_NUM)
6508 {
6509 if(action & GMSH_SET) CTX::instance()->mesh.metisMaxLoadImbalance = val;
6510 return CTX::instance()->mesh.metisMaxLoadImbalance;
6511 }
6512
opt_mesh_partition_metis_objective(OPT_ARGS_NUM)6513 double opt_mesh_partition_metis_objective(OPT_ARGS_NUM)
6514 {
6515 if(action & GMSH_SET) CTX::instance()->mesh.metisObjective = (int)val;
6516 return CTX::instance()->mesh.metisObjective;
6517 }
6518
opt_mesh_partition_metis_min_conn(OPT_ARGS_NUM)6519 double opt_mesh_partition_metis_min_conn(OPT_ARGS_NUM)
6520 {
6521 if(action & GMSH_SET) CTX::instance()->mesh.metisMinConn = (int)val;
6522 return CTX::instance()->mesh.metisMinConn;
6523 }
6524
opt_mesh_clip(OPT_ARGS_NUM)6525 double opt_mesh_clip(OPT_ARGS_NUM)
6526 {
6527 if(action & GMSH_SET) CTX::instance()->mesh.clip = (int)val;
6528 #if defined(HAVE_FLTK)
6529 if(FlGui::available() && (action & GMSH_GUI))
6530 FlGui::instance()->clipping->resetBrowser();
6531 #endif
6532 return CTX::instance()->mesh.clip;
6533 }
6534
opt_mesh_preserve_numbering_msh2(OPT_ARGS_NUM)6535 double opt_mesh_preserve_numbering_msh2(OPT_ARGS_NUM)
6536 {
6537 if(action & GMSH_SET) CTX::instance()->mesh.preserveNumberingMsh2 = (int)val;
6538 return CTX::instance()->mesh.preserveNumberingMsh2;
6539 }
6540
opt_mesh_ignore_periodicity(OPT_ARGS_NUM)6541 double opt_mesh_ignore_periodicity(OPT_ARGS_NUM)
6542 {
6543 if(action & GMSH_SET) CTX::instance()->mesh.ignorePeriodicityMsh2 = (int)val;
6544 return CTX::instance()->mesh.ignorePeriodicityMsh2;
6545 }
6546
opt_mesh_max_iter_delaunay_3d(OPT_ARGS_NUM)6547 double opt_mesh_max_iter_delaunay_3d(OPT_ARGS_NUM)
6548 {
6549 if(action & GMSH_SET) CTX::instance()->mesh.maxIterDelaunay3D = (int)val;
6550 return CTX::instance()->mesh.maxIterDelaunay3D;
6551 }
6552
opt_mesh_max_num_threads_1d(OPT_ARGS_NUM)6553 double opt_mesh_max_num_threads_1d(OPT_ARGS_NUM)
6554 {
6555 if(action & GMSH_SET) CTX::instance()->mesh.maxNumThreads1D = (int)val;
6556 return CTX::instance()->mesh.maxNumThreads1D;
6557 }
6558
opt_mesh_max_num_threads_2d(OPT_ARGS_NUM)6559 double opt_mesh_max_num_threads_2d(OPT_ARGS_NUM)
6560 {
6561 if(action & GMSH_SET) CTX::instance()->mesh.maxNumThreads2D = (int)val;
6562 return CTX::instance()->mesh.maxNumThreads2D;
6563 }
6564
opt_mesh_max_num_threads_3d(OPT_ARGS_NUM)6565 double opt_mesh_max_num_threads_3d(OPT_ARGS_NUM)
6566 {
6567 if(action & GMSH_SET) CTX::instance()->mesh.maxNumThreads3D = (int)val;
6568 return CTX::instance()->mesh.maxNumThreads3D;
6569 }
6570
opt_mesh_angle_tolerance_facet_overlap(OPT_ARGS_NUM)6571 double opt_mesh_angle_tolerance_facet_overlap(OPT_ARGS_NUM)
6572 {
6573 if(action & GMSH_SET) {
6574 if(!(action & GMSH_SET_DEFAULT) &&
6575 val != CTX::instance()->mesh.angleToleranceFacetOverlap)
6576 Msg::SetOnelabChanged(2);
6577 CTX::instance()->mesh.angleToleranceFacetOverlap = val;
6578 }
6579 return CTX::instance()->mesh.angleToleranceFacetOverlap;
6580 }
6581
opt_mesh_tolerance_reference_element(OPT_ARGS_NUM)6582 double opt_mesh_tolerance_reference_element(OPT_ARGS_NUM)
6583 {
6584 if(action & GMSH_SET) CTX::instance()->mesh.toleranceReferenceElement = val;
6585 return CTX::instance()->mesh.toleranceReferenceElement;
6586 }
6587
opt_mesh_unv_strict_format(OPT_ARGS_NUM)6588 double opt_mesh_unv_strict_format(OPT_ARGS_NUM)
6589 {
6590 if(action & GMSH_SET) CTX::instance()->mesh.unvStrictFormat = (int)val;
6591 return CTX::instance()->mesh.unvStrictFormat;
6592 }
6593
opt_mesh_reparam_max_triangles(OPT_ARGS_NUM)6594 double opt_mesh_reparam_max_triangles(OPT_ARGS_NUM)
6595 {
6596 if(action & GMSH_SET) CTX::instance()->mesh.reparamMaxTriangles = (int)val;
6597 return CTX::instance()->mesh.reparamMaxTriangles;
6598 }
6599
opt_mesh_ignore_parametrization(OPT_ARGS_NUM)6600 double opt_mesh_ignore_parametrization(OPT_ARGS_NUM)
6601 {
6602 if(action & GMSH_SET)
6603 CTX::instance()->mesh.ignoreParametrizationMsh4 = (int)val;
6604 return CTX::instance()->mesh.ignoreParametrizationMsh4;
6605 }
6606
opt_mesh_quadqs_sizemap_method(OPT_ARGS_NUM)6607 double opt_mesh_quadqs_sizemap_method(OPT_ARGS_NUM)
6608 {
6609 if(action & GMSH_SET) CTX::instance()->mesh.quadqsSizemapMethod = (int)val;
6610 return CTX::instance()->mesh.quadqsSizemapMethod;
6611 }
6612
opt_mesh_quadqs_remeshing_boldness(OPT_ARGS_NUM)6613 double opt_mesh_quadqs_remeshing_boldness(OPT_ARGS_NUM)
6614 {
6615 if(action & GMSH_SET)
6616 CTX::instance()->mesh.quadqsRemeshingBoldness = (double)val;
6617 return CTX::instance()->mesh.quadqsRemeshingBoldness;
6618 }
6619
opt_mesh_quadqs_topo_optim_methods(OPT_ARGS_NUM)6620 double opt_mesh_quadqs_topo_optim_methods(OPT_ARGS_NUM)
6621 {
6622 if(action & GMSH_SET)
6623 CTX::instance()->mesh.quadqsTopoOptimMethods = (int)val;
6624 return CTX::instance()->mesh.quadqsTopoOptimMethods;
6625 }
6626
opt_mesh_quadqs_scaling_on_triangulation(OPT_ARGS_NUM)6627 double opt_mesh_quadqs_scaling_on_triangulation(OPT_ARGS_NUM) {
6628 if(action & GMSH_SET) CTX::instance()->mesh.quadqsScalingOnTriangulation = (double)val;
6629 return CTX::instance()->mesh.quadqsScalingOnTriangulation;
6630 }
6631
opt_mesh_old_initial_delaunay_2d(OPT_ARGS_NUM)6632 double opt_mesh_old_initial_delaunay_2d(OPT_ARGS_NUM)
6633 {
6634 if(action & GMSH_SET)
6635 CTX::instance()->mesh.oldInitialDelaunay2D = (int)val;
6636 return CTX::instance()->mesh.oldInitialDelaunay2D;
6637 }
6638
opt_solver_listen(OPT_ARGS_NUM)6639 double opt_solver_listen(OPT_ARGS_NUM)
6640 {
6641 if(action & GMSH_SET) CTX::instance()->solver.listen = (int)val;
6642 #if defined(HAVE_FLTK)
6643 if(FlGui::available() && (action & GMSH_GUI))
6644 FlGui::instance()->options->solver.butt[0]->value(
6645 CTX::instance()->solver.listen);
6646 #endif
6647 return CTX::instance()->solver.listen;
6648 }
6649
opt_solver_timeout(OPT_ARGS_NUM)6650 double opt_solver_timeout(OPT_ARGS_NUM)
6651 {
6652 if(action & GMSH_SET) CTX::instance()->solver.timeout = val;
6653 #if defined(HAVE_FLTK)
6654 if(FlGui::available() && (action & GMSH_GUI))
6655 FlGui::instance()->options->solver.value[0]->value(
6656 CTX::instance()->solver.timeout);
6657 #endif
6658 return CTX::instance()->solver.timeout;
6659 }
6660
opt_solver_plugins(OPT_ARGS_NUM)6661 double opt_solver_plugins(OPT_ARGS_NUM)
6662 {
6663 if(action & GMSH_SET) CTX::instance()->solver.plugins = (int)val;
6664 return CTX::instance()->solver.plugins;
6665 }
6666
opt_solver_auto_load_database(OPT_ARGS_NUM)6667 double opt_solver_auto_load_database(OPT_ARGS_NUM)
6668 {
6669 if(action & GMSH_SET) CTX::instance()->solver.autoLoadDatabase = (int)val;
6670 return CTX::instance()->solver.autoLoadDatabase;
6671 }
6672
opt_solver_auto_save_database(OPT_ARGS_NUM)6673 double opt_solver_auto_save_database(OPT_ARGS_NUM)
6674 {
6675 if(action & GMSH_SET) CTX::instance()->solver.autoSaveDatabase = (int)val;
6676 return CTX::instance()->solver.autoSaveDatabase;
6677 }
6678
opt_solver_auto_archive_output_files(OPT_ARGS_NUM)6679 double opt_solver_auto_archive_output_files(OPT_ARGS_NUM)
6680 {
6681 if(action & GMSH_SET)
6682 CTX::instance()->solver.autoArchiveOutputFiles = (int)val;
6683 return CTX::instance()->solver.autoArchiveOutputFiles;
6684 }
6685
opt_solver_auto_check(OPT_ARGS_NUM)6686 double opt_solver_auto_check(OPT_ARGS_NUM)
6687 {
6688 if(action & GMSH_SET) CTX::instance()->solver.autoCheck = (int)val;
6689 return CTX::instance()->solver.autoCheck;
6690 }
6691
opt_solver_auto_mesh(OPT_ARGS_NUM)6692 double opt_solver_auto_mesh(OPT_ARGS_NUM)
6693 {
6694 if(action & GMSH_SET) CTX::instance()->solver.autoMesh = (int)val;
6695 return CTX::instance()->solver.autoMesh;
6696 }
6697
opt_solver_auto_merge_file(OPT_ARGS_NUM)6698 double opt_solver_auto_merge_file(OPT_ARGS_NUM)
6699 {
6700 if(action & GMSH_SET) CTX::instance()->solver.autoMergeFile = (int)val;
6701 return CTX::instance()->solver.autoMergeFile;
6702 }
6703
opt_solver_auto_show_views(OPT_ARGS_NUM)6704 double opt_solver_auto_show_views(OPT_ARGS_NUM)
6705 {
6706 if(action & GMSH_SET) CTX::instance()->solver.autoShowViews = (int)val;
6707 return CTX::instance()->solver.autoShowViews;
6708 }
6709
opt_solver_auto_show_last_step(OPT_ARGS_NUM)6710 double opt_solver_auto_show_last_step(OPT_ARGS_NUM)
6711 {
6712 if(action & GMSH_SET) CTX::instance()->solver.autoShowLastStep = (int)val;
6713 return CTX::instance()->solver.autoShowLastStep;
6714 }
6715
opt_solver_show_invisible_parameters(OPT_ARGS_NUM)6716 double opt_solver_show_invisible_parameters(OPT_ARGS_NUM)
6717 {
6718 if(action & GMSH_SET)
6719 CTX::instance()->solver.showInvisibleParameters = (int)val;
6720 return CTX::instance()->solver.showInvisibleParameters;
6721 }
6722
opt_post_horizontal_scales(OPT_ARGS_NUM)6723 double opt_post_horizontal_scales(OPT_ARGS_NUM)
6724 {
6725 if(action & GMSH_SET) CTX::instance()->post.horizontalScales = (int)val;
6726 #if defined(HAVE_FLTK)
6727 if(FlGui::available() && (action & GMSH_GUI))
6728 FlGui::instance()->options->post.butt[2]->value(
6729 CTX::instance()->post.horizontalScales);
6730 #endif
6731 return CTX::instance()->post.horizontalScales;
6732 }
6733
opt_post_binary(OPT_ARGS_NUM)6734 double opt_post_binary(OPT_ARGS_NUM)
6735 {
6736 if(action & GMSH_SET) CTX::instance()->post.binary = (int)val;
6737 return CTX::instance()->post.binary;
6738 }
6739
opt_post_link(OPT_ARGS_NUM)6740 double opt_post_link(OPT_ARGS_NUM)
6741 {
6742 if(action & GMSH_SET) { CTX::instance()->post.link = (int)val; }
6743 #if defined(HAVE_FLTK)
6744 if(FlGui::available() && (action & GMSH_GUI)) {
6745 FlGui::instance()->options->post.choice[0]->value(
6746 CTX::instance()->post.link ? 1 : 0);
6747 }
6748 #endif
6749 return CTX::instance()->post.link;
6750 }
6751
opt_post_smooth(OPT_ARGS_NUM)6752 double opt_post_smooth(OPT_ARGS_NUM)
6753 {
6754 if(action & GMSH_SET) CTX::instance()->post.smooth = (int)val;
6755 return CTX::instance()->post.smooth;
6756 }
6757
opt_post_anim_delay(OPT_ARGS_NUM)6758 double opt_post_anim_delay(OPT_ARGS_NUM)
6759 {
6760 if(action & GMSH_SET)
6761 CTX::instance()->post.animDelay = (val >= 0.) ? val : 0.;
6762 #if defined(HAVE_FLTK)
6763 if(FlGui::available() && (action & GMSH_GUI))
6764 FlGui::instance()->options->post.value[0]->value(
6765 CTX::instance()->post.animDelay);
6766 #endif
6767 return CTX::instance()->post.animDelay;
6768 }
6769
opt_post_anim_cycle(OPT_ARGS_NUM)6770 double opt_post_anim_cycle(OPT_ARGS_NUM)
6771 {
6772 if(action & GMSH_SET) {
6773 CTX::instance()->post.animCycle = (int)val;
6774 if(CTX::instance()->post.animCycle < 0 ||
6775 CTX::instance()->post.animCycle > 2)
6776 CTX::instance()->post.animCycle = 0;
6777 }
6778 #if defined(HAVE_FLTK)
6779 if(FlGui::available() && (action & GMSH_GUI))
6780 FlGui::instance()->options->post.butt[0]->value(
6781 CTX::instance()->post.animCycle);
6782 if(FlGui::available())
6783 for(std::size_t i = 0; i < FlGui::instance()->graph.size(); i++)
6784 FlGui::instance()->graph[i]->checkAnimButtons();
6785 #endif
6786 return CTX::instance()->post.animCycle;
6787 }
6788
opt_post_anim_step(OPT_ARGS_NUM)6789 double opt_post_anim_step(OPT_ARGS_NUM)
6790 {
6791 if(action & GMSH_SET) {
6792 CTX::instance()->post.animStep = (int)val;
6793 if(CTX::instance()->post.animStep < 1) CTX::instance()->post.animStep = 1;
6794 }
6795 #if defined(HAVE_FLTK)
6796 if(FlGui::available() && (action & GMSH_GUI))
6797 FlGui::instance()->options->post.value[1]->value(
6798 CTX::instance()->post.animStep);
6799 #endif
6800 return CTX::instance()->post.animStep;
6801 }
6802
opt_post_combine_remove_orig(OPT_ARGS_NUM)6803 double opt_post_combine_remove_orig(OPT_ARGS_NUM)
6804 {
6805 if(action & GMSH_SET) CTX::instance()->post.combineRemoveOrig = (int)val;
6806 #if defined(HAVE_FLTK)
6807 if(FlGui::available() && (action & GMSH_GUI))
6808 FlGui::instance()->options->post.butt[1]->value(
6809 CTX::instance()->post.combineRemoveOrig);
6810 #endif
6811 return CTX::instance()->post.combineRemoveOrig;
6812 }
6813
opt_post_combine_copy_options(OPT_ARGS_NUM)6814 double opt_post_combine_copy_options(OPT_ARGS_NUM)
6815 {
6816 if(action & GMSH_SET) CTX::instance()->post.combineCopyOptions = (int)val;
6817 return CTX::instance()->post.combineCopyOptions;
6818 }
6819
opt_post_plugins(OPT_ARGS_NUM)6820 double opt_post_plugins(OPT_ARGS_NUM)
6821 {
6822 if(action & GMSH_SET) CTX::instance()->post.plugins = (int)val;
6823 return CTX::instance()->post.plugins;
6824 }
6825
opt_post_nb_views(OPT_ARGS_NUM)6826 double opt_post_nb_views(OPT_ARGS_NUM)
6827 {
6828 #if defined(HAVE_POST)
6829 return PView::list.size();
6830 #else
6831 return 0;
6832 #endif
6833 }
6834
opt_post_file_format(OPT_ARGS_NUM)6835 double opt_post_file_format(OPT_ARGS_NUM)
6836 {
6837 if(action & GMSH_SET) CTX::instance()->post.fileFormat = (int)val;
6838 return CTX::instance()->post.fileFormat;
6839 }
6840
opt_post_force_node_data(OPT_ARGS_NUM)6841 double opt_post_force_node_data(OPT_ARGS_NUM)
6842 {
6843 if(action & GMSH_SET) CTX::instance()->post.forceNodeData = (int)val;
6844 return CTX::instance()->post.forceNodeData;
6845 }
6846
opt_post_force_element_data(OPT_ARGS_NUM)6847 double opt_post_force_element_data(OPT_ARGS_NUM)
6848 {
6849 if(action & GMSH_SET) CTX::instance()->post.forceElementData = (int)val;
6850 return CTX::instance()->post.forceElementData;
6851 }
6852
opt_post_save_mesh(OPT_ARGS_NUM)6853 double opt_post_save_mesh(OPT_ARGS_NUM)
6854 {
6855 if(action & GMSH_SET) CTX::instance()->post.saveMesh = (int)val;
6856 return CTX::instance()->post.saveMesh;
6857 }
6858
opt_post_save_interpolation_matrices(OPT_ARGS_NUM)6859 double opt_post_save_interpolation_matrices(OPT_ARGS_NUM)
6860 {
6861 if(action & GMSH_SET)
6862 CTX::instance()->post.saveInterpolationMatrices = (int)val;
6863 return CTX::instance()->post.saveInterpolationMatrices;
6864 }
6865
opt_post_double_clicked_graph_point_x(OPT_ARGS_NUM)6866 double opt_post_double_clicked_graph_point_x(OPT_ARGS_NUM)
6867 {
6868 if(action & GMSH_SET) CTX::instance()->post.doubleClickedGraphPointX = val;
6869 return CTX::instance()->post.doubleClickedGraphPointX;
6870 }
6871
opt_post_double_clicked_graph_point_y(OPT_ARGS_NUM)6872 double opt_post_double_clicked_graph_point_y(OPT_ARGS_NUM)
6873 {
6874 if(action & GMSH_SET) CTX::instance()->post.doubleClickedGraphPointY = val;
6875 return CTX::instance()->post.doubleClickedGraphPointY;
6876 }
6877
opt_post_double_clicked_view(OPT_ARGS_NUM)6878 double opt_post_double_clicked_view(OPT_ARGS_NUM)
6879 {
6880 if(action & GMSH_SET) CTX::instance()->post.doubleClickedView = (int)val;
6881 return CTX::instance()->post.doubleClickedView;
6882 }
6883
opt_view_nb_timestep(OPT_ARGS_NUM)6884 double opt_view_nb_timestep(OPT_ARGS_NUM)
6885 {
6886 #if defined(HAVE_POST)
6887 GET_VIEWd(0.);
6888 if(!data) return 1;
6889 #if defined(HAVE_FLTK)
6890 if(_gui_action_valid(action, num))
6891 FlGui::instance()->options->view.value[50]->maximum(
6892 data->getNumTimeSteps() - 1);
6893 if(FlGui::available())
6894 for(std::size_t i = 0; i < FlGui::instance()->graph.size(); i++)
6895 FlGui::instance()->graph[i]->checkAnimButtons();
6896 #endif
6897 return data->getNumTimeSteps();
6898 #else
6899 return 0.;
6900 #endif
6901 }
6902
opt_view_nb_non_empty_timestep(OPT_ARGS_NUM)6903 double opt_view_nb_non_empty_timestep(OPT_ARGS_NUM)
6904 {
6905 #if defined(HAVE_POST)
6906 GET_VIEWd(0.);
6907 if(!data) return 0;
6908 int n = 0;
6909 for(int i = 0; i < data->getNumTimeSteps(); i++)
6910 if(data->hasTimeStep(i)) n++;
6911 return n;
6912 #else
6913 return 0.;
6914 #endif
6915 }
6916
opt_view_timestep(OPT_ARGS_NUM)6917 double opt_view_timestep(OPT_ARGS_NUM)
6918 {
6919 #if defined(HAVE_POST)
6920 GET_VIEW(0.);
6921 if(action & GMSH_SET) {
6922 opt->timeStep = (int)val;
6923 if(data) {
6924 if(opt->timeStep > data->getNumTimeSteps() - 1)
6925 opt->timeStep = 0;
6926 else if(opt->timeStep < 0)
6927 opt->timeStep = data->getNumTimeSteps() - 1;
6928 if(data->getAdaptiveData())
6929 data->getAdaptiveData()->changeResolution(
6930 opt->timeStep, opt->maxRecursionLevel, opt->targetError);
6931 opt->currentTime = data->getTime(opt->timeStep);
6932 }
6933 if(view) view->setChanged(true);
6934 }
6935 #if defined(HAVE_FLTK)
6936 if(_gui_action_valid(action, num))
6937 FlGui::instance()->options->view.value[50]->value(opt->timeStep);
6938 #endif
6939 return opt->timeStep;
6940 #else
6941 return 0.;
6942 #endif
6943 }
6944
opt_view_time(OPT_ARGS_NUM)6945 double opt_view_time(OPT_ARGS_NUM)
6946 {
6947 #if defined(HAVE_POST)
6948 GET_VIEW(0.);
6949 if(data && (action & GMSH_SET)) {
6950 if(val >= 0.) {
6951 // if negative (the default), don't do anything so that we do not compete
6952 // with timestep
6953 double dt_min = std::numeric_limits<double>::max();
6954 int step = 0;
6955 for(int i = 0; i < data->getNumTimeSteps(); i++) {
6956 double dt = std::abs(data->getTime(i) - val);
6957 if(dt < dt_min) {
6958 step = i;
6959 dt_min = std::min(dt_min, dt);
6960 }
6961 }
6962 opt_view_timestep(num, action, step);
6963 }
6964 }
6965 return opt->currentTime;
6966 #else
6967 return 0.;
6968 #endif
6969 }
6970
opt_view_min(OPT_ARGS_NUM)6971 double opt_view_min(OPT_ARGS_NUM)
6972 {
6973 #if defined(HAVE_POST)
6974 GET_VIEWd(0.);
6975 if(!data) return 0.;
6976 // use adaptive data if available
6977 return view->getData(true)->getMin();
6978 #else
6979 return 0.;
6980 #endif
6981 }
6982
opt_view_max(OPT_ARGS_NUM)6983 double opt_view_max(OPT_ARGS_NUM)
6984 {
6985 #if defined(HAVE_POST)
6986 GET_VIEWd(0.);
6987 if(!data) return 0.;
6988 // use adaptive data if available
6989 return view->getData(true)->getMax();
6990 #else
6991 return 0.;
6992 #endif
6993 }
6994
opt_view_min_visible(OPT_ARGS_NUM)6995 double opt_view_min_visible(OPT_ARGS_NUM)
6996 {
6997 #if defined(HAVE_POST)
6998 GET_VIEW(0.);
6999 if(!data) return 0.;
7000 int tensorRep = (opt->tensorType == PViewOptions::VonMises) ?
7001 0 :
7002 (opt->tensorType == PViewOptions::MaxEigenValue) ? 1 : 2;
7003 return data->getMin(opt->timeStep, true, tensorRep, opt->forceNumComponents,
7004 opt->componentMap);
7005 #else
7006 return 0.;
7007 #endif
7008 }
7009
opt_view_max_visible(OPT_ARGS_NUM)7010 double opt_view_max_visible(OPT_ARGS_NUM)
7011 {
7012 #if defined(HAVE_POST)
7013 GET_VIEW(0.);
7014 if(!data) return 0.;
7015 int tensorRep = (opt->tensorType == PViewOptions::VonMises) ?
7016 0 :
7017 (opt->tensorType == PViewOptions::MinEigenValue) ? 2 : 1;
7018 return data->getMax(opt->timeStep, true, tensorRep, opt->forceNumComponents,
7019 opt->componentMap);
7020 #else
7021 return 0.;
7022 #endif
7023 }
7024
opt_view_custom_min(OPT_ARGS_NUM)7025 double opt_view_custom_min(OPT_ARGS_NUM)
7026 {
7027 #if defined(HAVE_POST)
7028 GET_VIEWo(0.);
7029 if(action & GMSH_SET) {
7030 opt->customMin = val;
7031 if(view) view->setChanged(true);
7032 }
7033 #if defined(HAVE_FLTK)
7034 if(_gui_action_valid(action, num)) {
7035 FlGui::instance()->options->view.value[31]->value(opt->customMin);
7036 }
7037 #endif
7038 return opt->customMin;
7039 #else
7040 return 0.;
7041 #endif
7042 }
7043
opt_view_custom_max(OPT_ARGS_NUM)7044 double opt_view_custom_max(OPT_ARGS_NUM)
7045 {
7046 #if defined(HAVE_POST)
7047 GET_VIEWo(0.);
7048 if(action & GMSH_SET) {
7049 opt->customMax = val;
7050 if(view) view->setChanged(true);
7051 }
7052 #if defined(HAVE_FLTK)
7053 if(_gui_action_valid(action, num))
7054 FlGui::instance()->options->view.value[32]->value(opt->customMax);
7055 #endif
7056 return opt->customMax;
7057 #else
7058 return 0.;
7059 #endif
7060 }
7061
opt_view_custom_abscissa_min(OPT_ARGS_NUM)7062 double opt_view_custom_abscissa_min(OPT_ARGS_NUM)
7063 {
7064 #if defined(HAVE_POST)
7065 GET_VIEWo(0.);
7066 if(action & GMSH_SET) {
7067 opt->customAbscissaMin = val;
7068 if(view) view->setChanged(true);
7069 }
7070 return opt->customAbscissaMin;
7071 #else
7072 return 0.;
7073 #endif
7074 }
7075
opt_view_custom_abscissa_max(OPT_ARGS_NUM)7076 double opt_view_custom_abscissa_max(OPT_ARGS_NUM)
7077 {
7078 #if defined(HAVE_POST)
7079 GET_VIEWo(0.);
7080 if(action & GMSH_SET) {
7081 opt->customAbscissaMax = val;
7082 if(view) view->setChanged(true);
7083 }
7084 return opt->customAbscissaMax;
7085 #else
7086 return 0.;
7087 #endif
7088 }
7089
opt_view_xmin(OPT_ARGS_NUM)7090 double opt_view_xmin(OPT_ARGS_NUM)
7091 {
7092 #if defined(HAVE_POST)
7093 GET_VIEWd(0.);
7094 if(!data) return 0.;
7095 return data->getBoundingBox().min().x();
7096 #else
7097 return 0.;
7098 #endif
7099 }
7100
opt_view_xmax(OPT_ARGS_NUM)7101 double opt_view_xmax(OPT_ARGS_NUM)
7102 {
7103 #if defined(HAVE_POST)
7104 GET_VIEWd(0.);
7105 if(!data) return 0.;
7106 return data->getBoundingBox().max().x();
7107 #else
7108 return 0.;
7109 #endif
7110 }
7111
opt_view_ymin(OPT_ARGS_NUM)7112 double opt_view_ymin(OPT_ARGS_NUM)
7113 {
7114 #if defined(HAVE_POST)
7115 GET_VIEWd(0.);
7116 if(!data) return 0.;
7117 return data->getBoundingBox().min().y();
7118 #else
7119 return 0.;
7120 #endif
7121 }
7122
opt_view_ymax(OPT_ARGS_NUM)7123 double opt_view_ymax(OPT_ARGS_NUM)
7124 {
7125 #if defined(HAVE_POST)
7126 GET_VIEWd(0.);
7127 if(!data) return 0.;
7128 return data->getBoundingBox().max().y();
7129 #else
7130 return 0.;
7131 #endif
7132 }
7133
opt_view_zmin(OPT_ARGS_NUM)7134 double opt_view_zmin(OPT_ARGS_NUM)
7135 {
7136 #if defined(HAVE_POST)
7137 GET_VIEWd(0.);
7138 if(!data) return 0.;
7139 return data->getBoundingBox().min().z();
7140 #else
7141 return 0.;
7142 #endif
7143 }
7144
opt_view_zmax(OPT_ARGS_NUM)7145 double opt_view_zmax(OPT_ARGS_NUM)
7146 {
7147 #if defined(HAVE_POST)
7148 GET_VIEWd(0.);
7149 if(!data) return 0.;
7150 return data->getBoundingBox().max().z();
7151 #else
7152 return 0.;
7153 #endif
7154 }
7155
opt_view_offset0(OPT_ARGS_NUM)7156 double opt_view_offset0(OPT_ARGS_NUM)
7157 {
7158 #if defined(HAVE_POST)
7159 GET_VIEWo(0.);
7160 if(action & GMSH_SET) {
7161 opt->offset[0] = val;
7162 if(view) view->setChanged(true);
7163 }
7164 #if defined(HAVE_FLTK)
7165 if(_gui_action_valid(action, num))
7166 FlGui::instance()->options->view.value[40]->value(opt->offset[0]);
7167 #endif
7168 return opt->offset[0];
7169 #else
7170 return 0.;
7171 #endif
7172 }
7173
opt_view_offset1(OPT_ARGS_NUM)7174 double opt_view_offset1(OPT_ARGS_NUM)
7175 {
7176 #if defined(HAVE_POST)
7177 GET_VIEWo(0.);
7178 if(action & GMSH_SET) {
7179 opt->offset[1] = val;
7180 if(view) view->setChanged(true);
7181 }
7182 #if defined(HAVE_FLTK)
7183 if(_gui_action_valid(action, num))
7184 FlGui::instance()->options->view.value[41]->value(opt->offset[1]);
7185 #endif
7186 return opt->offset[1];
7187 #else
7188 return 0.;
7189 #endif
7190 }
7191
opt_view_offset2(OPT_ARGS_NUM)7192 double opt_view_offset2(OPT_ARGS_NUM)
7193 {
7194 #if defined(HAVE_POST)
7195 GET_VIEWo(0.);
7196 if(action & GMSH_SET) {
7197 opt->offset[2] = val;
7198 if(view) view->setChanged(true);
7199 }
7200 #if defined(HAVE_FLTK)
7201 if(_gui_action_valid(action, num))
7202 FlGui::instance()->options->view.value[42]->value(opt->offset[2]);
7203 #endif
7204 return opt->offset[2];
7205 #else
7206 return 0.;
7207 #endif
7208 }
7209
opt_view_raise0(OPT_ARGS_NUM)7210 double opt_view_raise0(OPT_ARGS_NUM)
7211 {
7212 #if defined(HAVE_POST)
7213 GET_VIEWo(0.);
7214 if(action & GMSH_SET) {
7215 opt->raise[0] = val;
7216 if(view) view->setChanged(true);
7217 }
7218 #if defined(HAVE_FLTK)
7219 if(_gui_action_valid(action, num))
7220 FlGui::instance()->options->view.value[43]->value(opt->raise[0]);
7221 #endif
7222 return opt->raise[0];
7223 #else
7224 return 0.;
7225 #endif
7226 }
7227
opt_view_raise1(OPT_ARGS_NUM)7228 double opt_view_raise1(OPT_ARGS_NUM)
7229 {
7230 #if defined(HAVE_POST)
7231 GET_VIEWo(0.);
7232 if(action & GMSH_SET) {
7233 opt->raise[1] = val;
7234 if(view) view->setChanged(true);
7235 }
7236 #if defined(HAVE_FLTK)
7237 if(_gui_action_valid(action, num))
7238 FlGui::instance()->options->view.value[44]->value(opt->raise[1]);
7239 #endif
7240 return opt->raise[1];
7241 #else
7242 return 0.;
7243 #endif
7244 }
7245
opt_view_raise2(OPT_ARGS_NUM)7246 double opt_view_raise2(OPT_ARGS_NUM)
7247 {
7248 #if defined(HAVE_POST)
7249 GET_VIEWo(0.);
7250 if(action & GMSH_SET) {
7251 opt->raise[2] = val;
7252 if(view) view->setChanged(true);
7253 }
7254 #if defined(HAVE_FLTK)
7255 if(_gui_action_valid(action, num))
7256 FlGui::instance()->options->view.value[45]->value(opt->raise[2]);
7257 #endif
7258 return opt->raise[2];
7259 #else
7260 return 0.;
7261 #endif
7262 }
7263
opt_view_normal_raise(OPT_ARGS_NUM)7264 double opt_view_normal_raise(OPT_ARGS_NUM)
7265 {
7266 #if defined(HAVE_POST)
7267 GET_VIEWo(0.);
7268 if(action & GMSH_SET) {
7269 opt->normalRaise = val;
7270 if(view) view->setChanged(true);
7271 }
7272 #if defined(HAVE_FLTK)
7273 if(_gui_action_valid(action, num))
7274 FlGui::instance()->options->view.value[46]->value(opt->normalRaise);
7275 #endif
7276 return opt->normalRaise;
7277 #else
7278 return 0.;
7279 #endif
7280 }
7281
opt_view_transform00(OPT_ARGS_NUM)7282 double opt_view_transform00(OPT_ARGS_NUM)
7283 {
7284 #if defined(HAVE_POST)
7285 GET_VIEWo(0.);
7286 if(action & GMSH_SET) {
7287 opt->transform[0][0] = val;
7288 if(view) view->setChanged(true);
7289 }
7290 #if defined(HAVE_FLTK)
7291 if(_gui_action_valid(action, num))
7292 FlGui::instance()->options->view.value[51]->value(opt->transform[0][0]);
7293 #endif
7294 return opt->transform[0][0];
7295 #else
7296 return 0.;
7297 #endif
7298 }
7299
opt_view_transform01(OPT_ARGS_NUM)7300 double opt_view_transform01(OPT_ARGS_NUM)
7301 {
7302 #if defined(HAVE_POST)
7303 GET_VIEWo(0.);
7304 if(action & GMSH_SET) {
7305 opt->transform[0][1] = val;
7306 if(view) view->setChanged(true);
7307 }
7308 #if defined(HAVE_FLTK)
7309 if(_gui_action_valid(action, num))
7310 FlGui::instance()->options->view.value[52]->value(opt->transform[0][1]);
7311 #endif
7312 return opt->transform[0][1];
7313 #else
7314 return 0.;
7315 #endif
7316 }
7317
opt_view_transform02(OPT_ARGS_NUM)7318 double opt_view_transform02(OPT_ARGS_NUM)
7319 {
7320 #if defined(HAVE_POST)
7321 GET_VIEWo(0.);
7322 if(action & GMSH_SET) {
7323 opt->transform[0][2] = val;
7324 if(view) view->setChanged(true);
7325 }
7326 #if defined(HAVE_FLTK)
7327 if(_gui_action_valid(action, num))
7328 FlGui::instance()->options->view.value[53]->value(opt->transform[0][2]);
7329 #endif
7330 return opt->transform[0][2];
7331 #else
7332 return 0.;
7333 #endif
7334 }
7335
opt_view_transform10(OPT_ARGS_NUM)7336 double opt_view_transform10(OPT_ARGS_NUM)
7337 {
7338 #if defined(HAVE_POST)
7339 GET_VIEWo(0.);
7340 if(action & GMSH_SET) {
7341 opt->transform[1][0] = val;
7342 if(view) view->setChanged(true);
7343 }
7344 #if defined(HAVE_FLTK)
7345 if(_gui_action_valid(action, num))
7346 FlGui::instance()->options->view.value[54]->value(opt->transform[1][0]);
7347 #endif
7348 return opt->transform[1][0];
7349 #else
7350 return 0.;
7351 #endif
7352 }
7353
opt_view_transform11(OPT_ARGS_NUM)7354 double opt_view_transform11(OPT_ARGS_NUM)
7355 {
7356 #if defined(HAVE_POST)
7357 GET_VIEWo(0.);
7358 if(action & GMSH_SET) {
7359 opt->transform[1][1] = val;
7360 if(view) view->setChanged(true);
7361 }
7362 #if defined(HAVE_FLTK)
7363 if(_gui_action_valid(action, num))
7364 FlGui::instance()->options->view.value[55]->value(opt->transform[1][1]);
7365 #endif
7366 return opt->transform[1][1];
7367 #else
7368 return 0.;
7369 #endif
7370 }
7371
opt_view_transform12(OPT_ARGS_NUM)7372 double opt_view_transform12(OPT_ARGS_NUM)
7373 {
7374 #if defined(HAVE_POST)
7375 GET_VIEWo(0.);
7376 if(action & GMSH_SET) {
7377 opt->transform[1][2] = val;
7378 if(view) view->setChanged(true);
7379 }
7380 #if defined(HAVE_FLTK)
7381 if(_gui_action_valid(action, num))
7382 FlGui::instance()->options->view.value[56]->value(opt->transform[1][2]);
7383 #endif
7384 return opt->transform[1][2];
7385 #else
7386 return 0.;
7387 #endif
7388 }
7389
opt_view_transform20(OPT_ARGS_NUM)7390 double opt_view_transform20(OPT_ARGS_NUM)
7391 {
7392 #if defined(HAVE_POST)
7393 GET_VIEWo(0.);
7394 if(action & GMSH_SET) {
7395 opt->transform[2][0] = val;
7396 if(view) view->setChanged(true);
7397 }
7398 #if defined(HAVE_FLTK)
7399 if(_gui_action_valid(action, num))
7400 FlGui::instance()->options->view.value[57]->value(opt->transform[2][0]);
7401 #endif
7402 return opt->transform[2][0];
7403 #else
7404 return 0.;
7405 #endif
7406 }
7407
opt_view_transform21(OPT_ARGS_NUM)7408 double opt_view_transform21(OPT_ARGS_NUM)
7409 {
7410 #if defined(HAVE_POST)
7411 GET_VIEWo(0.);
7412 if(action & GMSH_SET) {
7413 opt->transform[2][1] = val;
7414 if(view) view->setChanged(true);
7415 }
7416 #if defined(HAVE_FLTK)
7417 if(_gui_action_valid(action, num))
7418 FlGui::instance()->options->view.value[58]->value(opt->transform[2][1]);
7419 #endif
7420 return opt->transform[2][1];
7421 #else
7422 return 0.;
7423 #endif
7424 }
7425
opt_view_transform22(OPT_ARGS_NUM)7426 double opt_view_transform22(OPT_ARGS_NUM)
7427 {
7428 #if defined(HAVE_POST)
7429 GET_VIEWo(0.);
7430 if(action & GMSH_SET) {
7431 opt->transform[2][2] = val;
7432 if(view) view->setChanged(true);
7433 }
7434 #if defined(HAVE_FLTK)
7435 if(_gui_action_valid(action, num))
7436 FlGui::instance()->options->view.value[59]->value(opt->transform[2][2]);
7437 #endif
7438 return opt->transform[2][2];
7439 #else
7440 return 0.;
7441 #endif
7442 }
7443
opt_view_arrow_size_min(OPT_ARGS_NUM)7444 double opt_view_arrow_size_min(OPT_ARGS_NUM)
7445 {
7446 #if defined(HAVE_POST)
7447 GET_VIEWo(0.);
7448 if(action & GMSH_SET) { opt->arrowSizeMin = val; }
7449 #if defined(HAVE_FLTK)
7450 if(_gui_action_valid(action, num))
7451 FlGui::instance()->options->view.value[64]->value(opt->arrowSizeMin);
7452 #endif
7453 return opt->arrowSizeMin;
7454 #else
7455 return 0.;
7456 #endif
7457 }
7458
opt_view_arrow_size_max(OPT_ARGS_NUM)7459 double opt_view_arrow_size_max(OPT_ARGS_NUM)
7460 {
7461 #if defined(HAVE_POST)
7462 GET_VIEWo(0.);
7463 if(action & GMSH_SET) { opt->arrowSizeMax = val; }
7464 #if defined(HAVE_FLTK)
7465 if(_gui_action_valid(action, num))
7466 FlGui::instance()->options->view.value[60]->value(opt->arrowSizeMax);
7467 #endif
7468 return opt->arrowSizeMax;
7469 #else
7470 return 0.;
7471 #endif
7472 }
7473
opt_view_normals(OPT_ARGS_NUM)7474 double opt_view_normals(OPT_ARGS_NUM)
7475 {
7476 #if defined(HAVE_POST)
7477 GET_VIEWo(0.);
7478 if(action & GMSH_SET) { opt->normals = val; }
7479 #if defined(HAVE_FLTK)
7480 if(_gui_action_valid(action, num))
7481 FlGui::instance()->options->view.value[0]->value(opt->normals);
7482 #endif
7483 return opt->normals;
7484 #else
7485 return 0.;
7486 #endif
7487 }
7488
opt_view_tangents(OPT_ARGS_NUM)7489 double opt_view_tangents(OPT_ARGS_NUM)
7490 {
7491 #if defined(HAVE_POST)
7492 GET_VIEWo(0.);
7493 if(action & GMSH_SET) { opt->tangents = val; }
7494 #if defined(HAVE_FLTK)
7495 if(_gui_action_valid(action, num))
7496 FlGui::instance()->options->view.value[1]->value(opt->tangents);
7497 #endif
7498 return opt->tangents;
7499 #else
7500 return 0.;
7501 #endif
7502 }
7503
opt_view_displacement_factor(OPT_ARGS_NUM)7504 double opt_view_displacement_factor(OPT_ARGS_NUM)
7505 {
7506 #if defined(HAVE_POST)
7507 GET_VIEWo(0.);
7508 if(action & GMSH_SET) {
7509 opt->displacementFactor = val;
7510 if(view) view->setChanged(true);
7511 }
7512 #if defined(HAVE_FLTK)
7513 if(_gui_action_valid(action, num))
7514 FlGui::instance()->options->view.value[63]->value(opt->displacementFactor);
7515 #endif
7516 return opt->displacementFactor;
7517 #else
7518 return 0.;
7519 #endif
7520 }
7521
opt_view_fake_transparency(OPT_ARGS_NUM)7522 double opt_view_fake_transparency(OPT_ARGS_NUM)
7523 {
7524 #if defined(HAVE_POST)
7525 GET_VIEWo(0.);
7526 if(action & GMSH_SET) {
7527 opt->fakeTransparency = (int)val;
7528 if(view) view->setChanged(true);
7529 }
7530 #if defined(HAVE_FLTK)
7531 if(_gui_action_valid(action, num))
7532 FlGui::instance()->options->view.butt[24]->value(opt->fakeTransparency);
7533 #endif
7534 return opt->fakeTransparency;
7535 #else
7536 return 0.;
7537 #endif
7538 }
7539
opt_view_explode(OPT_ARGS_NUM)7540 double opt_view_explode(OPT_ARGS_NUM)
7541 {
7542 #if defined(HAVE_POST)
7543 GET_VIEWo(0.);
7544 if(action & GMSH_SET) {
7545 opt->explode = val;
7546 if(view) view->setChanged(true);
7547 }
7548 #if defined(HAVE_FLTK)
7549 if(_gui_action_valid(action, num))
7550 FlGui::instance()->options->view.value[12]->value(opt->explode);
7551 #endif
7552 return opt->explode;
7553 #else
7554 return 0.;
7555 #endif
7556 }
7557
opt_view_visible(OPT_ARGS_NUM)7558 double opt_view_visible(OPT_ARGS_NUM)
7559 {
7560 #if defined(HAVE_POST)
7561 GET_VIEWo(0.);
7562 if(action & GMSH_SET) { opt->visible = (int)val; }
7563 #if defined(HAVE_FLTK)
7564 if(FlGui::available() && (action & GMSH_GUI) && num >= 0 &&
7565 FlGui::instance()->onelab->getViewButton(num))
7566 FlGui::instance()->onelab->getViewButton(num)->value(opt->visible);
7567 #endif
7568 return opt->visible;
7569 #else
7570 return 0.;
7571 #endif
7572 }
7573
opt_view_intervals_type(OPT_ARGS_NUM)7574 double opt_view_intervals_type(OPT_ARGS_NUM)
7575 {
7576 #if defined(HAVE_POST)
7577 GET_VIEWo(0.);
7578 if(action & GMSH_SET) {
7579 opt->intervalsType = (int)val;
7580 if(opt->intervalsType < 1 || opt->intervalsType > 4) opt->intervalsType = 1;
7581 if(view) view->setChanged(true);
7582 }
7583 #if defined(HAVE_FLTK)
7584 if(_gui_action_valid(action, num)) {
7585 FlGui::instance()->options->view.choice[0]->value(opt->intervalsType - 1);
7586 }
7587 #endif
7588 return opt->intervalsType;
7589 #else
7590 return 0.;
7591 #endif
7592 }
7593
opt_view_saturate_values(OPT_ARGS_NUM)7594 double opt_view_saturate_values(OPT_ARGS_NUM)
7595 {
7596 #if defined(HAVE_POST)
7597 GET_VIEWo(0.);
7598 if(action & GMSH_SET) {
7599 opt->saturateValues = (int)val;
7600 if(view) view->setChanged(true);
7601 }
7602 #if defined(HAVE_FLTK)
7603 if(_gui_action_valid(action, num)) {
7604 FlGui::instance()->options->view.butt[38]->value(opt->saturateValues);
7605 }
7606 #endif
7607 return opt->saturateValues;
7608 #else
7609 return 0.;
7610 #endif
7611 }
7612
opt_view_adapt_visualization_grid(OPT_ARGS_NUM)7613 double opt_view_adapt_visualization_grid(OPT_ARGS_NUM)
7614 {
7615 #if defined(HAVE_POST)
7616 GET_VIEW(0.);
7617 if(action & GMSH_SET) {
7618 opt->adaptVisualizationGrid = (int)val;
7619 if(data) {
7620 if(opt->adaptVisualizationGrid)
7621 data->initAdaptiveData(opt->timeStep, opt->maxRecursionLevel,
7622 opt->targetError);
7623 else
7624 data->destroyAdaptiveData();
7625 view->setChanged(true);
7626 }
7627 }
7628 #if defined(HAVE_FLTK)
7629 if(_gui_action_valid(action, num)) {
7630 FlGui::instance()->options->view.butt[0]->value(
7631 opt->adaptVisualizationGrid);
7632 FlGui::instance()->options->activate("view_adaptive");
7633 }
7634 #endif
7635 return opt->adaptVisualizationGrid;
7636 #else
7637 return 0.;
7638 #endif
7639 }
7640
opt_view_max_recursion_level(OPT_ARGS_NUM)7641 double opt_view_max_recursion_level(OPT_ARGS_NUM)
7642 {
7643 #if defined(HAVE_POST)
7644 GET_VIEW(0.);
7645 if(action & GMSH_SET) {
7646 opt->maxRecursionLevel = (int)val;
7647 if(data && data->getAdaptiveData()) {
7648 data->getAdaptiveData()->changeResolution(
7649 opt->timeStep, opt->maxRecursionLevel, opt->targetError);
7650 view->setChanged(true);
7651 }
7652 }
7653 #if defined(HAVE_FLTK)
7654 if(_gui_action_valid(action, num)) {
7655 FlGui::instance()->options->view.value[33]->value(opt->maxRecursionLevel);
7656 }
7657 #endif
7658 return opt->maxRecursionLevel;
7659 #else
7660 return 0.;
7661 #endif
7662 }
7663
opt_view_target_error(OPT_ARGS_NUM)7664 double opt_view_target_error(OPT_ARGS_NUM)
7665 {
7666 #if defined(HAVE_POST)
7667 GET_VIEW(0.);
7668 if(action & GMSH_SET) {
7669 opt->targetError = val;
7670 if(data && data->getAdaptiveData()) {
7671 data->getAdaptiveData()->changeResolution(
7672 opt->timeStep, opt->maxRecursionLevel, opt->targetError);
7673 view->setChanged(true);
7674 }
7675 }
7676 #if defined(HAVE_FLTK)
7677 if(_gui_action_valid(action, num)) {
7678 FlGui::instance()->options->view.value[34]->value(opt->targetError);
7679 }
7680 #endif
7681 return opt->targetError;
7682 #else
7683 return 0.;
7684 #endif
7685 }
7686
opt_view_type(OPT_ARGS_NUM)7687 double opt_view_type(OPT_ARGS_NUM)
7688 {
7689 #if defined(HAVE_POST)
7690 GET_VIEWo(0.);
7691 if(action & GMSH_SET) {
7692 opt->type = (int)val;
7693 if(opt->type < 1 || opt->type > 4) opt->type = 1;
7694 if(view) view->setChanged(true);
7695 }
7696 #if defined(HAVE_FLTK)
7697 if(_gui_action_valid(action, num)) {
7698 FlGui::instance()->options->view.choice[13]->value(opt->type - 1);
7699 }
7700 #endif
7701 return opt->type;
7702 #else
7703 return 0.;
7704 #endif
7705 }
7706
opt_view_auto_position(OPT_ARGS_NUM)7707 double opt_view_auto_position(OPT_ARGS_NUM)
7708 {
7709 #if defined(HAVE_POST)
7710 GET_VIEWo(0.);
7711 if(action & GMSH_SET) {
7712 opt->autoPosition = (int)val;
7713 if(opt->autoPosition < 0 || opt->autoPosition > 12) opt->autoPosition = 0;
7714 }
7715 #if defined(HAVE_FLTK)
7716 if(_gui_action_valid(action, num)) {
7717 FlGui::instance()->options->view.choice[16]->value(opt->autoPosition);
7718 FlGui::instance()->options->activate("view_axes_auto_2d");
7719 }
7720 #endif
7721 return opt->autoPosition;
7722 #else
7723 return 0.;
7724 #endif
7725 }
7726
opt_view_position0(OPT_ARGS_NUM)7727 double opt_view_position0(OPT_ARGS_NUM)
7728 {
7729 #if defined(HAVE_POST)
7730 GET_VIEWo(0.);
7731 if(action & GMSH_SET) { opt->position[0] = val; }
7732 #if defined(HAVE_FLTK)
7733 if(_gui_action_valid(action, num))
7734 FlGui::instance()->options->view.value[20]->value(opt->position[0]);
7735 #endif
7736 return opt->position[0];
7737 #else
7738 return 0.;
7739 #endif
7740 }
7741
opt_view_position1(OPT_ARGS_NUM)7742 double opt_view_position1(OPT_ARGS_NUM)
7743 {
7744 #if defined(HAVE_POST)
7745 GET_VIEWo(0.);
7746 if(action & GMSH_SET) { opt->position[1] = val; }
7747 #if defined(HAVE_FLTK)
7748 if(_gui_action_valid(action, num))
7749 FlGui::instance()->options->view.value[21]->value(opt->position[1]);
7750 #endif
7751 return opt->position[1];
7752 #else
7753 return 0.;
7754 #endif
7755 }
7756
opt_view_sampling(OPT_ARGS_NUM)7757 double opt_view_sampling(OPT_ARGS_NUM)
7758 {
7759 #if defined(HAVE_POST)
7760 GET_VIEWo(0.);
7761 if(action & GMSH_SET) {
7762 opt->sampling = (int)val;
7763 if(view) view->setChanged(true);
7764 }
7765 #if defined(HAVE_FLTK)
7766 if(_gui_action_valid(action, num))
7767 FlGui::instance()->options->view.value[6]->value(opt->sampling);
7768 #endif
7769 return opt->sampling;
7770 #else
7771 return 1.;
7772 #endif
7773 }
7774
opt_view_size0(OPT_ARGS_NUM)7775 double opt_view_size0(OPT_ARGS_NUM)
7776 {
7777 #if defined(HAVE_POST)
7778 GET_VIEWo(0.);
7779 if(action & GMSH_SET) { opt->size[0] = val; }
7780 #if defined(HAVE_FLTK)
7781 if(_gui_action_valid(action, num))
7782 FlGui::instance()->options->view.value[22]->value(opt->size[0]);
7783 #endif
7784 return opt->size[0];
7785 #else
7786 return 0.;
7787 #endif
7788 }
7789
opt_view_size1(OPT_ARGS_NUM)7790 double opt_view_size1(OPT_ARGS_NUM)
7791 {
7792 #if defined(HAVE_POST)
7793 GET_VIEWo(0.);
7794 if(action & GMSH_SET) { opt->size[1] = val; }
7795 #if defined(HAVE_FLTK)
7796 if(_gui_action_valid(action, num))
7797 FlGui::instance()->options->view.value[23]->value(opt->size[1]);
7798 #endif
7799 return opt->size[1];
7800 #else
7801 return 0.;
7802 #endif
7803 }
7804
opt_view_axes(OPT_ARGS_NUM)7805 double opt_view_axes(OPT_ARGS_NUM)
7806 {
7807 #if defined(HAVE_POST)
7808 GET_VIEWo(0.);
7809 if(action & GMSH_SET) {
7810 opt->axes = (int)val;
7811 if(opt->axes < 0 || opt->axes > 5) opt->axes = 0;
7812 }
7813 #if defined(HAVE_FLTK)
7814 if(_gui_action_valid(action, num)) {
7815 FlGui::instance()->options->view.choice[8]->value(opt->axes);
7816 FlGui::instance()->options->activate("view_axes");
7817 }
7818 #endif
7819 return opt->axes;
7820 #else
7821 return 0.;
7822 #endif
7823 }
7824
opt_view_axes_mikado(OPT_ARGS_NUM)7825 double opt_view_axes_mikado(OPT_ARGS_NUM)
7826 {
7827 #if defined(HAVE_POST)
7828 GET_VIEWo(0.);
7829 if(action & GMSH_SET) { opt->axesMikado = (int)val; }
7830 #if defined(HAVE_FLTK)
7831 if(_gui_action_valid(action, num)) {
7832 FlGui::instance()->options->view.butt[3]->value(opt->axesMikado);
7833 }
7834 #endif
7835 return opt->axesMikado;
7836 #else
7837 return 0.;
7838 #endif
7839 }
7840
opt_view_axes_auto_position(OPT_ARGS_NUM)7841 double opt_view_axes_auto_position(OPT_ARGS_NUM)
7842 {
7843 #if defined(HAVE_POST)
7844 GET_VIEWo(0.);
7845 if(action & GMSH_SET) { opt->axesAutoPosition = (int)val; }
7846 #if defined(HAVE_FLTK)
7847 if(_gui_action_valid(action, num)) {
7848 FlGui::instance()->options->view.butt[25]->value(opt->axesAutoPosition);
7849 FlGui::instance()->options->activate("view_axes_auto_3d");
7850 }
7851 #endif
7852 return opt->axesAutoPosition;
7853 #else
7854 return 0.;
7855 #endif
7856 }
7857
opt_view_axes_xmin(OPT_ARGS_NUM)7858 double opt_view_axes_xmin(OPT_ARGS_NUM)
7859 {
7860 #if defined(HAVE_POST)
7861 GET_VIEWo(0.);
7862 if(action & GMSH_SET) { opt->axesPosition[0] = val; }
7863 #if defined(HAVE_FLTK)
7864 if(_gui_action_valid(action, num)) {
7865 FlGui::instance()->options->view.value[13]->value(opt->axesPosition[0]);
7866 }
7867 #endif
7868 return opt->axesPosition[0];
7869 #else
7870 return 0.;
7871 #endif
7872 }
7873
opt_view_axes_xmax(OPT_ARGS_NUM)7874 double opt_view_axes_xmax(OPT_ARGS_NUM)
7875 {
7876 #if defined(HAVE_POST)
7877 GET_VIEWo(0.);
7878 if(action & GMSH_SET) { opt->axesPosition[1] = val; }
7879 #if defined(HAVE_FLTK)
7880 if(_gui_action_valid(action, num)) {
7881 FlGui::instance()->options->view.value[16]->value(opt->axesPosition[1]);
7882 }
7883 #endif
7884 return opt->axesPosition[1];
7885 #else
7886 return 0.;
7887 #endif
7888 }
7889
opt_view_axes_ymin(OPT_ARGS_NUM)7890 double opt_view_axes_ymin(OPT_ARGS_NUM)
7891 {
7892 #if defined(HAVE_POST)
7893 GET_VIEWo(0.);
7894 if(action & GMSH_SET) { opt->axesPosition[2] = val; }
7895 #if defined(HAVE_FLTK)
7896 if(_gui_action_valid(action, num)) {
7897 FlGui::instance()->options->view.value[14]->value(opt->axesPosition[2]);
7898 }
7899 #endif
7900 return opt->axesPosition[2];
7901 #else
7902 return 0.;
7903 #endif
7904 }
7905
opt_view_axes_ymax(OPT_ARGS_NUM)7906 double opt_view_axes_ymax(OPT_ARGS_NUM)
7907 {
7908 #if defined(HAVE_POST)
7909 GET_VIEWo(0.);
7910 if(action & GMSH_SET) { opt->axesPosition[3] = val; }
7911 #if defined(HAVE_FLTK)
7912 if(_gui_action_valid(action, num)) {
7913 FlGui::instance()->options->view.value[17]->value(opt->axesPosition[3]);
7914 }
7915 #endif
7916 return opt->axesPosition[3];
7917 #else
7918 return 0.;
7919 #endif
7920 }
7921
opt_view_axes_zmin(OPT_ARGS_NUM)7922 double opt_view_axes_zmin(OPT_ARGS_NUM)
7923 {
7924 #if defined(HAVE_POST)
7925 GET_VIEWo(0.);
7926 if(action & GMSH_SET) { opt->axesPosition[4] = val; }
7927 #if defined(HAVE_FLTK)
7928 if(_gui_action_valid(action, num)) {
7929 FlGui::instance()->options->view.value[15]->value(opt->axesPosition[4]);
7930 }
7931 #endif
7932 return opt->axesPosition[4];
7933 #else
7934 return 0.;
7935 #endif
7936 }
7937
opt_view_axes_zmax(OPT_ARGS_NUM)7938 double opt_view_axes_zmax(OPT_ARGS_NUM)
7939 {
7940 #if defined(HAVE_POST)
7941 GET_VIEWo(0.);
7942 if(action & GMSH_SET) { opt->axesPosition[5] = val; }
7943 #if defined(HAVE_FLTK)
7944 if(_gui_action_valid(action, num)) {
7945 FlGui::instance()->options->view.value[18]->value(opt->axesPosition[5]);
7946 }
7947 #endif
7948 return opt->axesPosition[5];
7949 #else
7950 return 0.;
7951 #endif
7952 }
7953
opt_view_axes_tics0(OPT_ARGS_NUM)7954 double opt_view_axes_tics0(OPT_ARGS_NUM)
7955 {
7956 #if defined(HAVE_POST)
7957 GET_VIEWo(0.);
7958 if(action & GMSH_SET) { opt->axesTics[0] = val; }
7959 #if defined(HAVE_FLTK)
7960 if(_gui_action_valid(action, num)) {
7961 FlGui::instance()->options->view.value[3]->value(opt->axesTics[0]);
7962 }
7963 #endif
7964 return opt->axesTics[0];
7965 #else
7966 return 0.;
7967 #endif
7968 }
7969
opt_view_axes_tics1(OPT_ARGS_NUM)7970 double opt_view_axes_tics1(OPT_ARGS_NUM)
7971 {
7972 #if defined(HAVE_POST)
7973 GET_VIEWo(0.);
7974 if(action & GMSH_SET) { opt->axesTics[1] = val; }
7975 #if defined(HAVE_FLTK)
7976 if(_gui_action_valid(action, num)) {
7977 FlGui::instance()->options->view.value[4]->value(opt->axesTics[1]);
7978 }
7979 #endif
7980 return opt->axesTics[1];
7981 #else
7982 return 0.;
7983 #endif
7984 }
7985
opt_view_axes_tics2(OPT_ARGS_NUM)7986 double opt_view_axes_tics2(OPT_ARGS_NUM)
7987 {
7988 #if defined(HAVE_POST)
7989 GET_VIEWo(0.);
7990 if(action & GMSH_SET) { opt->axesTics[2] = val; }
7991 #if defined(HAVE_FLTK)
7992 if(_gui_action_valid(action, num)) {
7993 FlGui::instance()->options->view.value[5]->value(opt->axesTics[2]);
7994 }
7995 #endif
7996 return opt->axesTics[2];
7997 #else
7998 return 0.;
7999 #endif
8000 }
8001
opt_view_nb_iso(OPT_ARGS_NUM)8002 double opt_view_nb_iso(OPT_ARGS_NUM)
8003 {
8004 #if defined(HAVE_POST)
8005 GET_VIEWo(0.);
8006 if(action & GMSH_SET) {
8007 opt->nbIso = (int)val;
8008 if(view) view->setChanged(true);
8009 }
8010 #if defined(HAVE_FLTK)
8011 if(_gui_action_valid(action, num))
8012 FlGui::instance()->options->view.value[30]->value(opt->nbIso);
8013 #endif
8014 return opt->nbIso;
8015 #else
8016 return 0.;
8017 #endif
8018 }
8019
opt_view_boundary(OPT_ARGS_NUM)8020 double opt_view_boundary(OPT_ARGS_NUM)
8021 {
8022 #if defined(HAVE_POST)
8023 GET_VIEWo(0.);
8024 if(action & GMSH_SET) {
8025 opt->boundary = (int)val;
8026 if(opt->boundary < 0 || opt->boundary > 3) opt->boundary = 0;
8027 if(view) view->setChanged(true);
8028 }
8029 #if defined(HAVE_FLTK)
8030 if(_gui_action_valid(action, num)) {
8031 FlGui::instance()->options->view.choice[9]->value(opt->boundary);
8032 }
8033 #endif
8034 return opt->boundary;
8035 #else
8036 return 0.;
8037 #endif
8038 }
8039
opt_view_light(OPT_ARGS_NUM)8040 double opt_view_light(OPT_ARGS_NUM)
8041 {
8042 #if defined(HAVE_POST)
8043 GET_VIEWo(0.);
8044 if(action & GMSH_SET) {
8045 opt->light = (int)val;
8046 if(view) view->setChanged(true);
8047 }
8048 #if defined(HAVE_FLTK)
8049 if(_gui_action_valid(action, num)) {
8050 FlGui::instance()->options->view.butt[11]->value(opt->light);
8051 FlGui::instance()->options->activate("view_light");
8052 }
8053 #endif
8054 return opt->light;
8055 #else
8056 return 0.;
8057 #endif
8058 }
8059
opt_view_light_two_side(OPT_ARGS_NUM)8060 double opt_view_light_two_side(OPT_ARGS_NUM)
8061 {
8062 #if defined(HAVE_POST)
8063 GET_VIEWo(0.);
8064 if(action & GMSH_SET) { opt->lightTwoSide = (int)val; }
8065 #if defined(HAVE_FLTK)
8066 if(_gui_action_valid(action, num))
8067 FlGui::instance()->options->view.butt[9]->value(opt->lightTwoSide);
8068 #endif
8069 return opt->lightTwoSide;
8070 #else
8071 return 0.;
8072 #endif
8073 }
8074
opt_view_light_lines(OPT_ARGS_NUM)8075 double opt_view_light_lines(OPT_ARGS_NUM)
8076 {
8077 #if defined(HAVE_POST)
8078 GET_VIEWo(0.);
8079 if(action & GMSH_SET) { opt->lightLines = (int)val; }
8080 #if defined(HAVE_FLTK)
8081 if(_gui_action_valid(action, num))
8082 FlGui::instance()->options->view.butt[8]->value(opt->lightLines);
8083 #endif
8084 return opt->lightLines;
8085 #else
8086 return 0.;
8087 #endif
8088 }
8089
opt_view_smooth_normals(OPT_ARGS_NUM)8090 double opt_view_smooth_normals(OPT_ARGS_NUM)
8091 {
8092 #if defined(HAVE_POST)
8093 GET_VIEWo(0.);
8094 if(action & GMSH_SET) {
8095 opt->smoothNormals = (int)val;
8096 if(view) view->setChanged(true);
8097 }
8098 #if defined(HAVE_FLTK)
8099 if(_gui_action_valid(action, num))
8100 FlGui::instance()->options->view.butt[12]->value(opt->smoothNormals);
8101 #endif
8102 return opt->smoothNormals;
8103 #else
8104 return 0.;
8105 #endif
8106 }
8107
opt_view_angle_smooth_normals(OPT_ARGS_NUM)8108 double opt_view_angle_smooth_normals(OPT_ARGS_NUM)
8109 {
8110 #if defined(HAVE_POST)
8111 GET_VIEWo(0.);
8112 if(action & GMSH_SET) {
8113 opt->angleSmoothNormals = val;
8114 if(view) view->setChanged(true);
8115 }
8116 #if defined(HAVE_FLTK)
8117 if(_gui_action_valid(action, num))
8118 FlGui::instance()->options->view.value[10]->value(opt->angleSmoothNormals);
8119 #endif
8120 return opt->angleSmoothNormals;
8121 #else
8122 return 0.;
8123 #endif
8124 }
8125
opt_view_show_element(OPT_ARGS_NUM)8126 double opt_view_show_element(OPT_ARGS_NUM)
8127 {
8128 #if defined(HAVE_POST)
8129 GET_VIEWo(0.);
8130 if(action & GMSH_SET) {
8131 opt->showElement = (int)val;
8132 if(view) view->setChanged(true);
8133 }
8134 #if defined(HAVE_FLTK)
8135 if(_gui_action_valid(action, num))
8136 FlGui::instance()->options->view.butt[10]->value(opt->showElement);
8137 #endif
8138 return opt->showElement;
8139 #else
8140 return 0.;
8141 #endif
8142 }
8143
opt_view_show_time(OPT_ARGS_NUM)8144 double opt_view_show_time(OPT_ARGS_NUM)
8145 {
8146 #if defined(HAVE_POST)
8147 GET_VIEWo(0.);
8148 if(action & GMSH_SET) {
8149 opt->showTime = (int)val;
8150 if(opt->showTime < 0 || opt->showTime > 7) opt->showTime = 0;
8151 }
8152 #if defined(HAVE_FLTK)
8153 if(_gui_action_valid(action, num))
8154 FlGui::instance()->options->view.choice[12]->value(opt->showTime);
8155 #endif
8156 return opt->showTime;
8157 #else
8158 return 0.;
8159 #endif
8160 }
8161
opt_view_show_scale(OPT_ARGS_NUM)8162 double opt_view_show_scale(OPT_ARGS_NUM)
8163 {
8164 #if defined(HAVE_POST)
8165 GET_VIEWo(0.);
8166 if(action & GMSH_SET) { opt->showScale = (int)val; }
8167 #if defined(HAVE_FLTK)
8168 if(_gui_action_valid(action, num))
8169 FlGui::instance()->options->view.butt[4]->value(opt->showScale);
8170 #endif
8171 return opt->showScale;
8172 #else
8173 return 0.;
8174 #endif
8175 }
8176
opt_view_draw_strings(OPT_ARGS_NUM)8177 double opt_view_draw_strings(OPT_ARGS_NUM)
8178 {
8179 #if defined(HAVE_POST)
8180 GET_VIEWo(0.);
8181 if(action & GMSH_SET) { opt->drawStrings = (int)val; }
8182 #if defined(HAVE_FLTK)
8183 if(_gui_action_valid(action, num))
8184 FlGui::instance()->options->view.butt[5]->value(opt->drawStrings);
8185 #endif
8186 return opt->drawStrings;
8187 #else
8188 return 0.;
8189 #endif
8190 }
8191
opt_view_draw_points(OPT_ARGS_NUM)8192 double opt_view_draw_points(OPT_ARGS_NUM)
8193 {
8194 #if defined(HAVE_POST)
8195 GET_VIEWo(0.);
8196 if(action & GMSH_SET) {
8197 opt->drawPoints = (int)val;
8198 if(view) view->setChanged(true);
8199 }
8200 #if defined(HAVE_FLTK)
8201 if(_gui_action_valid(action, num)) {
8202 if(opt->drawPoints)
8203 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[1]->menu())[0]
8204 .set();
8205 else
8206 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[1]->menu())[0]
8207 .clear();
8208 }
8209 #endif
8210 return opt->drawPoints;
8211 #else
8212 return 0.;
8213 #endif
8214 }
8215
opt_view_draw_lines(OPT_ARGS_NUM)8216 double opt_view_draw_lines(OPT_ARGS_NUM)
8217 {
8218 #if defined(HAVE_POST)
8219 GET_VIEWo(0.);
8220 if(action & GMSH_SET) {
8221 opt->drawLines = (int)val;
8222 if(view) view->setChanged(true);
8223 }
8224 #if defined(HAVE_FLTK)
8225 if(_gui_action_valid(action, num)) {
8226 if(opt->drawLines)
8227 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[1]->menu())[1]
8228 .set();
8229 else
8230 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[1]->menu())[1]
8231 .clear();
8232 }
8233 #endif
8234 return opt->drawLines;
8235 #else
8236 return 0.;
8237 #endif
8238 }
8239
opt_view_draw_triangles(OPT_ARGS_NUM)8240 double opt_view_draw_triangles(OPT_ARGS_NUM)
8241 {
8242 #if defined(HAVE_POST)
8243 GET_VIEWo(0.);
8244 if(action & GMSH_SET) {
8245 opt->drawTriangles = (int)val;
8246 if(view) view->setChanged(true);
8247 }
8248 #if defined(HAVE_FLTK)
8249 if(_gui_action_valid(action, num)) {
8250 if(opt->drawTriangles)
8251 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[1]->menu())[2]
8252 .set();
8253 else
8254 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[1]->menu())[2]
8255 .clear();
8256 }
8257 #endif
8258 return opt->drawTriangles;
8259 #else
8260 return 0.;
8261 #endif
8262 }
8263
opt_view_draw_quadrangles(OPT_ARGS_NUM)8264 double opt_view_draw_quadrangles(OPT_ARGS_NUM)
8265 {
8266 #if defined(HAVE_POST)
8267 GET_VIEWo(0.);
8268 if(action & GMSH_SET) {
8269 opt->drawQuadrangles = (int)val;
8270 if(view) view->setChanged(true);
8271 }
8272 #if defined(HAVE_FLTK)
8273 if(_gui_action_valid(action, num)) {
8274 if(opt->drawQuadrangles)
8275 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[1]->menu())[3]
8276 .set();
8277 else
8278 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[1]->menu())[3]
8279 .clear();
8280 }
8281 #endif
8282 return opt->drawQuadrangles;
8283 #else
8284 return 0.;
8285 #endif
8286 }
8287
opt_view_draw_tetrahedra(OPT_ARGS_NUM)8288 double opt_view_draw_tetrahedra(OPT_ARGS_NUM)
8289 {
8290 #if defined(HAVE_POST)
8291 GET_VIEWo(0.);
8292 if(action & GMSH_SET) {
8293 opt->drawTetrahedra = (int)val;
8294 if(view) view->setChanged(true);
8295 }
8296 #if defined(HAVE_FLTK)
8297 if(_gui_action_valid(action, num)) {
8298 if(opt->drawTetrahedra)
8299 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[1]->menu())[4]
8300 .set();
8301 else
8302 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[1]->menu())[4]
8303 .clear();
8304 }
8305 #endif
8306 return opt->drawTetrahedra;
8307 #else
8308 return 0.;
8309 #endif
8310 }
8311
opt_view_draw_hexahedra(OPT_ARGS_NUM)8312 double opt_view_draw_hexahedra(OPT_ARGS_NUM)
8313 {
8314 #if defined(HAVE_POST)
8315 GET_VIEWo(0.);
8316 if(action & GMSH_SET) {
8317 opt->drawHexahedra = (int)val;
8318 if(view) view->setChanged(true);
8319 }
8320 #if defined(HAVE_FLTK)
8321 if(_gui_action_valid(action, num)) {
8322 if(opt->drawHexahedra)
8323 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[1]->menu())[5]
8324 .set();
8325 else
8326 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[1]->menu())[5]
8327 .clear();
8328 }
8329 #endif
8330 return opt->drawHexahedra;
8331 #else
8332 return 0.;
8333 #endif
8334 }
8335
opt_view_draw_prisms(OPT_ARGS_NUM)8336 double opt_view_draw_prisms(OPT_ARGS_NUM)
8337 {
8338 #if defined(HAVE_POST)
8339 GET_VIEWo(0.);
8340 if(action & GMSH_SET) {
8341 opt->drawPrisms = (int)val;
8342 if(view) view->setChanged(true);
8343 }
8344 #if defined(HAVE_FLTK)
8345 if(_gui_action_valid(action, num)) {
8346 if(opt->drawPrisms)
8347 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[1]->menu())[6]
8348 .set();
8349 else
8350 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[1]->menu())[6]
8351 .clear();
8352 }
8353 #endif
8354 return opt->drawPrisms;
8355 #else
8356 return 0.;
8357 #endif
8358 }
8359
opt_view_draw_pyramids(OPT_ARGS_NUM)8360 double opt_view_draw_pyramids(OPT_ARGS_NUM)
8361 {
8362 #if defined(HAVE_POST)
8363 GET_VIEWo(0.);
8364 if(action & GMSH_SET) {
8365 opt->drawPyramids = (int)val;
8366 if(view) view->setChanged(true);
8367 }
8368 #if defined(HAVE_FLTK)
8369 if(_gui_action_valid(action, num)) {
8370 if(opt->drawPyramids)
8371 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[1]->menu())[7]
8372 .set();
8373 else
8374 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[1]->menu())[7]
8375 .clear();
8376 }
8377 #endif
8378 return opt->drawPyramids;
8379 #else
8380 return 0.;
8381 #endif
8382 }
8383
opt_view_draw_trihedra(OPT_ARGS_NUM)8384 double opt_view_draw_trihedra(OPT_ARGS_NUM)
8385 {
8386 #if defined(HAVE_POST)
8387 GET_VIEWo(0.);
8388 if(action & GMSH_SET) {
8389 opt->drawTrihedra = (int)val;
8390 if(view) view->setChanged(true);
8391 }
8392 #if defined(HAVE_FLTK)
8393 if(_gui_action_valid(action, num)) {
8394 if(opt->drawTrihedra)
8395 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[1]->menu())[8]
8396 .set();
8397 else
8398 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[1]->menu())[8]
8399 .clear();
8400 }
8401 #endif
8402 return opt->drawTrihedra;
8403 #else
8404 return 0.;
8405 #endif
8406 }
8407
opt_view_draw_scalars(OPT_ARGS_NUM)8408 double opt_view_draw_scalars(OPT_ARGS_NUM)
8409 {
8410 #if defined(HAVE_POST)
8411 GET_VIEWo(0.);
8412 if(action & GMSH_SET) {
8413 opt->drawScalars = (int)val;
8414 if(view) view->setChanged(true);
8415 }
8416 #if defined(HAVE_FLTK)
8417 if(_gui_action_valid(action, num)) {
8418 if(opt->drawScalars)
8419 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[0]->menu())[0]
8420 .set();
8421 else
8422 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[0]->menu())[0]
8423 .clear();
8424 }
8425 #endif
8426 return opt->drawScalars;
8427 #else
8428 return 0.;
8429 #endif
8430 }
8431
opt_view_draw_vectors(OPT_ARGS_NUM)8432 double opt_view_draw_vectors(OPT_ARGS_NUM)
8433 {
8434 #if defined(HAVE_POST)
8435 GET_VIEWo(0.);
8436 if(action & GMSH_SET) {
8437 opt->drawVectors = (int)val;
8438 if(view) view->setChanged(true);
8439 }
8440 #if defined(HAVE_FLTK)
8441 if(_gui_action_valid(action, num)) {
8442 if(opt->drawVectors)
8443 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[0]->menu())[1]
8444 .set();
8445 else
8446 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[0]->menu())[1]
8447 .clear();
8448 }
8449 #endif
8450 return opt->drawVectors;
8451 #else
8452 return 0.;
8453 #endif
8454 }
8455
opt_view_draw_tensors(OPT_ARGS_NUM)8456 double opt_view_draw_tensors(OPT_ARGS_NUM)
8457 {
8458 #if defined(HAVE_POST)
8459 GET_VIEWo(0.);
8460 if(action & GMSH_SET) {
8461 opt->drawTensors = (int)val;
8462 if(view) view->setChanged(true);
8463 }
8464 #if defined(HAVE_FLTK)
8465 if(_gui_action_valid(action, num)) {
8466 if(opt->drawTensors)
8467 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[0]->menu())[2]
8468 .set();
8469 else
8470 ((Fl_Menu_Item *)FlGui::instance()->options->view.menu[0]->menu())[2]
8471 .clear();
8472 }
8473 #endif
8474 return opt->drawTensors;
8475 #else
8476 return 0.;
8477 #endif
8478 }
8479
opt_view_draw_skin_only(OPT_ARGS_NUM)8480 double opt_view_draw_skin_only(OPT_ARGS_NUM)
8481 {
8482 #if defined(HAVE_POST)
8483 GET_VIEWo(0.);
8484 if(action & GMSH_SET) {
8485 opt->drawSkinOnly = (int)val;
8486 if(view) view->setChanged(true);
8487 }
8488 #if defined(HAVE_FLTK)
8489 if(_gui_action_valid(action, num))
8490 FlGui::instance()->options->view.butt[2]->value(opt->drawSkinOnly);
8491 #endif
8492 return opt->drawSkinOnly;
8493 #else
8494 return 0.;
8495 #endif
8496 }
8497
opt_view_scale_type(OPT_ARGS_NUM)8498 double opt_view_scale_type(OPT_ARGS_NUM)
8499 {
8500 #if defined(HAVE_POST)
8501 GET_VIEWo(0.);
8502 if(action & GMSH_SET) {
8503 opt->scaleType = (int)val;
8504 if(opt->scaleType < 1 || opt->scaleType > 3) opt->scaleType = 1;
8505 if(view) view->setChanged(true);
8506 }
8507 #if defined(HAVE_FLTK)
8508 if(_gui_action_valid(action, num)) {
8509 FlGui::instance()->options->view.choice[1]->value(opt->scaleType - 1);
8510 }
8511 #endif
8512 return opt->scaleType;
8513 #else
8514 return 0.;
8515 #endif
8516 }
8517
opt_view_range_type(OPT_ARGS_NUM)8518 double opt_view_range_type(OPT_ARGS_NUM)
8519 {
8520 #if defined(HAVE_POST)
8521 GET_VIEWo(0.);
8522 if(action & GMSH_SET) {
8523 opt->rangeType = (int)val;
8524 if(opt->rangeType < 1 || opt->rangeType > 3) opt->rangeType = 1;
8525 if(view) view->setChanged(true);
8526 }
8527 #if defined(HAVE_FLTK)
8528 if(_gui_action_valid(action, num)) {
8529 FlGui::instance()->options->view.choice[7]->value(opt->rangeType - 1);
8530 FlGui::instance()->options->activate("custom_range");
8531 }
8532 #endif
8533 return opt->rangeType;
8534 #else
8535 return 0.;
8536 #endif
8537 }
8538
opt_view_abscissa_range_type(OPT_ARGS_NUM)8539 double opt_view_abscissa_range_type(OPT_ARGS_NUM)
8540 {
8541 #if defined(HAVE_POST)
8542 GET_VIEWo(0.);
8543 if(action & GMSH_SET) {
8544 opt->abscissaRangeType = (int)val;
8545 if(opt->abscissaRangeType < 1 || opt->abscissaRangeType > 3)
8546 opt->abscissaRangeType = 1;
8547 if(view) view->setChanged(true);
8548 }
8549 return opt->abscissaRangeType;
8550 #else
8551 return 0.;
8552 #endif
8553 }
8554
opt_view_tensor_type(OPT_ARGS_NUM)8555 double opt_view_tensor_type(OPT_ARGS_NUM)
8556 {
8557 #if defined(HAVE_POST)
8558 GET_VIEWo(0.);
8559 if(action & GMSH_SET) {
8560 opt->tensorType = (int)val;
8561 if(opt->tensorType > 7 || opt->tensorType < 1) opt->tensorType = 1;
8562 if(view) view->setChanged(true);
8563 }
8564 #if defined(HAVE_FLTK)
8565 if(_gui_action_valid(action, num)) {
8566 FlGui::instance()->options->view.choice[4]->value(opt->tensorType - 1);
8567 }
8568 #endif
8569 return opt->tensorType;
8570 #else
8571 return 0.;
8572 #endif
8573 }
8574
opt_view_vector_type(OPT_ARGS_NUM)8575 double opt_view_vector_type(OPT_ARGS_NUM)
8576 {
8577 #if defined(HAVE_POST)
8578 GET_VIEWo(0.);
8579 if(action & GMSH_SET) {
8580 opt->vectorType = (int)val;
8581 if(opt->vectorType < 1 || opt->vectorType > 6) opt->vectorType = 1;
8582 if(view) view->setChanged(true);
8583 }
8584 #if defined(HAVE_FLTK)
8585 if(_gui_action_valid(action, num)) {
8586 FlGui::instance()->options->view.choice[2]->value(opt->vectorType - 1);
8587 }
8588 #endif
8589 return opt->vectorType;
8590 #else
8591 return 0.;
8592 #endif
8593 }
8594
opt_view_glyph_location(OPT_ARGS_NUM)8595 double opt_view_glyph_location(OPT_ARGS_NUM)
8596 {
8597 #if defined(HAVE_POST)
8598 GET_VIEWo(0.);
8599 if(action & GMSH_SET) {
8600 opt->glyphLocation = (int)val;
8601 if(opt->glyphLocation < 1 || opt->glyphLocation > 2) opt->glyphLocation = 1;
8602 if(view) view->setChanged(true);
8603 }
8604 #if defined(HAVE_FLTK)
8605 if(_gui_action_valid(action, num)) {
8606 FlGui::instance()->options->view.choice[3]->value(opt->glyphLocation - 1);
8607 }
8608 #endif
8609 return opt->glyphLocation;
8610 #else
8611 return 0.;
8612 #endif
8613 }
8614
opt_view_center_glyphs(OPT_ARGS_NUM)8615 double opt_view_center_glyphs(OPT_ARGS_NUM)
8616 {
8617 #if defined(HAVE_POST)
8618 GET_VIEWo(0.);
8619 if(action & GMSH_SET) {
8620 opt->centerGlyphs = (int)val;
8621 if(opt->centerGlyphs < 0 || opt->centerGlyphs > 2) opt->glyphLocation = 0;
8622 if(view) view->setChanged(true);
8623 }
8624 #if defined(HAVE_FLTK)
8625 if(_gui_action_valid(action, num)) {
8626 FlGui::instance()->options->view.choice[15]->value(opt->centerGlyphs);
8627 }
8628 #endif
8629 return opt->centerGlyphs;
8630 #else
8631 return 0.;
8632 #endif
8633 }
8634
opt_view_point_size(OPT_ARGS_NUM)8635 double opt_view_point_size(OPT_ARGS_NUM)
8636 {
8637 #if defined(HAVE_POST)
8638 GET_VIEWo(0.);
8639 if(action & GMSH_SET) { opt->pointSize = val; }
8640 #if defined(HAVE_FLTK)
8641 if(_gui_action_valid(action, num))
8642 FlGui::instance()->options->view.value[61]->value(opt->pointSize);
8643 #endif
8644 return opt->pointSize;
8645 #else
8646 return 0.;
8647 #endif
8648 }
8649
opt_view_line_width(OPT_ARGS_NUM)8650 double opt_view_line_width(OPT_ARGS_NUM)
8651 {
8652 #if defined(HAVE_POST)
8653 GET_VIEWo(0.);
8654 if(action & GMSH_SET) { opt->lineWidth = val; }
8655 #if defined(HAVE_FLTK)
8656 if(_gui_action_valid(action, num))
8657 FlGui::instance()->options->view.value[62]->value(opt->lineWidth);
8658 #endif
8659 return opt->lineWidth;
8660 #else
8661 return 0.;
8662 #endif
8663 }
8664
opt_view_point_type(OPT_ARGS_NUM)8665 double opt_view_point_type(OPT_ARGS_NUM)
8666 {
8667 #if defined(HAVE_POST)
8668 GET_VIEWo(0.);
8669 if(action & GMSH_SET) {
8670 opt->pointType = (int)val;
8671 if(opt->pointType < 0 || opt->pointType > 3) opt->pointType = 0;
8672 if(view) view->setChanged(true);
8673 }
8674 #if defined(HAVE_FLTK)
8675 if(_gui_action_valid(action, num)) {
8676 FlGui::instance()->options->view.choice[5]->value(opt->pointType);
8677 }
8678 #endif
8679 return opt->pointType;
8680 #else
8681 return 0.;
8682 #endif
8683 }
8684
opt_view_line_type(OPT_ARGS_NUM)8685 double opt_view_line_type(OPT_ARGS_NUM)
8686 {
8687 #if defined(HAVE_POST)
8688 GET_VIEWo(0.);
8689 if(action & GMSH_SET) {
8690 opt->lineType = (int)val;
8691 if(opt->lineType < 0 || opt->lineType > 2) opt->lineType = 0;
8692 if(view) view->setChanged(true);
8693 }
8694 #if defined(HAVE_FLTK)
8695 if(_gui_action_valid(action, num)) {
8696 FlGui::instance()->options->view.choice[6]->value(opt->lineType);
8697 }
8698 #endif
8699 return opt->lineType;
8700 #else
8701 return 0.;
8702 #endif
8703 }
8704
opt_view_colormap_alpha(OPT_ARGS_NUM)8705 double opt_view_colormap_alpha(OPT_ARGS_NUM)
8706 {
8707 #if defined(HAVE_POST)
8708 GET_VIEWo(0.);
8709 if(action & GMSH_SET) {
8710 opt->colorTable.dpar[COLORTABLE_ALPHA] = val;
8711 ColorTable_Recompute(&opt->colorTable);
8712 if(view) view->setChanged(true);
8713 }
8714 #if defined(HAVE_FLTK)
8715 if(_gui_action_valid(action, num)) {
8716 FlGui::instance()->options->view.colorbar->redraw();
8717 }
8718 #endif
8719 return opt->colorTable.dpar[COLORTABLE_ALPHA];
8720 #else
8721 return 0.;
8722 #endif
8723 }
8724
opt_view_colormap_alpha_power(OPT_ARGS_NUM)8725 double opt_view_colormap_alpha_power(OPT_ARGS_NUM)
8726 {
8727 #if defined(HAVE_POST)
8728 GET_VIEWo(0.);
8729 if(action & GMSH_SET) {
8730 opt->colorTable.dpar[COLORTABLE_ALPHAPOW] = val;
8731 ColorTable_Recompute(&opt->colorTable);
8732 if(view) view->setChanged(true);
8733 }
8734 #if defined(HAVE_FLTK)
8735 if(_gui_action_valid(action, num)) {
8736 FlGui::instance()->options->view.colorbar->redraw();
8737 }
8738 #endif
8739 return opt->colorTable.dpar[COLORTABLE_ALPHAPOW];
8740 #else
8741 return 0.;
8742 #endif
8743 }
8744
opt_view_colormap_beta(OPT_ARGS_NUM)8745 double opt_view_colormap_beta(OPT_ARGS_NUM)
8746 {
8747 #if defined(HAVE_POST)
8748 GET_VIEWo(0.);
8749 if(action & GMSH_SET) {
8750 opt->colorTable.dpar[COLORTABLE_BETA] = val;
8751 ColorTable_Recompute(&opt->colorTable);
8752 if(view) view->setChanged(true);
8753 }
8754 #if defined(HAVE_FLTK)
8755 if(_gui_action_valid(action, num)) {
8756 FlGui::instance()->options->view.colorbar->redraw();
8757 }
8758 #endif
8759 return opt->colorTable.dpar[COLORTABLE_BETA];
8760 #else
8761 return 0.;
8762 #endif
8763 }
8764
opt_view_colormap_bias(OPT_ARGS_NUM)8765 double opt_view_colormap_bias(OPT_ARGS_NUM)
8766 {
8767 #if defined(HAVE_POST)
8768 GET_VIEWo(0.);
8769 if(action & GMSH_SET) {
8770 opt->colorTable.dpar[COLORTABLE_BIAS] = val;
8771 ColorTable_Recompute(&opt->colorTable);
8772 if(view) view->setChanged(true);
8773 }
8774 #if defined(HAVE_FLTK)
8775 if(_gui_action_valid(action, num)) {
8776 FlGui::instance()->options->view.colorbar->redraw();
8777 }
8778 #endif
8779 return opt->colorTable.dpar[COLORTABLE_BIAS];
8780 #else
8781 return 0.;
8782 #endif
8783 }
8784
opt_view_colormap_curvature(OPT_ARGS_NUM)8785 double opt_view_colormap_curvature(OPT_ARGS_NUM)
8786 {
8787 #if defined(HAVE_POST)
8788 GET_VIEWo(0.);
8789 if(action & GMSH_SET) {
8790 opt->colorTable.dpar[COLORTABLE_CURVATURE] = val;
8791 ColorTable_Recompute(&opt->colorTable);
8792 if(view) view->setChanged(true);
8793 }
8794 #if defined(HAVE_FLTK)
8795 if(_gui_action_valid(action, num)) {
8796 FlGui::instance()->options->view.colorbar->redraw();
8797 }
8798 #endif
8799 return opt->colorTable.dpar[COLORTABLE_CURVATURE];
8800 #else
8801 return 0.;
8802 #endif
8803 }
8804
opt_view_colormap_invert(OPT_ARGS_NUM)8805 double opt_view_colormap_invert(OPT_ARGS_NUM)
8806 {
8807 #if defined(HAVE_POST)
8808 GET_VIEWo(0.);
8809 if(action & GMSH_SET) {
8810 opt->colorTable.ipar[COLORTABLE_INVERT] = (int)val;
8811 ColorTable_Recompute(&opt->colorTable);
8812 if(view) view->setChanged(true);
8813 }
8814 #if defined(HAVE_FLTK)
8815 if(_gui_action_valid(action, num)) {
8816 FlGui::instance()->options->view.colorbar->redraw();
8817 }
8818 #endif
8819 return opt->colorTable.ipar[COLORTABLE_INVERT];
8820 #else
8821 return 0.;
8822 #endif
8823 }
8824
opt_view_colormap_number(OPT_ARGS_NUM)8825 double opt_view_colormap_number(OPT_ARGS_NUM)
8826 {
8827 #if defined(HAVE_POST)
8828 GET_VIEWo(0.);
8829 if(action & GMSH_SET) {
8830 int n = (int)val;
8831 if(n < 0) n = 24;
8832 if(n > 24) n = 0;
8833 opt->colorTable.ipar[COLORTABLE_NUMBER] = n;
8834 ColorTable_Recompute(&opt->colorTable);
8835 if(view) view->setChanged(true);
8836 }
8837 #if defined(HAVE_FLTK)
8838 if(_gui_action_valid(action, num)) {
8839 FlGui::instance()->options->view.colorbar->redraw();
8840 }
8841 #endif
8842 return opt->colorTable.ipar[COLORTABLE_NUMBER];
8843 #else
8844 return 0.;
8845 #endif
8846 }
8847
opt_view_colormap_rotation(OPT_ARGS_NUM)8848 double opt_view_colormap_rotation(OPT_ARGS_NUM)
8849 {
8850 #if defined(HAVE_POST)
8851 GET_VIEWo(0.);
8852 if(action & GMSH_SET) {
8853 opt->colorTable.ipar[COLORTABLE_ROTATION] = (int)val;
8854 ColorTable_Recompute(&opt->colorTable);
8855 if(view) view->setChanged(true);
8856 }
8857 #if defined(HAVE_FLTK)
8858 if(_gui_action_valid(action, num)) {
8859 FlGui::instance()->options->view.colorbar->redraw();
8860 }
8861 #endif
8862 return opt->colorTable.ipar[COLORTABLE_ROTATION];
8863 #else
8864 return 0.;
8865 #endif
8866 }
8867
opt_view_colormap_swap(OPT_ARGS_NUM)8868 double opt_view_colormap_swap(OPT_ARGS_NUM)
8869 {
8870 #if defined(HAVE_POST)
8871 GET_VIEWo(0.);
8872 if(action & GMSH_SET) {
8873 opt->colorTable.ipar[COLORTABLE_SWAP] = (int)val;
8874 ColorTable_Recompute(&opt->colorTable);
8875 if(view) view->setChanged(true);
8876 }
8877 #if defined(HAVE_FLTK)
8878 if(_gui_action_valid(action, num)) {
8879 FlGui::instance()->options->view.colorbar->redraw();
8880 }
8881 #endif
8882 return opt->colorTable.ipar[COLORTABLE_SWAP];
8883 #else
8884 return 0.;
8885 #endif
8886 }
8887
opt_view_external_view(OPT_ARGS_NUM)8888 double opt_view_external_view(OPT_ARGS_NUM)
8889 {
8890 #if defined(HAVE_POST)
8891 GET_VIEWo(0.);
8892 if(action & GMSH_SET) {
8893 opt->externalViewIndex = (int)val;
8894 if(view) view->setChanged(true);
8895 }
8896 #if defined(HAVE_FLTK)
8897 if(_gui_action_valid(action, num)) {
8898 // warning: Fl_Choice::size() returns number of items+1
8899 int item = opt->externalViewIndex + 1;
8900 if(item > -1 &&
8901 item < FlGui::instance()->options->view.choice[10]->size() - 1)
8902 FlGui::instance()->options->view.choice[10]->value(item);
8903 else
8904 FlGui::instance()->options->view.choice[10]->value(0);
8905 }
8906 #endif
8907 return opt->externalViewIndex;
8908 #else
8909 return 0.;
8910 #endif
8911 }
8912
opt_view_gen_raise_view(OPT_ARGS_NUM)8913 double opt_view_gen_raise_view(OPT_ARGS_NUM)
8914 {
8915 #if defined(HAVE_POST)
8916 GET_VIEWo(0.);
8917 if(action & GMSH_SET) {
8918 opt->viewIndexForGenRaise = (int)val;
8919 if(view) view->setChanged(true);
8920 }
8921 #if defined(HAVE_FLTK)
8922 if(_gui_action_valid(action, num)) {
8923 // warning: Fl_Choice::size() returns number of items+1
8924 int item = opt->viewIndexForGenRaise + 1;
8925 if(item > -1 &&
8926 item < FlGui::instance()->options->view.choice[11]->size() - 1)
8927 FlGui::instance()->options->view.choice[11]->value(item);
8928 else
8929 FlGui::instance()->options->view.choice[11]->value(0);
8930 }
8931 #endif
8932 return opt->viewIndexForGenRaise;
8933 #else
8934 return 0.;
8935 #endif
8936 }
8937
opt_view_gen_raise_factor(OPT_ARGS_NUM)8938 double opt_view_gen_raise_factor(OPT_ARGS_NUM)
8939 {
8940 #if defined(HAVE_POST)
8941 GET_VIEWo(0.);
8942 if(action & GMSH_SET) {
8943 opt->genRaiseFactor = val;
8944 if(view) view->setChanged(true);
8945 }
8946 #if defined(HAVE_FLTK)
8947 if(_gui_action_valid(action, num))
8948 FlGui::instance()->options->view.value[2]->value(opt->genRaiseFactor);
8949 #endif
8950 return opt->genRaiseFactor;
8951 #else
8952 return 0.;
8953 #endif
8954 }
8955
opt_view_use_gen_raise(OPT_ARGS_NUM)8956 double opt_view_use_gen_raise(OPT_ARGS_NUM)
8957 {
8958 #if defined(HAVE_POST)
8959 GET_VIEWo(0.);
8960 if(action & GMSH_SET) {
8961 opt->useGenRaise = (int)val;
8962 if(view) view->setChanged(true);
8963 }
8964 #if defined(HAVE_FLTK)
8965 if(_gui_action_valid(action, num)) {
8966 FlGui::instance()->options->view.butt[6]->value(opt->useGenRaise);
8967 FlGui::instance()->options->activate("view_general_transform");
8968 }
8969 #endif
8970 return opt->useGenRaise;
8971 #else
8972 return 0.;
8973 #endif
8974 }
8975
opt_view_use_stipple(OPT_ARGS_NUM)8976 double opt_view_use_stipple(OPT_ARGS_NUM)
8977 {
8978 #if defined(HAVE_POST)
8979 GET_VIEWo(0.);
8980 if(action & GMSH_SET) { opt->useStipple = (int)val; }
8981 #if defined(HAVE_FLTK)
8982 if(_gui_action_valid(action, num)) {
8983 FlGui::instance()->options->view.butt[26]->value(opt->useStipple);
8984 }
8985 #endif
8986 return opt->useStipple;
8987 #else
8988 return 0.;
8989 #endif
8990 }
8991
opt_view_clip(OPT_ARGS_NUM)8992 double opt_view_clip(OPT_ARGS_NUM)
8993 {
8994 #if defined(HAVE_POST)
8995 GET_VIEWo(0.);
8996 if(action & GMSH_SET) { opt->clip = (int)val; }
8997 #if defined(HAVE_FLTK)
8998 if(_gui_action_valid(action, num)) {
8999 FlGui::instance()->clipping->resetBrowser();
9000 }
9001 #endif
9002 return opt->clip;
9003 #else
9004 return 0.;
9005 #endif
9006 }
9007
opt_view_force_num_components(OPT_ARGS_NUM)9008 double opt_view_force_num_components(OPT_ARGS_NUM)
9009 {
9010 #if defined(HAVE_POST)
9011 GET_VIEWo(0.);
9012 if(action & GMSH_SET) {
9013 opt->forceNumComponents = (int)val;
9014 if(view) view->setChanged(true);
9015 }
9016 #if defined(HAVE_FLTK)
9017 if(_gui_action_valid(action, num)) {
9018 if(opt->forceNumComponents == 1)
9019 FlGui::instance()->options->view.choice[14]->value(1);
9020 else if(opt->forceNumComponents == 3)
9021 FlGui::instance()->options->view.choice[14]->value(2);
9022 else if(opt->forceNumComponents == 9)
9023 FlGui::instance()->options->view.choice[14]->value(3);
9024 else
9025 FlGui::instance()->options->view.choice[14]->value(0);
9026 }
9027 #endif
9028 return opt->forceNumComponents;
9029 #else
9030 return 0.;
9031 #endif
9032 }
9033
ovcm(OPT_ARGS_NUM,int nn)9034 static double ovcm(OPT_ARGS_NUM, int nn)
9035 {
9036 #if defined(HAVE_POST)
9037 GET_VIEWo(0.);
9038 if(action & GMSH_SET) {
9039 opt->componentMap[nn] = (int)val;
9040 if(view) view->setChanged(true);
9041 }
9042 #if defined(HAVE_FLTK)
9043 if(_gui_action_valid(action, num)) {
9044 FlGui::instance()->options->view.value[70 + nn]->value(
9045 opt->componentMap[nn]);
9046 }
9047 #endif
9048 return opt->componentMap[nn];
9049 #else
9050 return 0.;
9051 #endif
9052 }
9053
opt_view_component_map0(OPT_ARGS_NUM)9054 double opt_view_component_map0(OPT_ARGS_NUM)
9055 {
9056 return ovcm(num, action, val, 0);
9057 }
opt_view_component_map1(OPT_ARGS_NUM)9058 double opt_view_component_map1(OPT_ARGS_NUM)
9059 {
9060 return ovcm(num, action, val, 1);
9061 }
opt_view_component_map2(OPT_ARGS_NUM)9062 double opt_view_component_map2(OPT_ARGS_NUM)
9063 {
9064 return ovcm(num, action, val, 2);
9065 }
opt_view_component_map3(OPT_ARGS_NUM)9066 double opt_view_component_map3(OPT_ARGS_NUM)
9067 {
9068 return ovcm(num, action, val, 3);
9069 }
opt_view_component_map4(OPT_ARGS_NUM)9070 double opt_view_component_map4(OPT_ARGS_NUM)
9071 {
9072 return ovcm(num, action, val, 4);
9073 }
opt_view_component_map5(OPT_ARGS_NUM)9074 double opt_view_component_map5(OPT_ARGS_NUM)
9075 {
9076 return ovcm(num, action, val, 5);
9077 }
opt_view_component_map6(OPT_ARGS_NUM)9078 double opt_view_component_map6(OPT_ARGS_NUM)
9079 {
9080 return ovcm(num, action, val, 6);
9081 }
opt_view_component_map7(OPT_ARGS_NUM)9082 double opt_view_component_map7(OPT_ARGS_NUM)
9083 {
9084 return ovcm(num, action, val, 7);
9085 }
opt_view_component_map8(OPT_ARGS_NUM)9086 double opt_view_component_map8(OPT_ARGS_NUM)
9087 {
9088 return ovcm(num, action, val, 8);
9089 }
9090
opt_view_closed(OPT_ARGS_NUM)9091 double opt_view_closed(OPT_ARGS_NUM)
9092 {
9093 #if defined(HAVE_POST)
9094 GET_VIEWo(0.);
9095 if(action & GMSH_SET) { opt->closed = (int)val; }
9096 #if defined(HAVE_FLTK)
9097 if(FlGui::available() && (action & GMSH_GUI) && num >= 0) {
9098 FlGui::instance()->onelab->openCloseViewButton(num);
9099 }
9100 #endif
9101 return opt->closed;
9102 #else
9103 return 0.;
9104 #endif
9105 }
9106
opt_print_file_format(OPT_ARGS_NUM)9107 double opt_print_file_format(OPT_ARGS_NUM)
9108 {
9109 if(action & GMSH_SET) CTX::instance()->print.fileFormat = (int)val;
9110 return CTX::instance()->print.fileFormat;
9111 }
9112
opt_print_eps_compress(OPT_ARGS_NUM)9113 double opt_print_eps_compress(OPT_ARGS_NUM)
9114 {
9115 if(action & GMSH_SET) CTX::instance()->print.epsCompress = (int)val;
9116 return CTX::instance()->print.epsCompress;
9117 }
9118
opt_print_eps_ps3shading(OPT_ARGS_NUM)9119 double opt_print_eps_ps3shading(OPT_ARGS_NUM)
9120 {
9121 if(action & GMSH_SET) CTX::instance()->print.epsPS3Shading = (int)val;
9122 return CTX::instance()->print.epsPS3Shading;
9123 }
9124
opt_print_eps_quality(OPT_ARGS_NUM)9125 double opt_print_eps_quality(OPT_ARGS_NUM)
9126 {
9127 if(action & GMSH_SET) CTX::instance()->print.epsQuality = (int)val;
9128 return CTX::instance()->print.epsQuality;
9129 }
9130
opt_print_eps_occlusion_culling(OPT_ARGS_NUM)9131 double opt_print_eps_occlusion_culling(OPT_ARGS_NUM)
9132 {
9133 if(action & GMSH_SET) CTX::instance()->print.epsOcclusionCulling = (int)val;
9134 return CTX::instance()->print.epsOcclusionCulling;
9135 }
9136
opt_print_eps_best_root(OPT_ARGS_NUM)9137 double opt_print_eps_best_root(OPT_ARGS_NUM)
9138 {
9139 if(action & GMSH_SET) CTX::instance()->print.epsBestRoot = (int)val;
9140 return CTX::instance()->print.epsBestRoot;
9141 }
9142
opt_print_eps_line_width_factor(OPT_ARGS_NUM)9143 double opt_print_eps_line_width_factor(OPT_ARGS_NUM)
9144 {
9145 if(action & GMSH_SET) CTX::instance()->print.epsLineWidthFactor = val;
9146 return CTX::instance()->print.epsLineWidthFactor;
9147 }
9148
opt_print_eps_point_size_factor(OPT_ARGS_NUM)9149 double opt_print_eps_point_size_factor(OPT_ARGS_NUM)
9150 {
9151 if(action & GMSH_SET) CTX::instance()->print.epsPointSizeFactor = val;
9152 return CTX::instance()->print.epsPointSizeFactor;
9153 }
9154
opt_print_jpeg_quality(OPT_ARGS_NUM)9155 double opt_print_jpeg_quality(OPT_ARGS_NUM)
9156 {
9157 if(action & GMSH_SET) CTX::instance()->print.jpegQuality = (int)val;
9158 return CTX::instance()->print.jpegQuality;
9159 }
9160
opt_print_jpeg_smoothing(OPT_ARGS_NUM)9161 double opt_print_jpeg_smoothing(OPT_ARGS_NUM)
9162 {
9163 if(action & GMSH_SET) CTX::instance()->print.jpegSmoothing = (int)val;
9164 return CTX::instance()->print.jpegSmoothing;
9165 }
9166
opt_print_geo_labels(OPT_ARGS_NUM)9167 double opt_print_geo_labels(OPT_ARGS_NUM)
9168 {
9169 if(action & GMSH_SET) CTX::instance()->print.geoLabels = (int)val;
9170 return CTX::instance()->print.geoLabels;
9171 }
9172
opt_print_geo_only_physicals(OPT_ARGS_NUM)9173 double opt_print_geo_only_physicals(OPT_ARGS_NUM)
9174 {
9175 if(action & GMSH_SET) CTX::instance()->print.geoOnlyPhysicals = (int)val;
9176 return CTX::instance()->print.geoOnlyPhysicals;
9177 }
9178
opt_print_pos_elementary(OPT_ARGS_NUM)9179 double opt_print_pos_elementary(OPT_ARGS_NUM)
9180 {
9181 if(action & GMSH_SET) CTX::instance()->print.posElementary = (int)val;
9182 return CTX::instance()->print.posElementary;
9183 }
9184
opt_print_pos_element(OPT_ARGS_NUM)9185 double opt_print_pos_element(OPT_ARGS_NUM)
9186 {
9187 if(action & GMSH_SET) CTX::instance()->print.posElement = (int)val;
9188 return CTX::instance()->print.posElement;
9189 }
9190
opt_print_pos_gamma(OPT_ARGS_NUM)9191 double opt_print_pos_gamma(OPT_ARGS_NUM)
9192 {
9193 if(action & GMSH_SET) CTX::instance()->print.posGamma = (int)val;
9194 return CTX::instance()->print.posGamma;
9195 }
9196
opt_print_pos_eta(OPT_ARGS_NUM)9197 double opt_print_pos_eta(OPT_ARGS_NUM)
9198 {
9199 if(action & GMSH_SET) CTX::instance()->print.posEta = (int)val;
9200 return CTX::instance()->print.posEta;
9201 }
9202
opt_print_pos_SICN(OPT_ARGS_NUM)9203 double opt_print_pos_SICN(OPT_ARGS_NUM)
9204 {
9205 if(action & GMSH_SET) CTX::instance()->print.posSICN = (int)val;
9206 return CTX::instance()->print.posSICN;
9207 }
9208
opt_print_pos_SIGE(OPT_ARGS_NUM)9209 double opt_print_pos_SIGE(OPT_ARGS_NUM)
9210 {
9211 if(action & GMSH_SET) CTX::instance()->print.posSIGE = (int)val;
9212 return CTX::instance()->print.posSIGE;
9213 }
9214
opt_print_pos_disto(OPT_ARGS_NUM)9215 double opt_print_pos_disto(OPT_ARGS_NUM)
9216 {
9217 if(action & GMSH_SET) CTX::instance()->print.posDisto = (int)val;
9218 return CTX::instance()->print.posDisto;
9219 }
9220
opt_print_gif_dither(OPT_ARGS_NUM)9221 double opt_print_gif_dither(OPT_ARGS_NUM)
9222 {
9223 if(action & GMSH_SET) CTX::instance()->print.gifDither = (int)val;
9224 return CTX::instance()->print.gifDither;
9225 }
9226
opt_print_gif_sort(OPT_ARGS_NUM)9227 double opt_print_gif_sort(OPT_ARGS_NUM)
9228 {
9229 if(action & GMSH_SET) CTX::instance()->print.gifSort = (int)val;
9230 return CTX::instance()->print.gifSort;
9231 }
9232
opt_print_gif_interlace(OPT_ARGS_NUM)9233 double opt_print_gif_interlace(OPT_ARGS_NUM)
9234 {
9235 if(action & GMSH_SET) CTX::instance()->print.gifInterlace = (int)val;
9236 return CTX::instance()->print.gifInterlace;
9237 }
9238
opt_print_gif_transparent(OPT_ARGS_NUM)9239 double opt_print_gif_transparent(OPT_ARGS_NUM)
9240 {
9241 if(action & GMSH_SET) CTX::instance()->print.gifTransparent = (int)val;
9242 return CTX::instance()->print.gifTransparent;
9243 }
9244
opt_print_background(OPT_ARGS_NUM)9245 double opt_print_background(OPT_ARGS_NUM)
9246 {
9247 if(action & GMSH_SET) CTX::instance()->print.background = (int)val;
9248 return CTX::instance()->print.background;
9249 }
9250
opt_print_pgf_two_dim(OPT_ARGS_NUM)9251 double opt_print_pgf_two_dim(OPT_ARGS_NUM)
9252 {
9253 if(action & GMSH_SET) CTX::instance()->print.pgfTwoDim = (int)val;
9254 return CTX::instance()->print.pgfTwoDim;
9255 }
opt_print_pgf_export_axis(OPT_ARGS_NUM)9256 double opt_print_pgf_export_axis(OPT_ARGS_NUM)
9257 {
9258 if(action & GMSH_SET) CTX::instance()->print.pgfExportAxis = (int)val;
9259 return CTX::instance()->print.pgfExportAxis;
9260 }
opt_print_pgf_horiz_bar(OPT_ARGS_NUM)9261 double opt_print_pgf_horiz_bar(OPT_ARGS_NUM)
9262 {
9263 if(action & GMSH_SET) CTX::instance()->print.pgfHorizBar = (int)val;
9264 return CTX::instance()->print.pgfHorizBar;
9265 }
9266
opt_print_text(OPT_ARGS_NUM)9267 double opt_print_text(OPT_ARGS_NUM)
9268 {
9269 if(action & GMSH_SET) CTX::instance()->print.text = (int)val;
9270 return CTX::instance()->print.text;
9271 }
9272
opt_print_tex_as_equation(OPT_ARGS_NUM)9273 double opt_print_tex_as_equation(OPT_ARGS_NUM)
9274 {
9275 if(action & GMSH_SET) CTX::instance()->print.texAsEquation = (int)val;
9276 return CTX::instance()->print.texAsEquation;
9277 }
9278
opt_print_tex_force_fontsize(OPT_ARGS_NUM)9279 double opt_print_tex_force_fontsize(OPT_ARGS_NUM)
9280 {
9281 if(action & GMSH_SET) CTX::instance()->print.texForceFontSize = (int)val;
9282 return CTX::instance()->print.texForceFontSize;
9283 }
9284
opt_print_tex_width_in_mm(OPT_ARGS_NUM)9285 double opt_print_tex_width_in_mm(OPT_ARGS_NUM)
9286 {
9287 if(action & GMSH_SET) CTX::instance()->print.texWidthInMm = val;
9288 return CTX::instance()->print.texWidthInMm;
9289 }
9290
opt_print_composite_windows(OPT_ARGS_NUM)9291 double opt_print_composite_windows(OPT_ARGS_NUM)
9292 {
9293 if(action & GMSH_SET) CTX::instance()->print.compositeWindows = (int)val;
9294 return CTX::instance()->print.compositeWindows;
9295 }
9296
opt_print_delete_tmp_files(OPT_ARGS_NUM)9297 double opt_print_delete_tmp_files(OPT_ARGS_NUM)
9298 {
9299 if(action & GMSH_SET) CTX::instance()->print.deleteTmpFiles = (int)val;
9300 return CTX::instance()->print.deleteTmpFiles;
9301 }
9302
opt_print_height(OPT_ARGS_NUM)9303 double opt_print_height(OPT_ARGS_NUM)
9304 {
9305 if(action & GMSH_SET) CTX::instance()->print.height = (int)val;
9306 return CTX::instance()->print.height;
9307 }
9308
opt_print_width(OPT_ARGS_NUM)9309 double opt_print_width(OPT_ARGS_NUM)
9310 {
9311 if(action & GMSH_SET) CTX::instance()->print.width = (int)val;
9312 return CTX::instance()->print.width;
9313 }
9314
opt_print_parameter(OPT_ARGS_NUM)9315 double opt_print_parameter(OPT_ARGS_NUM)
9316 {
9317 if(action & GMSH_SET) CTX::instance()->print.parameter = val;
9318 return CTX::instance()->print.parameter;
9319 }
9320
opt_print_parameter_first(OPT_ARGS_NUM)9321 double opt_print_parameter_first(OPT_ARGS_NUM)
9322 {
9323 if(action & GMSH_SET) CTX::instance()->print.parameterFirst = val;
9324 return CTX::instance()->print.parameterFirst;
9325 }
9326
opt_print_parameter_last(OPT_ARGS_NUM)9327 double opt_print_parameter_last(OPT_ARGS_NUM)
9328 {
9329 if(action & GMSH_SET) CTX::instance()->print.parameterLast = val;
9330 return CTX::instance()->print.parameterLast;
9331 }
9332
opt_print_parameter_steps(OPT_ARGS_NUM)9333 double opt_print_parameter_steps(OPT_ARGS_NUM)
9334 {
9335 if(action & GMSH_SET) CTX::instance()->print.parameterSteps = val;
9336 return CTX::instance()->print.parameterSteps;
9337 }
9338
opt_print_x3d_compatibility(OPT_ARGS_NUM)9339 double opt_print_x3d_compatibility(OPT_ARGS_NUM)
9340 {
9341 if(action & GMSH_SET) CTX::instance()->print.x3dCompatibility = (int)val;
9342 return CTX::instance()->print.x3dCompatibility;
9343 }
9344
opt_print_x3d_transparency(OPT_ARGS_NUM)9345 double opt_print_x3d_transparency(OPT_ARGS_NUM)
9346 {
9347 if(action & GMSH_SET) CTX::instance()->print.x3dTransparency = val;
9348 return CTX::instance()->print.x3dTransparency;
9349 }
9350
opt_print_x3d_remove_inner_borders(OPT_ARGS_NUM)9351 double opt_print_x3d_remove_inner_borders(OPT_ARGS_NUM)
9352 {
9353 if(action & GMSH_SET) CTX::instance()->print.x3dRemoveInnerBorders = (int)val;
9354 return CTX::instance()->print.x3dRemoveInnerBorders;
9355 }
9356
opt_print_x3d_precision(OPT_ARGS_NUM)9357 double opt_print_x3d_precision(OPT_ARGS_NUM)
9358 {
9359 if(action & GMSH_SET) CTX::instance()->print.x3dPrecision = val;
9360 return CTX::instance()->print.x3dPrecision;
9361 }
9362
opt_print_x3d_surfaces(OPT_ARGS_NUM)9363 double opt_print_x3d_surfaces(OPT_ARGS_NUM)
9364 {
9365 if(action & GMSH_SET) CTX::instance()->print.x3dSurfaces = (int)val;
9366 return CTX::instance()->print.x3dSurfaces;
9367 }
9368
opt_print_x3d_edges(OPT_ARGS_NUM)9369 double opt_print_x3d_edges(OPT_ARGS_NUM)
9370 {
9371 if(action & GMSH_SET) CTX::instance()->print.x3dEdges = (int)val;
9372 return CTX::instance()->print.x3dEdges;
9373 }
9374
opt_print_x3d_vertices(OPT_ARGS_NUM)9375 double opt_print_x3d_vertices(OPT_ARGS_NUM)
9376 {
9377 if(action & GMSH_SET) CTX::instance()->print.x3dVertices = (int)val;
9378 return CTX::instance()->print.x3dVertices;
9379 }
9380
9381 // Color option routines
9382
9383 #if defined(HAVE_FLTK)
9384
9385 #define CCC(col, but) \
9386 if(FlGui::available() && (action & GMSH_GUI)) { \
9387 Fl_Color c = \
9388 fl_color_cube(CTX::instance()->unpackRed(col) * FL_NUM_RED / 256, \
9389 CTX::instance()->unpackGreen(col) * FL_NUM_GREEN / 256, \
9390 CTX::instance()->unpackBlue(col) * FL_NUM_BLUE / 256); \
9391 (but)->color(c); \
9392 (but)->labelcolor(fl_contrast(FL_BLACK, c)); \
9393 (but)->redraw(); \
9394 }
9395
9396 #endif
9397
opt_general_color_background(OPT_ARGS_COL)9398 unsigned int opt_general_color_background(OPT_ARGS_COL)
9399 {
9400 if(action & GMSH_SET) {
9401 CTX::instance()->color.bg = val;
9402 #if defined(HAVE_FLTK)
9403 if(FlGui::available()) FlGui::instance()->options->view.colorbar->redraw();
9404 #endif
9405 }
9406 #if defined(HAVE_FLTK)
9407 CCC(CTX::instance()->color.bg, FlGui::instance()->options->general.color[0]);
9408 #endif
9409 return CTX::instance()->color.bg;
9410 }
9411
opt_general_color_background_gradient(OPT_ARGS_COL)9412 unsigned int opt_general_color_background_gradient(OPT_ARGS_COL)
9413 {
9414 if(action & GMSH_SET) CTX::instance()->color.bgGrad = val;
9415 #if defined(HAVE_FLTK)
9416 CCC(CTX::instance()->color.bgGrad,
9417 FlGui::instance()->options->general.color[1]);
9418 #endif
9419 return CTX::instance()->color.bgGrad;
9420 }
9421
opt_general_color_foreground(OPT_ARGS_COL)9422 unsigned int opt_general_color_foreground(OPT_ARGS_COL)
9423 {
9424 if(action & GMSH_SET) CTX::instance()->color.fg = val;
9425 #if defined(HAVE_FLTK)
9426 CCC(CTX::instance()->color.fg, FlGui::instance()->options->general.color[2]);
9427 #endif
9428 return CTX::instance()->color.fg;
9429 }
9430
opt_general_color_text(OPT_ARGS_COL)9431 unsigned int opt_general_color_text(OPT_ARGS_COL)
9432 {
9433 if(action & GMSH_SET) CTX::instance()->color.text = val;
9434 #if defined(HAVE_FLTK)
9435 CCC(CTX::instance()->color.text,
9436 FlGui::instance()->options->general.color[3]);
9437 drawContext::global()->resetFontTextures();
9438 #endif
9439 return CTX::instance()->color.text;
9440 }
9441
opt_general_color_axes(OPT_ARGS_COL)9442 unsigned int opt_general_color_axes(OPT_ARGS_COL)
9443 {
9444 if(action & GMSH_SET) CTX::instance()->color.axes = val;
9445 #if defined(HAVE_FLTK)
9446 CCC(CTX::instance()->color.axes,
9447 FlGui::instance()->options->general.color[4]);
9448 drawContext::global()->resetFontTextures();
9449 #endif
9450 return CTX::instance()->color.axes;
9451 }
9452
opt_general_color_small_axes(OPT_ARGS_COL)9453 unsigned int opt_general_color_small_axes(OPT_ARGS_COL)
9454 {
9455 if(action & GMSH_SET) CTX::instance()->color.smallAxes = val;
9456 #if defined(HAVE_FLTK)
9457 CCC(CTX::instance()->color.smallAxes,
9458 FlGui::instance()->options->general.color[5]);
9459 drawContext::global()->resetFontTextures();
9460 #endif
9461 return CTX::instance()->color.smallAxes;
9462 }
9463
opt_general_color_ambient_light(OPT_ARGS_COL)9464 unsigned int opt_general_color_ambient_light(OPT_ARGS_COL)
9465 {
9466 if(action & GMSH_SET)
9467 for(int i = 0; i < 6; i++) CTX::instance()->color.ambientLight[i] = val;
9468 #if defined(HAVE_FLTK)
9469 CCC(CTX::instance()->color.ambientLight[0],
9470 FlGui::instance()->options->general.color[6]);
9471 #endif
9472 return CTX::instance()->color.ambientLight[0];
9473 }
9474
opt_general_color_diffuse_light(OPT_ARGS_COL)9475 unsigned int opt_general_color_diffuse_light(OPT_ARGS_COL)
9476 {
9477 if(action & GMSH_SET)
9478 for(int i = 0; i < 6; i++) CTX::instance()->color.diffuseLight[i] = val;
9479 #if defined(HAVE_FLTK)
9480 CCC(CTX::instance()->color.diffuseLight[0],
9481 FlGui::instance()->options->general.color[7]);
9482 #endif
9483 return CTX::instance()->color.diffuseLight[0];
9484 }
9485
opt_general_color_specular_light(OPT_ARGS_COL)9486 unsigned int opt_general_color_specular_light(OPT_ARGS_COL)
9487 {
9488 if(action & GMSH_SET)
9489 for(int i = 0; i < 6; i++) CTX::instance()->color.specularLight[i] = val;
9490 #if defined(HAVE_FLTK)
9491 CCC(CTX::instance()->color.specularLight[0],
9492 FlGui::instance()->options->general.color[8]);
9493 #endif
9494 return CTX::instance()->color.specularLight[0];
9495 }
9496
opt_geometry_color_points(OPT_ARGS_COL)9497 unsigned int opt_geometry_color_points(OPT_ARGS_COL)
9498 {
9499 if(action & GMSH_SET) CTX::instance()->color.geom.point = val;
9500 #if defined(HAVE_FLTK)
9501 CCC(CTX::instance()->color.geom.point,
9502 FlGui::instance()->options->geo.color[0]);
9503 #endif
9504 return CTX::instance()->color.geom.point;
9505 }
9506
opt_geometry_color_curves(OPT_ARGS_COL)9507 unsigned int opt_geometry_color_curves(OPT_ARGS_COL)
9508 {
9509 if(action & GMSH_SET) CTX::instance()->color.geom.curve = val;
9510 #if defined(HAVE_FLTK)
9511 CCC(CTX::instance()->color.geom.curve,
9512 FlGui::instance()->options->geo.color[1]);
9513 #endif
9514 return CTX::instance()->color.geom.curve;
9515 }
9516
opt_geometry_color_surfaces(OPT_ARGS_COL)9517 unsigned int opt_geometry_color_surfaces(OPT_ARGS_COL)
9518 {
9519 if(action & GMSH_SET) CTX::instance()->color.geom.surface = val;
9520 #if defined(HAVE_FLTK)
9521 CCC(CTX::instance()->color.geom.surface,
9522 FlGui::instance()->options->geo.color[2]);
9523 #endif
9524 return CTX::instance()->color.geom.surface;
9525 }
9526
opt_geometry_color_volumes(OPT_ARGS_COL)9527 unsigned int opt_geometry_color_volumes(OPT_ARGS_COL)
9528 {
9529 if(action & GMSH_SET) CTX::instance()->color.geom.volume = val;
9530 #if defined(HAVE_FLTK)
9531 CCC(CTX::instance()->color.geom.volume,
9532 FlGui::instance()->options->geo.color[3]);
9533 #endif
9534 return CTX::instance()->color.geom.volume;
9535 }
9536
opt_geometry_color_selection(OPT_ARGS_COL)9537 unsigned int opt_geometry_color_selection(OPT_ARGS_COL)
9538 {
9539 if(action & GMSH_SET) CTX::instance()->color.geom.selection = val;
9540 #if defined(HAVE_FLTK)
9541 CCC(CTX::instance()->color.geom.selection,
9542 FlGui::instance()->options->geo.color[4]);
9543 #endif
9544 return CTX::instance()->color.geom.selection;
9545 }
9546
opt_geometry_color_highlight0(OPT_ARGS_COL)9547 unsigned int opt_geometry_color_highlight0(OPT_ARGS_COL)
9548 {
9549 if(action & GMSH_SET) { CTX::instance()->color.geom.highlight[0] = val; }
9550 #if defined(HAVE_FLTK)
9551 CCC(CTX::instance()->color.geom.highlight[0],
9552 FlGui::instance()->options->geo.color[5]);
9553 #endif
9554 return CTX::instance()->color.geom.highlight[0];
9555 }
9556
opt_geometry_color_highlight1(OPT_ARGS_COL)9557 unsigned int opt_geometry_color_highlight1(OPT_ARGS_COL)
9558 {
9559 if(action & GMSH_SET) { CTX::instance()->color.geom.highlight[1] = val; }
9560 #if defined(HAVE_FLTK)
9561 CCC(CTX::instance()->color.geom.highlight[1],
9562 FlGui::instance()->options->geo.color[6]);
9563 #endif
9564 return CTX::instance()->color.geom.highlight[1];
9565 }
9566
opt_geometry_color_highlight2(OPT_ARGS_COL)9567 unsigned int opt_geometry_color_highlight2(OPT_ARGS_COL)
9568 {
9569 if(action & GMSH_SET) CTX::instance()->color.geom.highlight[2] = val;
9570 #if defined(HAVE_FLTK)
9571 CCC(CTX::instance()->color.geom.highlight[2],
9572 FlGui::instance()->options->geo.color[7]);
9573 #endif
9574 return CTX::instance()->color.geom.highlight[2];
9575 }
9576
opt_geometry_color_tangents(OPT_ARGS_COL)9577 unsigned int opt_geometry_color_tangents(OPT_ARGS_COL)
9578 {
9579 if(action & GMSH_SET) CTX::instance()->color.geom.tangents = val;
9580 #if defined(HAVE_FLTK)
9581 CCC(CTX::instance()->color.geom.tangents,
9582 FlGui::instance()->options->geo.color[8]);
9583 #endif
9584 return CTX::instance()->color.geom.tangents;
9585 }
9586
opt_geometry_color_normals(OPT_ARGS_COL)9587 unsigned int opt_geometry_color_normals(OPT_ARGS_COL)
9588 {
9589 if(action & GMSH_SET) CTX::instance()->color.geom.normals = val;
9590 #if defined(HAVE_FLTK)
9591 CCC(CTX::instance()->color.geom.normals,
9592 FlGui::instance()->options->geo.color[9]);
9593 #endif
9594 return CTX::instance()->color.geom.normals;
9595 }
9596
opt_geometry_color_projection(OPT_ARGS_COL)9597 unsigned int opt_geometry_color_projection(OPT_ARGS_COL)
9598 {
9599 if(action & GMSH_SET) { CTX::instance()->color.geom.projection = val; }
9600 #if defined(HAVE_FLTK)
9601 CCC(CTX::instance()->color.geom.projection,
9602 FlGui::instance()->options->geo.color[10]);
9603 #endif
9604 return CTX::instance()->color.geom.projection;
9605 }
9606
opt_mesh_color_nodes(OPT_ARGS_COL)9607 unsigned int opt_mesh_color_nodes(OPT_ARGS_COL)
9608 {
9609 if(action & GMSH_SET) { CTX::instance()->color.mesh.node = val; }
9610 #if defined(HAVE_FLTK)
9611 CCC(CTX::instance()->color.mesh.node,
9612 FlGui::instance()->options->mesh.color[0]);
9613 #endif
9614 return CTX::instance()->color.mesh.node;
9615 }
9616
opt_mesh_color_nodes_sup(OPT_ARGS_COL)9617 unsigned int opt_mesh_color_nodes_sup(OPT_ARGS_COL)
9618 {
9619 if(action & GMSH_SET) { CTX::instance()->color.mesh.nodeSup = val; }
9620 #if defined(HAVE_FLTK)
9621 CCC(CTX::instance()->color.mesh.nodeSup,
9622 FlGui::instance()->options->mesh.color[1]);
9623 #endif
9624 return CTX::instance()->color.mesh.nodeSup;
9625 }
9626
opt_mesh_color_lines(OPT_ARGS_COL)9627 unsigned int opt_mesh_color_lines(OPT_ARGS_COL)
9628 {
9629 if(action & GMSH_SET) {
9630 // vertex arrays need to be regenerated only when we color by
9631 // element type
9632 if(CTX::instance()->color.mesh.line != val &&
9633 CTX::instance()->mesh.colorCarousel == 0)
9634 CTX::instance()->mesh.changed |= (ENT_CURVE | ENT_SURFACE | ENT_VOLUME);
9635 CTX::instance()->color.mesh.line = val;
9636 }
9637 #if defined(HAVE_FLTK)
9638 CCC(CTX::instance()->color.mesh.line,
9639 FlGui::instance()->options->mesh.color[2]);
9640 #endif
9641 return CTX::instance()->color.mesh.line;
9642 }
9643
opt_mesh_color_triangles(OPT_ARGS_COL)9644 unsigned int opt_mesh_color_triangles(OPT_ARGS_COL)
9645 {
9646 if(action & GMSH_SET) {
9647 // vertex arrays need to be regenerated only when we color by
9648 // element type
9649 if(CTX::instance()->color.mesh.triangle != val &&
9650 CTX::instance()->mesh.colorCarousel == 0)
9651 CTX::instance()->mesh.changed |= ENT_SURFACE;
9652 CTX::instance()->color.mesh.triangle = val;
9653 }
9654 #if defined(HAVE_FLTK)
9655 CCC(CTX::instance()->color.mesh.triangle,
9656 FlGui::instance()->options->mesh.color[3]);
9657 #endif
9658 return CTX::instance()->color.mesh.triangle;
9659 }
9660
opt_mesh_color_quadrangles(OPT_ARGS_COL)9661 unsigned int opt_mesh_color_quadrangles(OPT_ARGS_COL)
9662 {
9663 if(action & GMSH_SET) {
9664 // vertex arrays need to be regenerated only when we color by
9665 // element type
9666 if(CTX::instance()->color.mesh.quadrangle != val &&
9667 CTX::instance()->mesh.colorCarousel == 0)
9668 CTX::instance()->mesh.changed |= ENT_SURFACE;
9669 CTX::instance()->color.mesh.quadrangle = val;
9670 }
9671 #if defined(HAVE_FLTK)
9672 CCC(CTX::instance()->color.mesh.quadrangle,
9673 FlGui::instance()->options->mesh.color[4]);
9674 #endif
9675 return CTX::instance()->color.mesh.quadrangle;
9676 }
9677
opt_mesh_color_tetrahedra(OPT_ARGS_COL)9678 unsigned int opt_mesh_color_tetrahedra(OPT_ARGS_COL)
9679 {
9680 if(action & GMSH_SET) {
9681 // vertex arrays need to be regenerated only when we color by
9682 // element type
9683 if(CTX::instance()->color.mesh.tetrahedron != val &&
9684 CTX::instance()->mesh.colorCarousel == 0)
9685 CTX::instance()->mesh.changed |= ENT_VOLUME;
9686 CTX::instance()->color.mesh.tetrahedron = val;
9687 }
9688 #if defined(HAVE_FLTK)
9689 CCC(CTX::instance()->color.mesh.tetrahedron,
9690 FlGui::instance()->options->mesh.color[5]);
9691 #endif
9692 return CTX::instance()->color.mesh.tetrahedron;
9693 }
9694
opt_mesh_color_hexahedra(OPT_ARGS_COL)9695 unsigned int opt_mesh_color_hexahedra(OPT_ARGS_COL)
9696 {
9697 if(action & GMSH_SET) {
9698 // vertex arrays need to be regenerated only when we color by
9699 // element type
9700 if(CTX::instance()->color.mesh.hexahedron != val &&
9701 CTX::instance()->mesh.colorCarousel == 0)
9702 CTX::instance()->mesh.changed |= ENT_VOLUME;
9703 CTX::instance()->color.mesh.hexahedron = val;
9704 }
9705 #if defined(HAVE_FLTK)
9706 CCC(CTX::instance()->color.mesh.hexahedron,
9707 FlGui::instance()->options->mesh.color[6]);
9708 #endif
9709 return CTX::instance()->color.mesh.hexahedron;
9710 }
9711
opt_mesh_color_prisms(OPT_ARGS_COL)9712 unsigned int opt_mesh_color_prisms(OPT_ARGS_COL)
9713 {
9714 if(action & GMSH_SET) {
9715 // vertex arrays need to be regenerated only when we color by
9716 // element type
9717 if(CTX::instance()->color.mesh.prism != val &&
9718 CTX::instance()->mesh.colorCarousel == 0)
9719 CTX::instance()->mesh.changed |= ENT_VOLUME;
9720 CTX::instance()->color.mesh.prism = val;
9721 }
9722 #if defined(HAVE_FLTK)
9723 CCC(CTX::instance()->color.mesh.prism,
9724 FlGui::instance()->options->mesh.color[7]);
9725 #endif
9726 return CTX::instance()->color.mesh.prism;
9727 }
9728
opt_mesh_color_pyramid(OPT_ARGS_COL)9729 unsigned int opt_mesh_color_pyramid(OPT_ARGS_COL)
9730 {
9731 if(action & GMSH_SET) {
9732 // vertex arrays need to be regenerated only when we color by
9733 // element type
9734 if(CTX::instance()->color.mesh.pyramid != val &&
9735 CTX::instance()->mesh.colorCarousel == 0)
9736 CTX::instance()->mesh.changed |= ENT_VOLUME;
9737 CTX::instance()->color.mesh.pyramid = val;
9738 }
9739 #if defined(HAVE_FLTK)
9740 CCC(CTX::instance()->color.mesh.pyramid,
9741 FlGui::instance()->options->mesh.color[8]);
9742 #endif
9743 return CTX::instance()->color.mesh.pyramid;
9744 }
9745
opt_mesh_color_trihedron(OPT_ARGS_COL)9746 unsigned int opt_mesh_color_trihedron(OPT_ARGS_COL)
9747 {
9748 if(action & GMSH_SET) {
9749 // vertex arrays need to be regenerated only when we color by
9750 // element type
9751 if(CTX::instance()->color.mesh.trihedron != val &&
9752 CTX::instance()->mesh.colorCarousel == 0)
9753 CTX::instance()->mesh.changed |= ENT_VOLUME;
9754 CTX::instance()->color.mesh.trihedron = val;
9755 }
9756 #if defined(HAVE_FLTK)
9757 CCC(CTX::instance()->color.mesh.trihedron,
9758 FlGui::instance()->options->mesh.color[9]);
9759 #endif
9760 return CTX::instance()->color.mesh.trihedron;
9761 }
9762
opt_mesh_color_tangents(OPT_ARGS_COL)9763 unsigned int opt_mesh_color_tangents(OPT_ARGS_COL)
9764 {
9765 if(action & GMSH_SET) { CTX::instance()->color.mesh.tangents = val; }
9766 #if defined(HAVE_FLTK)
9767 CCC(CTX::instance()->color.mesh.tangents,
9768 FlGui::instance()->options->mesh.color[10]);
9769 #endif
9770 return CTX::instance()->color.mesh.tangents;
9771 }
9772
opt_mesh_color_normals(OPT_ARGS_COL)9773 unsigned int opt_mesh_color_normals(OPT_ARGS_COL)
9774 {
9775 if(action & GMSH_SET) { CTX::instance()->color.mesh.normals = val; }
9776 #if defined(HAVE_FLTK)
9777 CCC(CTX::instance()->color.mesh.normals,
9778 FlGui::instance()->options->mesh.color[11]);
9779 #endif
9780 return CTX::instance()->color.mesh.normals;
9781 }
9782
opt_mesh_color_(int i,OPT_ARGS_COL)9783 unsigned int opt_mesh_color_(int i, OPT_ARGS_COL)
9784 {
9785 int n = (i < 0 || i >= 20) ? 0 : i;
9786 if(action & GMSH_SET) {
9787 // vertex arrays need to be regenerated only when we color by
9788 // partition
9789 if(CTX::instance()->color.mesh.carousel[n] != val &&
9790 CTX::instance()->mesh.colorCarousel == 3)
9791 CTX::instance()->mesh.changed |= (ENT_CURVE | ENT_SURFACE | ENT_VOLUME);
9792 CTX::instance()->color.mesh.carousel[n] = val;
9793 }
9794 #if defined(HAVE_FLTK)
9795 CCC(CTX::instance()->color.mesh.carousel[n],
9796 FlGui::instance()->options->mesh.color[12 + n]);
9797 #endif
9798 return CTX::instance()->color.mesh.carousel[n];
9799 }
9800
opt_mesh_color_0(OPT_ARGS_COL)9801 unsigned int opt_mesh_color_0(OPT_ARGS_COL)
9802 {
9803 return opt_mesh_color_(0, num, action, val);
9804 }
opt_mesh_color_1(OPT_ARGS_COL)9805 unsigned int opt_mesh_color_1(OPT_ARGS_COL)
9806 {
9807 return opt_mesh_color_(1, num, action, val);
9808 }
opt_mesh_color_2(OPT_ARGS_COL)9809 unsigned int opt_mesh_color_2(OPT_ARGS_COL)
9810 {
9811 return opt_mesh_color_(2, num, action, val);
9812 }
opt_mesh_color_3(OPT_ARGS_COL)9813 unsigned int opt_mesh_color_3(OPT_ARGS_COL)
9814 {
9815 return opt_mesh_color_(3, num, action, val);
9816 }
opt_mesh_color_4(OPT_ARGS_COL)9817 unsigned int opt_mesh_color_4(OPT_ARGS_COL)
9818 {
9819 return opt_mesh_color_(4, num, action, val);
9820 }
opt_mesh_color_5(OPT_ARGS_COL)9821 unsigned int opt_mesh_color_5(OPT_ARGS_COL)
9822 {
9823 return opt_mesh_color_(5, num, action, val);
9824 }
opt_mesh_color_6(OPT_ARGS_COL)9825 unsigned int opt_mesh_color_6(OPT_ARGS_COL)
9826 {
9827 return opt_mesh_color_(6, num, action, val);
9828 }
opt_mesh_color_7(OPT_ARGS_COL)9829 unsigned int opt_mesh_color_7(OPT_ARGS_COL)
9830 {
9831 return opt_mesh_color_(7, num, action, val);
9832 }
opt_mesh_color_8(OPT_ARGS_COL)9833 unsigned int opt_mesh_color_8(OPT_ARGS_COL)
9834 {
9835 return opt_mesh_color_(8, num, action, val);
9836 }
opt_mesh_color_9(OPT_ARGS_COL)9837 unsigned int opt_mesh_color_9(OPT_ARGS_COL)
9838 {
9839 return opt_mesh_color_(9, num, action, val);
9840 }
opt_mesh_color_10(OPT_ARGS_COL)9841 unsigned int opt_mesh_color_10(OPT_ARGS_COL)
9842 {
9843 return opt_mesh_color_(10, num, action, val);
9844 }
opt_mesh_color_11(OPT_ARGS_COL)9845 unsigned int opt_mesh_color_11(OPT_ARGS_COL)
9846 {
9847 return opt_mesh_color_(11, num, action, val);
9848 }
opt_mesh_color_12(OPT_ARGS_COL)9849 unsigned int opt_mesh_color_12(OPT_ARGS_COL)
9850 {
9851 return opt_mesh_color_(12, num, action, val);
9852 }
opt_mesh_color_13(OPT_ARGS_COL)9853 unsigned int opt_mesh_color_13(OPT_ARGS_COL)
9854 {
9855 return opt_mesh_color_(13, num, action, val);
9856 }
opt_mesh_color_14(OPT_ARGS_COL)9857 unsigned int opt_mesh_color_14(OPT_ARGS_COL)
9858 {
9859 return opt_mesh_color_(14, num, action, val);
9860 }
opt_mesh_color_15(OPT_ARGS_COL)9861 unsigned int opt_mesh_color_15(OPT_ARGS_COL)
9862 {
9863 return opt_mesh_color_(15, num, action, val);
9864 }
opt_mesh_color_16(OPT_ARGS_COL)9865 unsigned int opt_mesh_color_16(OPT_ARGS_COL)
9866 {
9867 return opt_mesh_color_(16, num, action, val);
9868 }
opt_mesh_color_17(OPT_ARGS_COL)9869 unsigned int opt_mesh_color_17(OPT_ARGS_COL)
9870 {
9871 return opt_mesh_color_(17, num, action, val);
9872 }
opt_mesh_color_18(OPT_ARGS_COL)9873 unsigned int opt_mesh_color_18(OPT_ARGS_COL)
9874 {
9875 return opt_mesh_color_(18, num, action, val);
9876 }
opt_mesh_color_19(OPT_ARGS_COL)9877 unsigned int opt_mesh_color_19(OPT_ARGS_COL)
9878 {
9879 return opt_mesh_color_(19, num, action, val);
9880 }
9881
opt_view_color_points(OPT_ARGS_COL)9882 unsigned int opt_view_color_points(OPT_ARGS_COL)
9883 {
9884 #if defined(HAVE_POST)
9885 GET_VIEWo(0);
9886 if(action & GMSH_SET) {
9887 opt->color.point = val;
9888 if(view) view->setChanged(true);
9889 }
9890 #if defined(HAVE_FLTK)
9891 if(_gui_action_valid(action, num)) {
9892 CCC(opt->color.point, FlGui::instance()->options->view.color[0]);
9893 }
9894 #endif
9895 return opt->color.point;
9896 #else
9897 return 0;
9898 #endif
9899 }
9900
opt_view_color_lines(OPT_ARGS_COL)9901 unsigned int opt_view_color_lines(OPT_ARGS_COL)
9902 {
9903 #if defined(HAVE_POST)
9904 GET_VIEWo(0);
9905 if(action & GMSH_SET) {
9906 opt->color.line = val;
9907 if(view) view->setChanged(true);
9908 }
9909 #if defined(HAVE_FLTK)
9910 if(_gui_action_valid(action, num)) {
9911 CCC(opt->color.line, FlGui::instance()->options->view.color[1]);
9912 }
9913 #endif
9914 return opt->color.line;
9915 #else
9916 return 0;
9917 #endif
9918 }
9919
opt_view_color_triangles(OPT_ARGS_COL)9920 unsigned int opt_view_color_triangles(OPT_ARGS_COL)
9921 {
9922 #if defined(HAVE_POST)
9923 GET_VIEWo(0);
9924 if(action & GMSH_SET) {
9925 opt->color.triangle = val;
9926 if(view) view->setChanged(true);
9927 }
9928 #if defined(HAVE_FLTK)
9929 if(_gui_action_valid(action, num)) {
9930 CCC(opt->color.triangle, FlGui::instance()->options->view.color[2]);
9931 }
9932 #endif
9933 return opt->color.triangle;
9934 #else
9935 return 0;
9936 #endif
9937 }
9938
opt_view_color_quadrangles(OPT_ARGS_COL)9939 unsigned int opt_view_color_quadrangles(OPT_ARGS_COL)
9940 {
9941 #if defined(HAVE_POST)
9942 GET_VIEWo(0);
9943 if(action & GMSH_SET) {
9944 opt->color.quadrangle = val;
9945 if(view) view->setChanged(true);
9946 }
9947 #if defined(HAVE_FLTK)
9948 if(_gui_action_valid(action, num)) {
9949 CCC(opt->color.quadrangle, FlGui::instance()->options->view.color[3]);
9950 }
9951 #endif
9952 return opt->color.quadrangle;
9953 #else
9954 return 0;
9955 #endif
9956 }
9957
opt_view_color_tetrahedra(OPT_ARGS_COL)9958 unsigned int opt_view_color_tetrahedra(OPT_ARGS_COL)
9959 {
9960 #if defined(HAVE_POST)
9961 GET_VIEWo(0);
9962 if(action & GMSH_SET) {
9963 opt->color.tetrahedron = val;
9964 if(view) view->setChanged(true);
9965 }
9966 #if defined(HAVE_FLTK)
9967 if(_gui_action_valid(action, num)) {
9968 CCC(opt->color.tetrahedron, FlGui::instance()->options->view.color[4]);
9969 }
9970 #endif
9971 return opt->color.tetrahedron;
9972 #else
9973 return 0;
9974 #endif
9975 }
9976
opt_view_color_hexahedra(OPT_ARGS_COL)9977 unsigned int opt_view_color_hexahedra(OPT_ARGS_COL)
9978 {
9979 #if defined(HAVE_POST)
9980 GET_VIEWo(0);
9981 if(action & GMSH_SET) {
9982 opt->color.hexahedron = val;
9983 if(view) view->setChanged(true);
9984 }
9985 #if defined(HAVE_FLTK)
9986 if(_gui_action_valid(action, num)) {
9987 CCC(opt->color.hexahedron, FlGui::instance()->options->view.color[5]);
9988 }
9989 #endif
9990 return opt->color.hexahedron;
9991 #else
9992 return 0;
9993 #endif
9994 }
9995
opt_view_color_prisms(OPT_ARGS_COL)9996 unsigned int opt_view_color_prisms(OPT_ARGS_COL)
9997 {
9998 #if defined(HAVE_POST)
9999 GET_VIEWo(0);
10000 if(action & GMSH_SET) {
10001 opt->color.prism = val;
10002 if(view) view->setChanged(true);
10003 }
10004 #if defined(HAVE_FLTK)
10005 if(_gui_action_valid(action, num)) {
10006 CCC(opt->color.prism, FlGui::instance()->options->view.color[6]);
10007 }
10008 #endif
10009 return opt->color.prism;
10010 #else
10011 return 0;
10012 #endif
10013 }
10014
opt_view_color_pyramids(OPT_ARGS_COL)10015 unsigned int opt_view_color_pyramids(OPT_ARGS_COL)
10016 {
10017 #if defined(HAVE_POST)
10018 GET_VIEWo(0);
10019 if(action & GMSH_SET) {
10020 opt->color.pyramid = val;
10021 if(view) view->setChanged(true);
10022 }
10023 #if defined(HAVE_FLTK)
10024 if(_gui_action_valid(action, num)) {
10025 CCC(opt->color.pyramid, FlGui::instance()->options->view.color[7]);
10026 }
10027 #endif
10028 return opt->color.pyramid;
10029 #else
10030 return 0;
10031 #endif
10032 }
10033
opt_view_color_trihedra(OPT_ARGS_COL)10034 unsigned int opt_view_color_trihedra(OPT_ARGS_COL)
10035 {
10036 #if defined(HAVE_POST)
10037 GET_VIEWo(0);
10038 if(action & GMSH_SET) {
10039 opt->color.trihedron = val;
10040 if(view) view->setChanged(true);
10041 }
10042 #if defined(HAVE_FLTK)
10043 if(_gui_action_valid(action, num)) {
10044 CCC(opt->color.trihedron, FlGui::instance()->options->view.color[8]);
10045 }
10046 #endif
10047 return opt->color.trihedron;
10048 #else
10049 return 0;
10050 #endif
10051 }
10052
opt_view_color_tangents(OPT_ARGS_COL)10053 unsigned int opt_view_color_tangents(OPT_ARGS_COL)
10054 {
10055 #if defined(HAVE_POST)
10056 GET_VIEWo(0);
10057 if(action & GMSH_SET) {
10058 opt->color.tangents = val;
10059 if(view) view->setChanged(true);
10060 }
10061 #if defined(HAVE_FLTK)
10062 if(_gui_action_valid(action, num)) {
10063 CCC(opt->color.tangents, FlGui::instance()->options->view.color[9]);
10064 }
10065 #endif
10066 return opt->color.tangents;
10067 #else
10068 return 0;
10069 #endif
10070 }
10071
opt_view_color_normals(OPT_ARGS_COL)10072 unsigned int opt_view_color_normals(OPT_ARGS_COL)
10073 {
10074 #if defined(HAVE_POST)
10075 GET_VIEWo(0);
10076 if(action & GMSH_SET) {
10077 opt->color.normals = val;
10078 if(view) view->setChanged(true);
10079 }
10080 #if defined(HAVE_FLTK)
10081 if(_gui_action_valid(action, num)) {
10082 CCC(opt->color.normals, FlGui::instance()->options->view.color[10]);
10083 }
10084 #endif
10085 return opt->color.normals;
10086 #else
10087 return 0;
10088 #endif
10089 }
10090
opt_view_color_text2d(OPT_ARGS_COL)10091 unsigned int opt_view_color_text2d(OPT_ARGS_COL)
10092 {
10093 #if defined(HAVE_POST)
10094 GET_VIEWo(0);
10095 if(action & GMSH_SET) { opt->color.text2d = val; }
10096 #if defined(HAVE_FLTK)
10097 if(_gui_action_valid(action, num)) {
10098 CCC(opt->color.text2d, FlGui::instance()->options->view.color[11]);
10099 drawContext::global()->resetFontTextures();
10100 }
10101 #endif
10102 return opt->color.text2d;
10103 #else
10104 return 0;
10105 #endif
10106 }
10107
opt_view_color_text3d(OPT_ARGS_COL)10108 unsigned int opt_view_color_text3d(OPT_ARGS_COL)
10109 {
10110 #if defined(HAVE_POST)
10111 GET_VIEWo(0);
10112 if(action & GMSH_SET) { opt->color.text3d = val; }
10113 #if defined(HAVE_FLTK)
10114 if(_gui_action_valid(action, num)) {
10115 CCC(opt->color.text3d, FlGui::instance()->options->view.color[12]);
10116 drawContext::global()->resetFontTextures();
10117 }
10118 #endif
10119 return opt->color.text3d;
10120 #else
10121 return 0;
10122 #endif
10123 }
10124
opt_view_color_axes(OPT_ARGS_COL)10125 unsigned int opt_view_color_axes(OPT_ARGS_COL)
10126 {
10127 #if defined(HAVE_POST)
10128 GET_VIEWo(0);
10129 if(action & GMSH_SET) { opt->color.axes = val; }
10130 #if defined(HAVE_FLTK)
10131 if(_gui_action_valid(action, num)) {
10132 CCC(opt->color.axes, FlGui::instance()->options->view.color[13]);
10133 drawContext::global()->resetFontTextures();
10134 }
10135 #endif
10136 return opt->color.axes;
10137 #else
10138 return 0;
10139 #endif
10140 }
10141
opt_view_color_background2d(OPT_ARGS_COL)10142 unsigned int opt_view_color_background2d(OPT_ARGS_COL)
10143 {
10144 #if defined(HAVE_POST)
10145 GET_VIEWo(0);
10146 if(action & GMSH_SET) { opt->color.background2d = val; }
10147 #if defined(HAVE_FLTK)
10148 if(_gui_action_valid(action, num)) {
10149 CCC(opt->color.background2d, FlGui::instance()->options->view.color[14]);
10150 drawContext::global()->resetFontTextures();
10151 }
10152 #endif
10153 return opt->color.background2d;
10154 #else
10155 return 0;
10156 #endif
10157 }
10158