PageRenderTime 108ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 1ms

/Common/Options.cpp

https://bitbucket.org/lge/gmsh
C++ | 8910 lines | 8124 code | 734 blank | 52 comment | 1668 complexity | 78163dd2f0ca41f1e2fcf4aef69c6c57 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, BSD-3-Clause
  1. // Gmsh - Copyright (C) 1997-2012 C. Geuzaine, J.-F. Remacle
  2. //
  3. // See the LICENSE.txt file for license information. Please report all
  4. // bugs and problems to <gmsh@geuz.org>.
  5. #include <string.h>
  6. #include <stdlib.h>
  7. #include <stdio.h>
  8. #include "GmshConfig.h"
  9. #include "GmshDefines.h"
  10. #include "GmshMessage.h"
  11. #include "StringUtils.h"
  12. #include "GModel.h"
  13. #include "Context.h"
  14. #include "Options.h"
  15. #include "Colors.h"
  16. #include "DefaultOptions.h"
  17. #if defined(HAVE_MESH)
  18. #include "Generator.h"
  19. #include "Field.h"
  20. #include "BackgroundMesh.h"
  21. #endif
  22. #if defined(HAVE_PARSER)
  23. #include "Parser.h"
  24. #endif
  25. #if defined(HAVE_POST)
  26. #include "PView.h"
  27. #include "PViewOptions.h"
  28. #include "PViewData.h"
  29. #include "adaptiveData.h"
  30. #endif
  31. #if defined(HAVE_PLUGINS)
  32. #include "PluginManager.h"
  33. #include "Plugin.h"
  34. #endif
  35. #if defined(HAVE_FLTK)
  36. #include <FL/Fl_Tooltip.H>
  37. #include "FlGui.h"
  38. #include "graphicWindow.h"
  39. #include "optionWindow.h"
  40. #include "manipWindow.h"
  41. #include "contextWindow.h"
  42. #include "clippingWindow.h"
  43. #include "onelabGroup.h"
  44. #include "viewButton.h"
  45. #endif
  46. // General routines for string options
  47. bool StringOption(int action, const char *category, int num,
  48. const char *name, std::string &val)
  49. {
  50. StringXString *s = 0;
  51. if(!strcmp(category, "General"))
  52. s = GeneralOptions_String;
  53. else if(!strcmp(category, "Geometry"))
  54. s = GeometryOptions_String;
  55. else if(!strcmp(category, "Mesh"))
  56. s = MeshOptions_String;
  57. else if(!strcmp(category, "Solver"))
  58. s = SolverOptions_String;
  59. else if(!strcmp(category, "PostProcessing"))
  60. s = PostProcessingOptions_String;
  61. else if(!strcmp(category, "View"))
  62. s = ViewOptions_String;
  63. else if(!strcmp(category, "Print"))
  64. s = PrintOptions_String;
  65. else{
  66. Msg::Error("Unknown string option category '%s'", category);
  67. return false;
  68. }
  69. int i = 0;
  70. while(s[i].str && strcmp(s[i].str, name)) i++;
  71. if(!s[i].str){
  72. Msg::Error("Unknown string option '%s.%s'", category, name);
  73. return false;
  74. }
  75. val = s[i].function(num, action, val);
  76. return true;
  77. }
  78. static void SetDefaultStringOptions(int num, StringXString s[])
  79. {
  80. int i = 0;
  81. while(s[i].str) {
  82. s[i].function(num, GMSH_SET, s[i].def);
  83. i++;
  84. }
  85. }
  86. static void SetStringOptionsGUI(int num, StringXString s[])
  87. {
  88. int i = 0;
  89. while(s[i].str) {
  90. s[i].function(num, GMSH_GUI, "");
  91. i++;
  92. }
  93. }
  94. static void PrintStringOptions(int num, int level, int diff, int help,
  95. StringXString s[], const char *prefix, FILE *file)
  96. {
  97. int i = 0;
  98. while(s[i].str) {
  99. if(s[i].level & level) {
  100. if(!diff || s[i].function(num, GMSH_GET, "") != s[i].def){
  101. char tmp[1024];
  102. sprintf(tmp, "%s%s = \"%s\";%s%s", prefix,
  103. s[i].str, s[i].function(num, GMSH_GET, "").c_str(),
  104. help ? " // " : "", help ? s[i].help : "");
  105. if(file)
  106. fprintf(file, "%s\n", tmp);
  107. else{
  108. // remove \n, \t, \r
  109. for(unsigned int i = 0; i < strlen(tmp); i++)
  110. if(tmp[i] == '\n' || tmp[i] == '\t' || tmp[i] == '\r') tmp[i] = ' ';
  111. // Warning: must call Msg::Direct(level, ...) here, because
  112. // we cannot use tmp as a format string (it can contain %s!)
  113. Msg::Direct(3, "%s", tmp);
  114. }
  115. }
  116. }
  117. i++;
  118. }
  119. }
  120. static const char *GetOptionSaveLevel(int level)
  121. {
  122. if(level & GMSH_SESSIONRC){
  123. return "General.SessionFileName";
  124. }
  125. else if(level & GMSH_OPTIONSRC){
  126. return "General.OptionsFileName";
  127. }
  128. else{
  129. return "-";
  130. }
  131. }
  132. static void PrintStringOptionsDoc(StringXString s[], const char *prefix, FILE *file)
  133. {
  134. int i = 0;
  135. while(s[i].str) {
  136. fprintf(file, "@item %s%s\n", prefix, s[i].str);
  137. fprintf(file, "%s@*\n", s[i].help);
  138. // sanitize the string for texinfo
  139. std::string val = s[i].function(0, GMSH_GET, "");
  140. for(unsigned int j = 1; j < val.size(); j++){
  141. if(val[j] == '\n' && val[j - 1] == '\n')
  142. val[j - 1] = '.';
  143. }
  144. fprintf(file, "Default value: @code{\"%s\"}@*\n", val.c_str());
  145. fprintf(file, "Saved in: @code{%s}\n\n", GetOptionSaveLevel(s[i].level));
  146. i++;
  147. }
  148. }
  149. // General routines for numeric options
  150. bool NumberOption(int action, const char *category, int num,
  151. const char *name, double &val)
  152. {
  153. StringXNumber *s = 0;
  154. if(!strcmp(category, "General"))
  155. s = GeneralOptions_Number;
  156. else if(!strcmp(category, "Geometry"))
  157. s = GeometryOptions_Number;
  158. else if(!strcmp(category, "Mesh"))
  159. s = MeshOptions_Number;
  160. else if(!strcmp(category, "Solver"))
  161. s = SolverOptions_Number;
  162. else if(!strcmp(category, "PostProcessing"))
  163. s = PostProcessingOptions_Number;
  164. else if(!strcmp(category, "View"))
  165. s = ViewOptions_Number;
  166. else if(!strcmp(category, "Print"))
  167. s = PrintOptions_Number;
  168. else{
  169. Msg::Error("Unknown number option category '%s'", category);
  170. return false;
  171. }
  172. int i = 0;
  173. while(s[i].str && strcmp(s[i].str, name)) i++;
  174. if(!s[i].str){
  175. Msg::Error("Unknown number option '%s.%s'", category, name);
  176. return false;
  177. }
  178. val = s[i].function(num, action, val);
  179. return true;
  180. }
  181. static void SetDefaultNumberOptions(int num, StringXNumber s[])
  182. {
  183. int i = 0;
  184. while(s[i].str) {
  185. s[i].function(num, GMSH_SET, s[i].def);
  186. i++;
  187. }
  188. }
  189. static void SetNumberOptionsGUI(int num, StringXNumber s[])
  190. {
  191. int i = 0;
  192. while(s[i].str) {
  193. s[i].function(num, GMSH_GUI, 0);
  194. i++;
  195. }
  196. }
  197. static void PrintNumberOptions(int num, int level, int diff, int help,
  198. StringXNumber s[], const char *prefix, FILE * file)
  199. {
  200. int i = 0;
  201. char tmp[1024];
  202. while(s[i].str) {
  203. if(s[i].level & level) {
  204. if(!diff || (s[i].function(num, GMSH_GET, 0) != s[i].def)){
  205. sprintf(tmp, "%s%s = %.16g;%s%s", prefix,
  206. s[i].str, s[i].function(num, GMSH_GET, 0),
  207. help ? " // " : "", help ? s[i].help : "");
  208. if(file)
  209. fprintf(file, "%s\n", tmp);
  210. else
  211. Msg::Direct(tmp);
  212. }
  213. }
  214. i++;
  215. }
  216. }
  217. static void PrintNumberOptionsDoc(StringXNumber s[], const char *prefix, FILE * file)
  218. {
  219. int i = 0;
  220. while(s[i].str) {
  221. fprintf(file, "@item %s%s\n", prefix, s[i].str);
  222. fprintf(file, "%s@*\n", s[i].help);
  223. fprintf(file, "Default value: @code{%g}@*\n", s[i].function(0, GMSH_GET, 0));
  224. fprintf(file, "Saved in: @code{%s}\n\n", GetOptionSaveLevel(s[i].level));
  225. i++;
  226. }
  227. }
  228. // General routines for color options
  229. bool ColorOption(int action, const char *category, int num,
  230. const char *name, unsigned int &val)
  231. {
  232. StringXColor *s = 0;
  233. if(!strcmp(category, "General"))
  234. s = GeneralOptions_Color;
  235. else if(!strcmp(category, "Geometry"))
  236. s = GeometryOptions_Color;
  237. else if(!strcmp(category, "Mesh"))
  238. s = MeshOptions_Color;
  239. else if(!strcmp(category, "Solver"))
  240. s = SolverOptions_Color;
  241. else if(!strcmp(category, "PostProcessing"))
  242. s = PostProcessingOptions_Color;
  243. else if(!strcmp(category, "View"))
  244. s = ViewOptions_Color;
  245. else if(!strcmp(category, "Print"))
  246. s = PrintOptions_Color;
  247. else{
  248. Msg::Error("Unknown color option category '%s'", category);
  249. return false;
  250. }
  251. int i = 0;
  252. while(s[i].str && strcmp(s[i].str, name)) i++;
  253. if(!s[i].str){
  254. Msg::Error("Unknown color option '%s.%s'", category, name);
  255. return false;
  256. }
  257. val = s[i].function(num, action, val);
  258. return true;
  259. }
  260. int GetColorForString(int alpha, const char *str, int *FlagError)
  261. {
  262. int i = 0;
  263. while(ColorString[i].str && strcmp(ColorString[i].str, str))
  264. i++;
  265. *FlagError = !ColorString[i].str ? 1 : 0;
  266. if(alpha > 0)
  267. return CTX::instance()->packColor
  268. (ColorString[i].int1, ColorString[i].int2, ColorString[i].int3, alpha);
  269. else
  270. return CTX::instance()->packColor
  271. (ColorString[i].int1, ColorString[i].int2, ColorString[i].int3,
  272. ColorString[i].int4);
  273. }
  274. bool GetRGBForString(const char *str, int &r, int &g, int &b)
  275. {
  276. int i = 0;
  277. while(ColorString[i].str && strcmp(ColorString[i].str, str))
  278. i++;
  279. if(!ColorString[i].str){
  280. r = g = b = 0;
  281. return false;
  282. }
  283. r = ColorString[i].int1;
  284. g = ColorString[i].int2;
  285. b = ColorString[i].int3;
  286. return true;
  287. }
  288. static void SetDefaultColorOptions(int num, StringXColor s[])
  289. {
  290. int i = 0;
  291. // Warning: this assumes that CTX::instance()->color_scheme is set...
  292. switch (CTX::instance()->colorScheme) {
  293. case 1:
  294. while(s[i].str) {
  295. s[i].function(num, GMSH_SET, CTX::instance()->packColor
  296. (s[i].def2[0], s[i].def2[1], s[i].def2[2], s[i].def2[3]));
  297. i++;
  298. }
  299. break;
  300. case 2:
  301. while(s[i].str) {
  302. s[i].function(num, GMSH_SET, CTX::instance()->packColor
  303. (s[i].def3[0], s[i].def3[1], s[i].def3[2], s[i].def3[3]));
  304. i++;
  305. }
  306. break;
  307. default:
  308. while(s[i].str) {
  309. s[i].function(num, GMSH_SET, CTX::instance()->packColor
  310. (s[i].def1[0], s[i].def1[1], s[i].def1[2], s[i].def1[3]));
  311. i++;
  312. }
  313. break;
  314. }
  315. }
  316. static void SetColorOptionsGUI(int num, StringXColor s[])
  317. {
  318. int i = 0;
  319. while(s[i].str) {
  320. s[i].function(num, GMSH_GUI, 0);
  321. i++;
  322. }
  323. }
  324. static void PrintColorOptions(int num, int level, int diff, int help,
  325. StringXColor s[], const char *prefix, FILE * file)
  326. {
  327. int i = 0;
  328. char tmp[1024];
  329. while(s[i].str) {
  330. if(s[i].level & level) {
  331. unsigned int def;
  332. switch (CTX::instance()->colorScheme) {
  333. case 1:
  334. def = CTX::instance()->packColor
  335. (s[i].def2[0], s[i].def2[1], s[i].def2[2], s[i].def2[3]);
  336. break;
  337. case 2:
  338. def = CTX::instance()->packColor
  339. (s[i].def3[0], s[i].def3[1], s[i].def3[2], s[i].def3[3]);
  340. break;
  341. default:
  342. def = CTX::instance()->packColor
  343. (s[i].def1[0], s[i].def1[1], s[i].def1[2], s[i].def1[3]);
  344. break;
  345. }
  346. if(!diff || (s[i].function(num, GMSH_GET, 0) != def)){
  347. sprintf(tmp, "%sColor.%s = {%d,%d,%d};%s%s",
  348. prefix, s[i].str,
  349. CTX::instance()->unpackRed(s[i].function(num, GMSH_GET, 0)),
  350. CTX::instance()->unpackGreen(s[i].function(num, GMSH_GET, 0)),
  351. CTX::instance()->unpackBlue(s[i].function(num, GMSH_GET, 0)),
  352. help ? " // " : "", help ? s[i].help : "");
  353. if(file)
  354. fprintf(file, "%s\n", tmp);
  355. else
  356. Msg::Direct(tmp);
  357. }
  358. }
  359. i++;
  360. }
  361. }
  362. static void PrintColorOptionsDoc(StringXColor s[], const char *prefix, FILE * file)
  363. {
  364. int i = 0;
  365. while(s[i].str) {
  366. fprintf(file, "@item %sColor.%s\n", prefix, s[i].str);
  367. fprintf(file, "%s@*\n", s[i].help);
  368. fprintf(file, "Default value: @code{@{%d,%d,%d@}}@*\n",
  369. CTX::instance()->unpackRed(s[i].function(0, GMSH_GET, 0)),
  370. CTX::instance()->unpackGreen(s[i].function(0, GMSH_GET, 0)),
  371. CTX::instance()->unpackBlue(s[i].function(0, GMSH_GET, 0)));
  372. fprintf(file, "Saved in: @code{%s}\n\n", GetOptionSaveLevel(s[i].level));
  373. i++;
  374. }
  375. }
  376. // General routines
  377. void InitOptions(int num)
  378. {
  379. // Default string options
  380. SetDefaultStringOptions(num, GeneralOptions_String);
  381. SetDefaultStringOptions(num, GeometryOptions_String);
  382. SetDefaultStringOptions(num, MeshOptions_String);
  383. SetDefaultStringOptions(num, SolverOptions_String);
  384. SetDefaultStringOptions(num, PostProcessingOptions_String);
  385. SetDefaultStringOptions(num, ViewOptions_String);
  386. SetDefaultStringOptions(num, PrintOptions_String);
  387. // Default number options
  388. SetDefaultNumberOptions(num, GeneralOptions_Number);
  389. SetDefaultNumberOptions(num, GeometryOptions_Number);
  390. SetDefaultNumberOptions(num, MeshOptions_Number);
  391. SetDefaultNumberOptions(num, SolverOptions_Number);
  392. SetDefaultNumberOptions(num, PostProcessingOptions_Number);
  393. SetDefaultNumberOptions(num, ViewOptions_Number);
  394. SetDefaultNumberOptions(num, PrintOptions_Number);
  395. // Default color options
  396. SetDefaultColorOptions(num, GeneralOptions_Color);
  397. SetDefaultColorOptions(num, GeometryOptions_Color);
  398. SetDefaultColorOptions(num, MeshOptions_Color);
  399. SetDefaultColorOptions(num, SolverOptions_Color);
  400. SetDefaultColorOptions(num, PostProcessingOptions_Color);
  401. SetDefaultColorOptions(num, ViewOptions_Color);
  402. SetDefaultColorOptions(num, PrintOptions_Color);
  403. }
  404. void ReInitOptions(int num)
  405. {
  406. // horrible trick so that opt_view_XXX will act on the reference view
  407. #if defined(HAVE_POST)
  408. std::vector<PView*> tmp = PView::list;
  409. PView::list.clear();
  410. #endif
  411. InitOptions(num);
  412. #if defined(HAVE_POST)
  413. PView::list = tmp;
  414. for(unsigned int i = 0; i < PView::list.size(); i++)
  415. PView::list[i]->setOptions();
  416. #endif
  417. }
  418. void InitOptionsGUI(int num)
  419. {
  420. SetStringOptionsGUI(num, GeneralOptions_String);
  421. SetStringOptionsGUI(num, GeometryOptions_String);
  422. SetStringOptionsGUI(num, MeshOptions_String);
  423. SetStringOptionsGUI(num, SolverOptions_String);
  424. SetStringOptionsGUI(num, PostProcessingOptions_String);
  425. SetStringOptionsGUI(num, PrintOptions_String);
  426. SetNumberOptionsGUI(num, GeneralOptions_Number);
  427. SetNumberOptionsGUI(num, GeometryOptions_Number);
  428. SetNumberOptionsGUI(num, MeshOptions_Number);
  429. SetNumberOptionsGUI(num, SolverOptions_Number);
  430. SetNumberOptionsGUI(num, PostProcessingOptions_Number);
  431. SetNumberOptionsGUI(num, PrintOptions_Number);
  432. SetColorOptionsGUI(num, GeneralOptions_Color);
  433. SetColorOptionsGUI(num, GeometryOptions_Color);
  434. SetColorOptionsGUI(num, MeshOptions_Color);
  435. SetColorOptionsGUI(num, SolverOptions_Color);
  436. SetColorOptionsGUI(num, PostProcessingOptions_Color);
  437. SetColorOptionsGUI(num, PrintOptions_Color);
  438. }
  439. static void PrintOptionCategory(int level, int diff, int help, const char *cat,
  440. FILE *file)
  441. {
  442. if(diff || !help || !(level & GMSH_FULLRC))
  443. return;
  444. if(file) {
  445. fprintf(file, "//\n");
  446. fprintf(file, "// %s\n", cat);
  447. fprintf(file, "//\n");
  448. }
  449. else {
  450. Msg::Direct("//");
  451. Msg::Direct("// %s", cat);
  452. Msg::Direct("//");
  453. }
  454. }
  455. GmshColorTable *GetColorTable(int num)
  456. {
  457. #if defined(HAVE_POST)
  458. PViewOptions *opt;
  459. if(PView::list.empty() || num < 0 || num > (int)PView::list.size() - 1)
  460. opt = PViewOptions::reference();
  461. else{
  462. opt = PView::list[num]->getOptions();
  463. // assume that if we access the colortable we will change it
  464. PView::list[num]->setChanged(true);
  465. }
  466. return &opt->colorTable;
  467. #else
  468. return 0;
  469. #endif
  470. }
  471. static void PrintColorTable(int num, int diff, const char *prefix, FILE *file)
  472. {
  473. #if defined(HAVE_POST)
  474. PViewOptions *opt;
  475. if(PView::list.empty() || num < 0 || num > (int)PView::list.size() - 1)
  476. opt = PViewOptions::reference();
  477. else
  478. opt = PView::list[num]->getOptions();
  479. if(diff){
  480. // compare the current colormap with a vanilla colormap having the
  481. // parameters
  482. GmshColorTable ref;
  483. ColorTable_InitParam(opt->colorTable.ipar[COLORTABLE_NUMBER], &ref);
  484. for(int i = 0; i < COLORTABLE_NBMAX_PARAM; i++){
  485. ref.ipar[i] = opt->colorTable.ipar[i];
  486. ref.dpar[i] = opt->colorTable.dpar[i];
  487. }
  488. ColorTable_Recompute(&ref);
  489. if(!ColorTable_Diff(&ref, &opt->colorTable))
  490. return;
  491. }
  492. char tmp[1024];
  493. sprintf(tmp, "%s = {", prefix);
  494. if(file)
  495. fprintf(file, "%s\n", tmp);
  496. else
  497. Msg::Direct(tmp);
  498. ColorTable_Print(&opt->colorTable, file);
  499. sprintf(tmp, "};");
  500. if(file)
  501. fprintf(file, "%s\n", tmp);
  502. else
  503. Msg::Direct(tmp);
  504. #endif
  505. }
  506. void Sanitize_String_Texi(std::string &s)
  507. {
  508. int i = -1;
  509. while ((i = s.find('\n', i + 1)) >= 0){
  510. s.insert(i, "@*");
  511. i += 2;
  512. }
  513. i = -1;
  514. while ((i = s.find_first_of("{}", i + 1)) >= 0)
  515. s.insert(i++, "@");
  516. }
  517. void PrintOptions(int num, int level, int diff, int help, const char *filename)
  518. {
  519. #if defined(HAVE_FLTK)
  520. if(FlGui::available())
  521. FlGui::instance()->storeCurrentWindowsInfo();
  522. #endif
  523. FILE *file;
  524. if(filename) {
  525. file = fopen(filename, "w");
  526. if(!file) {
  527. Msg::Error("Unable to open file '%s'", filename);
  528. return;
  529. }
  530. }
  531. else
  532. file = 0;
  533. if((level & GMSH_SESSIONRC) && file) {
  534. fprintf(file, "// Gmsh Session File\n");
  535. fprintf(file, "//\n");
  536. fprintf(file, "// This file contains session specific info (that is info you\n");
  537. fprintf(file, "// want to keep between two Gmsh sessions). You are not supposed\n");
  538. fprintf(file, "// to edit it manually, but of course you can. This file will be\n");
  539. fprintf(file, "// entirely rewritten every time you quit Gmsh if the option \n");
  540. fprintf(file, "// 'General.SaveSession' is set.\n");
  541. fprintf(file, "//\n");
  542. }
  543. if((level & GMSH_OPTIONSRC) && file) {
  544. fprintf(file, "// Gmsh Option File\n");
  545. fprintf(file, "//\n");
  546. fprintf(file, "// This file contains configuration options (preferences) that\n");
  547. fprintf(file, "// are loaded each time Gmsh is launched. You can create this\n");
  548. fprintf(file, "// file by hand, or let Gmsh generate it for you (with\n");
  549. fprintf(file, "// 'File->Save Default Options'). This file can also be\n");
  550. fprintf(file, "// automatically saved every time you quit Gmsh if the option\n");
  551. fprintf(file, "// 'General.SaveOptions' is set.\n");
  552. fprintf(file, "//\n");
  553. }
  554. PrintOptionCategory(level, diff, help, "General options (strings)", file);
  555. PrintStringOptions(num, level, diff, help, GeneralOptions_String, "General.", file);
  556. PrintOptionCategory(level, diff, help, "General options (numbers)", file);
  557. PrintNumberOptions(num, level, diff, help, GeneralOptions_Number, "General.", file);
  558. PrintOptionCategory(level, diff, help, "General options (colors)", file);
  559. PrintColorOptions(num, level, diff, help, GeneralOptions_Color, "General.", file);
  560. PrintOptionCategory(level, diff, help, "Geometry options (strings)", file);
  561. PrintStringOptions(num, level, diff, help, GeometryOptions_String, "Geometry.", file);
  562. PrintOptionCategory(level, diff, help, "Geometry options (numbers)", file);
  563. PrintNumberOptions(num, level, diff, help, GeometryOptions_Number, "Geometry.", file);
  564. PrintOptionCategory(level, diff, help, "Geometry options (colors)", file);
  565. PrintColorOptions(num, level, diff, help, GeometryOptions_Color, "Geometry.", file);
  566. PrintOptionCategory(level, diff, help, "Mesh options (strings)", file);
  567. PrintStringOptions(num, level, diff, help, MeshOptions_String, "Mesh.", file);
  568. PrintOptionCategory(level, diff, help, "Mesh options (numbers)", file);
  569. PrintNumberOptions(num, level, diff, help, MeshOptions_Number, "Mesh.", file);
  570. PrintOptionCategory(level, diff, help, "Mesh options (colors)", file);
  571. PrintColorOptions(num, level, diff, help, MeshOptions_Color, "Mesh.", file);
  572. PrintOptionCategory(level, diff, help, "Solver options (strings)", file);
  573. PrintStringOptions(num, level, diff, help, SolverOptions_String, "Solver.", file);
  574. PrintOptionCategory(level, diff, help, "Solver options (numbers)", file);
  575. PrintNumberOptions(num, level, diff, help, SolverOptions_Number, "Solver.", file);
  576. PrintOptionCategory(level, diff, help, "Solver options (colors)", file);
  577. PrintColorOptions(num, level, diff, help, SolverOptions_Color, "Solver.", file);
  578. PrintOptionCategory(level, diff, help, "Post-processing options (strings)", file);
  579. PrintStringOptions(num, level, diff, help, PostProcessingOptions_String,
  580. "PostProcessing.", file);
  581. PrintOptionCategory(level, diff, help, "Post-processing options (numbers)", file);
  582. PrintNumberOptions(num, level, diff, help, PostProcessingOptions_Number,
  583. "PostProcessing.", file);
  584. PrintOptionCategory(level, diff, help, "Post-processing options (colors)", file);
  585. PrintColorOptions(num, level, diff, help, PostProcessingOptions_Color,
  586. "PostProcessing.", file);
  587. if(level & GMSH_FULLRC) {
  588. #if defined(HAVE_POST)
  589. for(unsigned int i = 0; i < PView::list.size(); i++) {
  590. char tmp[256];
  591. sprintf(tmp, "View[%d].", i);
  592. PrintOptionCategory(level, diff, help, "View options (strings)", file);
  593. PrintStringOptions(i, level, diff, help, ViewOptions_String, tmp, file);
  594. PrintOptionCategory(level, diff, help, "View options (numbers)", file);
  595. PrintNumberOptions(i, level, diff, help, ViewOptions_Number, tmp, file);
  596. PrintOptionCategory(level, diff, help, "View options (colors)", file);
  597. PrintColorOptions(i, level, diff, help, ViewOptions_Color, tmp, file);
  598. strcat(tmp, "ColorTable");
  599. PrintColorTable(i, diff, tmp, file);
  600. }
  601. #endif
  602. }
  603. else if(level & GMSH_OPTIONSRC) {
  604. PrintOptionCategory(level, diff, help, "View options (strings)", file);
  605. PrintStringOptions(num, level, diff, help, ViewOptions_String, "View.", file);
  606. PrintOptionCategory(level, diff, help, "View options (numbers)", file);
  607. PrintNumberOptions(num, level, diff, help, ViewOptions_Number, "View.", file);
  608. PrintOptionCategory(level, diff, help, "View options (colors)", file);
  609. PrintColorOptions(num, level, diff, help, ViewOptions_Color, "View.", file);
  610. PrintColorTable(num, diff, "View.ColorTable", file);
  611. }
  612. PrintOptionCategory(level, diff, help, "Print options (strings)", file);
  613. PrintStringOptions(num, level, diff, help, PrintOptions_String, "Print.", file);
  614. PrintOptionCategory(level, diff, help, "Print options (numbers)", file);
  615. PrintNumberOptions(num, level, diff, help, PrintOptions_Number, "Print.", file);
  616. PrintOptionCategory(level, diff, help, "Print options (colors)", file);
  617. PrintColorOptions(num, level, diff, help, PrintOptions_Color, "Print.", file);
  618. if(filename) fclose(file);
  619. }
  620. void PrintOptionsDoc()
  621. {
  622. const char *warn =
  623. "@c\n"
  624. "@c This file is generated automatically by running \"gmsh -doc\".\n"
  625. "@c Do not edit by hand!\n"
  626. "@c\n\n";
  627. FILE *file = fopen("opt_general.texi", "w");
  628. if(!file) {
  629. Msg::Error("Unable to open file 'opt_general.texi'");
  630. return;
  631. }
  632. fprintf(file, "%s@ftable @code\n", warn);
  633. PrintStringOptionsDoc(GeneralOptions_String, "General.", file);
  634. PrintNumberOptionsDoc(GeneralOptions_Number, "General.", file);
  635. PrintColorOptionsDoc(GeneralOptions_Color, "General.", file);
  636. fprintf(file, "@end ftable\n");
  637. fclose(file);
  638. file = fopen("opt_print.texi", "w");
  639. if(!file) {
  640. Msg::Error("Unable to open file 'opt_print.texi'");
  641. return;
  642. }
  643. fprintf(file, "%s@ftable @code\n", warn);
  644. PrintStringOptionsDoc(PrintOptions_String, "Print.", file);
  645. PrintNumberOptionsDoc(PrintOptions_Number, "Print.", file);
  646. PrintColorOptionsDoc(PrintOptions_Color, "Print.", file);
  647. fprintf(file, "@end ftable\n");
  648. fclose(file);
  649. file = fopen("opt_geometry.texi", "w");
  650. if(!file) {
  651. Msg::Error("Unable to open file 'opt_geometry.texi'");
  652. return;
  653. }
  654. fprintf(file, "%s@ftable @code\n", warn);
  655. PrintStringOptionsDoc(GeometryOptions_String, "Geometry.", file);
  656. PrintNumberOptionsDoc(GeometryOptions_Number, "Geometry.", file);
  657. PrintColorOptionsDoc(GeometryOptions_Color, "Geometry.", file);
  658. fprintf(file, "@end ftable\n");
  659. fclose(file);
  660. file = fopen("opt_mesh.texi", "w");
  661. if(!file) {
  662. Msg::Error("Unable to open file 'opt_mesh.texi'");
  663. return;
  664. }
  665. fprintf(file, "%s@ftable @code\n", warn);
  666. PrintStringOptionsDoc(MeshOptions_String, "Mesh.", file);
  667. PrintNumberOptionsDoc(MeshOptions_Number, "Mesh.", file);
  668. PrintColorOptionsDoc(MeshOptions_Color, "Mesh.", file);
  669. fprintf(file, "@end ftable\n");
  670. fclose(file);
  671. file = fopen("opt_solver.texi", "w");
  672. if(!file) {
  673. Msg::Error("Unable to open file 'opt_solver.texi'");
  674. return;
  675. }
  676. fprintf(file, "%s@ftable @code\n", warn);
  677. PrintStringOptionsDoc(SolverOptions_String, "Solver.", file);
  678. PrintNumberOptionsDoc(SolverOptions_Number, "Solver.", file);
  679. PrintColorOptionsDoc(SolverOptions_Color, "Solver.", file);
  680. fprintf(file, "@end ftable\n");
  681. fclose(file);
  682. file = fopen("opt_post.texi", "w");
  683. if(!file) {
  684. Msg::Error("Unable to open file 'opt_post.texi'");
  685. return;
  686. }
  687. fprintf(file, "%s@ftable @code\n", warn);
  688. PrintStringOptionsDoc(PostProcessingOptions_String, "PostProcessing.", file);
  689. PrintNumberOptionsDoc(PostProcessingOptions_Number, "PostProcessing.", file);
  690. PrintColorOptionsDoc(PostProcessingOptions_Color, "PostProcessing.", file);
  691. fprintf(file, "@end ftable\n");
  692. fclose(file);
  693. #if defined(HAVE_POST)
  694. file = fopen("opt_view.texi", "w");
  695. if(!file) {
  696. Msg::Error("Unable to open file 'opt_view.texi'");
  697. return;
  698. }
  699. fprintf(file, "%s@ftable @code\n", warn);
  700. PrintStringOptionsDoc(ViewOptions_String, "View.", file);
  701. PrintNumberOptionsDoc(ViewOptions_Number, "View.", file);
  702. PrintColorOptionsDoc(ViewOptions_Color, "View.", file);
  703. fprintf(file, "@item View.ColorTable\n");
  704. fprintf(file, "Color table used to draw the view@*\n");
  705. fprintf(file, "Saved in: @code{%s}\n\n",
  706. GetOptionSaveLevel(GMSH_FULLRC|GMSH_OPTIONSRC));
  707. fprintf(file, "@end ftable\n");
  708. fclose(file);
  709. #endif
  710. #if defined(HAVE_PLUGINS)
  711. file = fopen("opt_plugin.texi", "w");
  712. if(!file) {
  713. Msg::Error("Unable to open file 'opt_plugin.texi'");
  714. return;
  715. }
  716. fprintf(file, "%s@ftable @code\n", warn);
  717. for(std::map<std::string, GMSH_Plugin*>::iterator it = PluginManager::
  718. instance()->begin(); it != PluginManager::instance()->end(); ++it) {
  719. GMSH_Plugin *p = it->second;
  720. if(p->getType() == GMSH_Plugin::GMSH_POST_PLUGIN) {
  721. fprintf(file, "@item Plugin(%s)\n", p->getName().c_str());
  722. fprintf(file, "%s\n", p->getHelp().c_str());
  723. int m = p->getNbOptionsStr();
  724. if(m){
  725. fprintf(file, "String options:\n");
  726. fprintf(file, "@table @code\n");
  727. for(int i = 0; i < m; i++) {
  728. StringXString *sxs = p->getOptionStr(i);
  729. fprintf(file, "@item %s\n", sxs->str);
  730. fprintf(file, "Default value: @code{\"%s\"}\n", sxs->def.c_str());
  731. }
  732. fprintf(file, "@end table\n");
  733. }
  734. int n = p->getNbOptions();
  735. if(n){
  736. fprintf(file, "Numeric options:\n");
  737. fprintf(file, "@table @code\n");
  738. for(int i = 0; i < n; i++) {
  739. StringXNumber *sxn = p->getOption(i);
  740. fprintf(file, "@item %s\n", sxn->str);
  741. fprintf(file, "Default value: @code{%g}\n", sxn->def);
  742. }
  743. fprintf(file, "@end table\n");
  744. }
  745. }
  746. fprintf(file, "\n");
  747. }
  748. fprintf(file, "@end ftable\n");
  749. fclose(file);
  750. #endif
  751. #if defined(HAVE_MESH)
  752. file = fopen("opt_fields.texi", "w");
  753. if(!file) {
  754. Msg::Error("Unable to open file 'opt_fields.texi'");
  755. return;
  756. }
  757. fprintf(file, "%s@ftable @code\n", warn);
  758. FieldManager &fields = *GModel::current()->getFields();
  759. for(std::map<std::string, FieldFactory*>::iterator it = fields.map_type_name.begin();
  760. it != fields.map_type_name.end(); it++){
  761. fprintf(file, "@item %s\n", it->first.c_str());
  762. Field *f = (*it->second)();
  763. std::string field_description = f->getDescription();
  764. Sanitize_String_Texi(field_description);
  765. fprintf(file,"%s@*\n", field_description.c_str());
  766. if (!f->options.empty()) {
  767. fprintf(file, "Options:@*\n");
  768. fprintf(file, "@table @code\n");
  769. for(std::map<std::string, FieldOption*>::iterator it2 = f->options.begin();
  770. it2 != f->options.end(); it2++){
  771. fprintf(file, "@item %s\n", it2->first.c_str());
  772. std::string val;
  773. it2->second->getTextRepresentation(val);
  774. Sanitize_String_Texi(val);
  775. fprintf(file, "%s@*\ntype: %s@*\ndefault value: @code{%s}\n",
  776. it2->second->getDescription().c_str(),
  777. it2->second->getTypeName().c_str(), val.c_str());
  778. }
  779. fprintf(file, "@end table\n\n");
  780. }
  781. if (!f->callbacks.empty()) {
  782. fprintf(file, "Actions:@*\n");
  783. fprintf(file, "@table @code\n");
  784. for(std::map<std::string, FieldCallback*>::iterator it2 = f->callbacks.begin();
  785. it2 != f->callbacks.end(); it2++){
  786. fprintf(file, "@item %s\n", it2->first.c_str());
  787. fprintf(file, "%s@*\n", it2->second->getDescription().c_str());
  788. }
  789. fprintf(file, "@end table\n\n");
  790. }
  791. }
  792. fprintf(file, "@end ftable\n");
  793. fclose(file);
  794. #endif
  795. }
  796. #define GET_VIEW(error_val) \
  797. PView *view = 0; \
  798. PViewData *data = 0; \
  799. PViewOptions *opt; \
  800. if(PView::list.empty()) \
  801. opt = PViewOptions::reference(); \
  802. else{ \
  803. if(num < 0 || num >= (int)PView::list.size()){ \
  804. Msg::Warning("View[%d] does not exist", num); \
  805. return (error_val); \
  806. } \
  807. view = PView::list[num]; \
  808. data = view->getData(); \
  809. opt = view->getOptions(); \
  810. }
  811. #define GET_VIEWo(error_val) \
  812. PView *view = 0; \
  813. PViewOptions *opt; \
  814. if(PView::list.empty()) \
  815. opt = PViewOptions::reference(); \
  816. else{ \
  817. if(num < 0 || num >= (int)PView::list.size()){ \
  818. Msg::Warning("View[%d] does not exist", num); \
  819. return (error_val); \
  820. } \
  821. view = PView::list[num]; \
  822. opt = view->getOptions(); \
  823. }
  824. #define GET_VIEWd(error_val) \
  825. PView *view = 0; \
  826. PViewData *data = 0; \
  827. if(!PView::list.empty()){ \
  828. if(num < 0 || num >= (int)PView::list.size()){ \
  829. Msg::Warning("View[%d] does not exist", num); \
  830. return (error_val); \
  831. } \
  832. view = PView::list[num]; \
  833. data = view->getData(); \
  834. }
  835. // String option routines
  836. std::string opt_general_axes_label0(OPT_ARGS_STR)
  837. {
  838. if(action & GMSH_SET)
  839. CTX::instance()->axesLabel[0] = val;
  840. #if defined(HAVE_FLTK)
  841. if(FlGui::available() && (action & GMSH_GUI))
  842. FlGui::instance()->options->general.input[6]->value
  843. (CTX::instance()->axesLabel[0].c_str());
  844. #endif
  845. return CTX::instance()->axesLabel[0];
  846. }
  847. std::string opt_general_axes_label1(OPT_ARGS_STR)
  848. {
  849. if(action & GMSH_SET)
  850. CTX::instance()->axesLabel[1] = val;
  851. #if defined(HAVE_FLTK)
  852. if(FlGui::available() && (action & GMSH_GUI))
  853. FlGui::instance()->options->general.input[7]->value
  854. (CTX::instance()->axesLabel[1].c_str());
  855. #endif
  856. return CTX::instance()->axesLabel[1];
  857. }
  858. std::string opt_general_axes_label2(OPT_ARGS_STR)
  859. {
  860. if(action & GMSH_SET)
  861. CTX::instance()->axesLabel[2] = val;
  862. #if defined(HAVE_FLTK)
  863. if(FlGui::available() && (action & GMSH_GUI))
  864. FlGui::instance()->options->general.input[8]->value
  865. (CTX::instance()->axesLabel[2].c_str());
  866. #endif
  867. return CTX::instance()->axesLabel[2];
  868. }
  869. std::string opt_general_axes_format0(OPT_ARGS_STR)
  870. {
  871. if(action & GMSH_SET)
  872. CTX::instance()->axesFormat[0] = val;
  873. #if defined(HAVE_FLTK)
  874. if(FlGui::available() && (action & GMSH_GUI))
  875. FlGui::instance()->options->general.input[3]->value
  876. (CTX::instance()->axesFormat[0].c_str());
  877. #endif
  878. return CTX::instance()->axesFormat[0];
  879. }
  880. std::string opt_general_axes_format1(OPT_ARGS_STR)
  881. {
  882. if(action & GMSH_SET)
  883. CTX::instance()->axesFormat[1] = val;
  884. #if defined(HAVE_FLTK)
  885. if(FlGui::available() && (action & GMSH_GUI))
  886. FlGui::instance()->options->general.input[4]->value
  887. (CTX::instance()->axesFormat[1].c_str());
  888. #endif
  889. return CTX::instance()->axesFormat[1];
  890. }
  891. std::string opt_general_axes_format2(OPT_ARGS_STR)
  892. {
  893. if(action & GMSH_SET)
  894. CTX::instance()->axesFormat[2] = val;
  895. #if defined(HAVE_FLTK)
  896. if(FlGui::available() && (action & GMSH_GUI))
  897. FlGui::instance()->options->general.input[5]->value
  898. (CTX::instance()->axesFormat[2].c_str());
  899. #endif
  900. return CTX::instance()->axesFormat[2];
  901. }
  902. std::string opt_general_display(OPT_ARGS_STR)
  903. {
  904. if(action & GMSH_SET)
  905. CTX::instance()->display = val;
  906. return CTX::instance()->display;
  907. }
  908. std::string opt_general_background_image_filename(OPT_ARGS_STR)
  909. {
  910. if(action & GMSH_SET)
  911. CTX::instance()->bgImageFileName = val;
  912. return CTX::instance()->bgImageFileName;
  913. }
  914. std::string opt_general_filename(OPT_ARGS_STR)
  915. {
  916. return GModel::current()->getFileName();
  917. }
  918. std::string opt_general_default_filename(OPT_ARGS_STR)
  919. {
  920. if(action & GMSH_SET)
  921. CTX::instance()->defaultFileName = val;
  922. #if defined(HAVE_FLTK)
  923. if(FlGui::available() && (action & GMSH_GUI))
  924. FlGui::instance()->options->general.input[0]->value
  925. (CTX::instance()->defaultFileName.c_str());
  926. #endif
  927. return CTX::instance()->defaultFileName;
  928. }
  929. std::string opt_general_tmp_filename(OPT_ARGS_STR)
  930. {
  931. if(action & GMSH_SET)
  932. CTX::instance()->tmpFileName = val;
  933. return CTX::instance()->tmpFileName;
  934. }
  935. std::string opt_general_error_filename(OPT_ARGS_STR)
  936. {
  937. if(action & GMSH_SET)
  938. CTX::instance()->errorFileName = val;
  939. return CTX::instance()->errorFileName;
  940. }
  941. std::string opt_general_session_filename(OPT_ARGS_STR)
  942. {
  943. if(action & GMSH_SET)
  944. CTX::instance()->sessionFileName = val;
  945. return CTX::instance()->sessionFileName;
  946. }
  947. std::string opt_general_options_filename(OPT_ARGS_STR)
  948. {
  949. if(action & GMSH_SET)
  950. CTX::instance()->optionsFileName = val;
  951. return CTX::instance()->optionsFileName;
  952. }
  953. std::string opt_general_recent_file0(OPT_ARGS_STR)
  954. {
  955. if(action & GMSH_SET)
  956. CTX::instance()->recentFiles[0] = val;
  957. return CTX::instance()->recentFiles[0];
  958. }
  959. std::string opt_general_recent_file1(OPT_ARGS_STR)
  960. {
  961. if(action & GMSH_SET)
  962. CTX::instance()->recentFiles[1] = val;
  963. return CTX::instance()->recentFiles[1];
  964. }
  965. std::string opt_general_recent_file2(OPT_ARGS_STR)
  966. {
  967. if(action & GMSH_SET)
  968. CTX::instance()->recentFiles[2] = val;
  969. return CTX::instance()->recentFiles[2];
  970. }
  971. std::string opt_general_recent_file3(OPT_ARGS_STR)
  972. {
  973. if(action & GMSH_SET)
  974. CTX::instance()->recentFiles[3] = val;
  975. return CTX::instance()->recentFiles[3];
  976. }
  977. std::string opt_general_recent_file4(OPT_ARGS_STR)
  978. {
  979. if(action & GMSH_SET)
  980. CTX::instance()->recentFiles[4] = val;
  981. return CTX::instance()->recentFiles[4];
  982. }
  983. std::string opt_general_editor(OPT_ARGS_STR)
  984. {
  985. if(action & GMSH_SET)
  986. CTX::instance()->editor = val;
  987. #if defined(HAVE_FLTK)
  988. if(FlGui::available() && (action & GMSH_GUI))
  989. FlGui::instance()->options->general.input[1]->value
  990. (CTX::instance()->editor.c_str());
  991. #endif
  992. return CTX::instance()->editor;
  993. }
  994. std::string opt_general_web_browser(OPT_ARGS_STR)
  995. {
  996. if(action & GMSH_SET)
  997. CTX::instance()->webBrowser = val;
  998. #if defined(HAVE_FLTK)
  999. if(FlGui::available() && (action & GMSH_GUI))
  1000. FlGui::instance()->options->general.input[2]->value
  1001. (CTX::instance()->webBrowser.c_str());
  1002. #endif
  1003. return CTX::instance()->webBrowser;
  1004. }
  1005. std::string opt_general_watch_file_pattern(OPT_ARGS_STR)
  1006. {
  1007. if(action & GMSH_SET)
  1008. CTX::instance()->watchFilePattern = val;
  1009. return CTX::instance()->watchFilePattern;
  1010. }
  1011. std::string opt_general_gui_theme(OPT_ARGS_STR)
  1012. {
  1013. if(action & GMSH_SET)
  1014. CTX::instance()->guiTheme = val;
  1015. return CTX::instance()->guiTheme;
  1016. }
  1017. std::string opt_general_graphics_font(OPT_ARGS_STR)
  1018. {
  1019. if(action & GMSH_SET)
  1020. CTX::instance()->glFont = val;
  1021. #if defined(HAVE_FLTK)
  1022. int index = drawContext::global()->getFontIndex(CTX::instance()->glFont.c_str());
  1023. if(action & GMSH_SET){
  1024. CTX::instance()->glFont = drawContext::global()->getFontName(index);
  1025. CTX::instance()->glFontEnum = drawContext::global()->getFontEnum(index);
  1026. }
  1027. if(FlGui::available() && (action & GMSH_GUI)){
  1028. FlGui::instance()->options->general.choice[1]->value(index);
  1029. }
  1030. #endif
  1031. return CTX::instance()->glFont;
  1032. }
  1033. std::string opt_general_graphics_font_title(OPT_ARGS_STR)
  1034. {
  1035. if(action & GMSH_SET)
  1036. CTX::instance()->glFontTitle = val;
  1037. #if defined(HAVE_FLTK)
  1038. int index = drawContext::global()->getFontIndex(CTX::instance()->glFontTitle.c_str());
  1039. if(action & GMSH_SET){
  1040. CTX::instance()->glFontTitle = drawContext::global()->getFontName(index);
  1041. CTX::instance()->glFontEnumTitle = drawContext::global()->getFontEnum(index);
  1042. }
  1043. if(FlGui::available() && (action & GMSH_GUI)){
  1044. FlGui::instance()->options->general.choice[6]->value(index);
  1045. }
  1046. #endif
  1047. return CTX::instance()->glFontTitle;
  1048. }
  1049. std::string opt_solver_socket_name(OPT_ARGS_STR)
  1050. {
  1051. if(action & GMSH_SET)
  1052. CTX::instance()->solver.socketName = val;
  1053. #if defined(HAVE_FLTK)
  1054. if(FlGui::available() && (action & GMSH_GUI))
  1055. FlGui::instance()->options->solver.input[0]->value
  1056. (CTX::instance()->solver.socketName.c_str());
  1057. #endif
  1058. return CTX::instance()->solver.socketName;
  1059. }
  1060. std::string opt_solver_name(OPT_ARGS_STR)
  1061. {
  1062. if(action & GMSH_SET)
  1063. CTX::instance()->solver.name[num] = val;
  1064. return CTX::instance()->solver.name[num];
  1065. }
  1066. std::string opt_solver_name0(OPT_ARGS_STR)
  1067. {
  1068. return opt_solver_name(0, action, val);
  1069. }
  1070. std::string opt_solver_name1(OPT_ARGS_STR)
  1071. {
  1072. return opt_solver_name(1, action, val);
  1073. }
  1074. std::string opt_solver_name2(OPT_ARGS_STR)
  1075. {
  1076. return opt_solver_name(2, action, val);
  1077. }
  1078. std::string opt_solver_name3(OPT_ARGS_STR)
  1079. {
  1080. return opt_solver_name(3, action, val);
  1081. }
  1082. std::string opt_solver_name4(OPT_ARGS_STR)
  1083. {
  1084. return opt_solver_name(4, action, val);
  1085. }
  1086. std::string opt_solver_executable(OPT_ARGS_STR)
  1087. {
  1088. if(action & GMSH_SET)
  1089. CTX::instance()->solver.executable[num] = val;
  1090. return CTX::instance()->solver.executable[num];
  1091. }
  1092. std::string opt_solver_executable0(OPT_ARGS_STR)
  1093. {
  1094. return opt_solver_executable(0, action, val);
  1095. }
  1096. std::string opt_solver_executable1(OPT_ARGS_STR)
  1097. {
  1098. return opt_solver_executable(1, action, val);
  1099. }
  1100. std::string opt_solver_executable2(OPT_ARGS_STR)
  1101. {
  1102. return opt_solver_executable(2, action, val);
  1103. }
  1104. std::string opt_solver_executable3(OPT_ARGS_STR)
  1105. {
  1106. return opt_solver_executable(3, action, val);
  1107. }
  1108. std::string opt_solver_executable4(OPT_ARGS_STR)
  1109. {
  1110. return opt_solver_executable(4, action, val);
  1111. }
  1112. std::string opt_solver_remote_login(OPT_ARGS_STR)
  1113. {
  1114. if(action & GMSH_SET)
  1115. CTX::instance()->solver.remoteLogin[num] = val;
  1116. return CTX::instance()->solver.remoteLogin[num];
  1117. }
  1118. std::string opt_solver_remote_login0(OPT_ARGS_STR)
  1119. {
  1120. return opt_solver_remote_login(0, action, val);
  1121. }
  1122. std::string opt_solver_remote_login1(OPT_ARGS_STR)
  1123. {
  1124. return opt_solver_remote_login(1, action, val);
  1125. }
  1126. std::string opt_solver_remote_login2(OPT_ARGS_STR)
  1127. {
  1128. return opt_solver_remote_login(2, action, val);
  1129. }
  1130. std::string opt_solver_remote_login3(OPT_ARGS_STR)
  1131. {
  1132. return opt_solver_remote_login(3, action, val);
  1133. }
  1134. std::string opt_solver_remote_login4(OPT_ARGS_STR)
  1135. {
  1136. return opt_solver_remote_login(4, action, val);
  1137. }
  1138. #if defined(HAVE_FLTK)
  1139. int _gui_action_valid(int action, int num)
  1140. {
  1141. if(!FlGui::available()) return 0;
  1142. return (action & GMSH_GUI) && (num == FlGui::instance()->options->view.index);
  1143. }
  1144. #endif
  1145. std::string opt_view_name(OPT_ARGS_STR)
  1146. {
  1147. #if defined(HAVE_POST)
  1148. GET_VIEWd("");
  1149. if(!data) return "";
  1150. if(action & GMSH_SET) {
  1151. data->setName(val);
  1152. #if defined(HAVE_FLTK)
  1153. // change name in GUI for the view and its aliases
  1154. if(FlGui::available()){
  1155. for(int i = 0; i < (int)PView::list.size(); i++){
  1156. if((i == num ||
  1157. PView::list[i]->getAliasOf() == view->getNum() ||
  1158. PView::list[i]->getNum() == view->getAliasOf()) &&
  1159. FlGui::instance()->onelab->getViewButton(i)) {
  1160. FlGui::instance()->onelab->getViewButton(i)->copy_label(data->getName());
  1161. FlGui::instance()->onelab->getViewButton(i)->redraw();
  1162. }
  1163. }
  1164. }
  1165. #endif
  1166. }
  1167. #if defined(HAVE_FLTK)
  1168. if(_gui_action_valid(action, num)) {
  1169. FlGui::instance()->options->view.input[0]->value(data->getName().c_str());
  1170. }
  1171. #endif
  1172. return data->getName();
  1173. #else
  1174. return "";
  1175. #endif
  1176. }
  1177. std::string opt_view_format(OPT_ARGS_STR)
  1178. {
  1179. #if defined(HAVE_POST)
  1180. GET_VIEWo("");
  1181. if(action & GMSH_SET) {
  1182. opt->format = val;
  1183. }
  1184. #if defined(HAVE_FLTK)
  1185. if(_gui_action_valid(action, num))
  1186. FlGui::instance()->options->view.input[1]->value(opt->format.c_str());
  1187. #endif
  1188. return opt->format;
  1189. #else
  1190. return "";
  1191. #endif
  1192. }
  1193. std::string opt_view_filename(OPT_ARGS_STR)
  1194. {
  1195. #if defined(HAVE_POST)
  1196. GET_VIEWd("");
  1197. if(!data) return "";
  1198. return data->getFileName();
  1199. #else
  1200. return "";
  1201. #endif
  1202. }
  1203. std::string opt_view_axes_label0(OPT_ARGS_STR)
  1204. {
  1205. #if defined(HAVE_POST)
  1206. GET_VIEWo("");
  1207. if(action & GMSH_SET) {
  1208. opt->axesLabel[0] = val;
  1209. }
  1210. #if defined(HAVE_FLTK)
  1211. if(_gui_action_valid(action, num))
  1212. FlGui::instance()->options->view.input[10]->value(opt->axesLabel[0].c_str());
  1213. #endif
  1214. return opt->axesLabel[0];
  1215. #else
  1216. return "";
  1217. #endif
  1218. }
  1219. std::string opt_view_axes_label1(OPT_ARGS_STR)
  1220. {
  1221. #if defined(HAVE_POST)
  1222. GET_VIEWo("");
  1223. if(action & GMSH_SET) {
  1224. opt->axesLabel[1] = val;
  1225. }
  1226. #if defined(HAVE_FLTK)
  1227. if(_gui_action_valid(action, num))
  1228. FlGui::instance()->options->view.input[11]->value(opt->axesLabel[1].c_str());
  1229. #endif
  1230. return opt->axesLabel[1];
  1231. #else
  1232. return "";
  1233. #endif
  1234. }
  1235. std::string opt_view_axes_label2(OPT_ARGS_STR)
  1236. {
  1237. #if defined(HAVE_POST)
  1238. GET_VIEWo("");
  1239. if(action & GMSH_SET) {
  1240. opt->axesLabel[2] = val;
  1241. }
  1242. #if defined(HAVE_FLTK)
  1243. if(_gui_action_valid(action, num))
  1244. FlGui::instance()->options->view.input[12]->value(opt->axesLabel[2].c_str());
  1245. #endif
  1246. return opt->axesLabel[2];
  1247. #else
  1248. return "";
  1249. #endif
  1250. }
  1251. std::string opt_view_axes_format0(OPT_ARGS_STR)
  1252. {
  1253. #if defined(HAVE_POST)
  1254. GET_VIEWo("");
  1255. if(action & GMSH_SET) {
  1256. opt->axesFormat[0] = val;
  1257. }
  1258. #if defined(HAVE_FLTK)
  1259. if(_gui_action_valid(action, num))
  1260. FlGui::instance()->options->view.input[7]->value(opt->axesFormat[0].c_str());
  1261. #endif
  1262. return opt->axesFormat[0];
  1263. #else
  1264. return "";
  1265. #endif
  1266. }
  1267. std::string opt_view_axes_format1(OPT_ARGS_STR)
  1268. {
  1269. #if defined(HAVE_POST)
  1270. GET_VIEWo("");
  1271. if(action & GMSH_SET) {
  1272. opt->axesFormat[1] = val;
  1273. }
  1274. #if defined(HAVE_FLTK)
  1275. if(_gui_action_valid(action, num))
  1276. FlGui::instance()->options->view.input[8]->value(opt->axesFormat[1].c_str());
  1277. #endif
  1278. return opt->axesFormat[1];
  1279. #else
  1280. return "";
  1281. #endif
  1282. }
  1283. std::string opt_view_axes_format2(OPT_ARGS_STR)
  1284. {
  1285. #if defined(HAVE_POST)
  1286. GET_VIEWo("");
  1287. if(action & GMSH_SET) {
  1288. opt->axesFormat[2] = val;
  1289. }
  1290. #if defined(HAVE_FLTK)
  1291. if(_gui_action_valid(action, num))
  1292. FlGui::instance()->options->view.input[9]->value(opt->axesFormat[2].c_str());
  1293. #endif
  1294. return opt->axesFormat[2];
  1295. #else
  1296. return "";
  1297. #endif
  1298. }
  1299. std::string opt_view_gen_raise0(OPT_ARGS_STR)
  1300. {
  1301. #if defined(HAVE_POST)
  1302. GET_VIEWo("");
  1303. if(action & GMSH_SET) {
  1304. opt->genRaiseX = val;
  1305. if(view) view->setChanged(true);
  1306. }
  1307. #if defined(HAVE_FLTK)
  1308. if(_gui_action_valid(action, num))
  1309. FlGui::instance()->options->view.input[4]->value(opt->genRaiseX.c_str());
  1310. #endif
  1311. return opt->genRaiseX;
  1312. #else
  1313. return "";
  1314. #endif
  1315. }
  1316. std::string opt_view_gen_raise1(OPT_ARGS_STR)
  1317. {
  1318. #if defined(HAVE_POST)
  1319. GET_VIEWo("");
  1320. if(action & GMSH_SET) {
  1321. opt->genRaiseY = val;
  1322. if(view) view->setChanged(true);
  1323. }
  1324. #if defined(HAVE_FLTK)
  1325. if(_gui_action_valid(action, num))
  1326. FlGui::instance()->options->view.input[5]->value(opt->genRaiseY.c_str());
  1327. #endif
  1328. return opt->genRaiseY;
  1329. #else
  1330. return "";
  1331. #endif
  1332. }
  1333. std::string opt_view_gen_raise2(OPT_ARGS_STR)
  1334. {
  1335. #if defined(HAVE_POST)
  1336. GET_VIEWo("");
  1337. if(action & GMSH_SET) {
  1338. opt->genRaiseZ = val;
  1339. if(view) view->setChanged(true);
  1340. }
  1341. #if defined(HAVE_FLTK)
  1342. if(_gui_action_valid(action, num))
  1343. FlGui::instance()->options->view.input[6]->value(opt->genRaiseZ.c_str());
  1344. #endif
  1345. return opt->genRaiseZ;
  1346. #else
  1347. return "";
  1348. #endif
  1349. }
  1350. int _h2d(char c)
  1351. {
  1352. switch(c){
  1353. case 'a': case 'A': return 10;
  1354. case 'b': case 'B': return 11;
  1355. case 'c': case 'C': return 12;
  1356. case 'd': case 'D': return 13;
  1357. case 'e': case 'E': return 14;
  1358. case 'f': case 'F': return 15;
  1359. default :
  1360. if(c >= '0' && c <= '9')
  1361. return c - '0';
  1362. else
  1363. return 0;
  1364. }
  1365. }
  1366. void _string2stipple(std::string str, int &repeat, int &pattern)
  1367. {
  1368. // "n*0xabcd"
  1369. if(str.size() < 8){
  1370. repeat = 1;
  1371. pattern = 0xFFFF;
  1372. }
  1373. else if(str[1] != '*' || str[2] != '0' || str[3] != 'x'){
  1374. // bad format
  1375. repeat = 1;
  1376. pattern = 0xFFFF;
  1377. }
  1378. else{
  1379. repeat = (int)str[0] - '0';
  1380. pattern = 16 * 16 * 16 * _h2d(str[4]) + 16 * 16 * _h2d(str[5]) +
  1381. 16 * _h2d(str[6]) + _h2d(str[7]);
  1382. }
  1383. }
  1384. std::string opt_view_stipple0(OPT_ARGS_STR)
  1385. {
  1386. #if defined(HAVE_POST)
  1387. GET_VIEWo("");
  1388. if(action & GMSH_SET) {
  1389. opt->stippleString[0] = val;
  1390. _string2stipple(opt->stippleString[0], opt->stipple[0][0], opt->stipple[0][1]);
  1391. }
  1392. return opt->stippleString[0];
  1393. #else
  1394. return "";
  1395. #endif
  1396. }
  1397. std::string opt_view_stipple1(OPT_ARGS_STR)
  1398. {
  1399. #if defined(HAVE_POST)
  1400. GET_VIEWo("");
  1401. if(action & GMSH_SET) {
  1402. opt->stippleString[1] = val;
  1403. _string2stipple(opt->stippleString[1], opt->stipple[1][0], opt->stipple[1][1]);
  1404. }
  1405. return opt->stippleString[1];
  1406. #else
  1407. return "";
  1408. #endif
  1409. }
  1410. std::string opt_view_stipple2(OPT_ARGS_STR)
  1411. {
  1412. #if defined(HAVE_POST)
  1413. GET_VIEWo("");
  1414. if(action & GMSH_SET) {
  1415. opt->stippleString[2] = val;
  1416. _string2stipple(opt->stippleString[2], opt->stipple[2][0], opt->stipple[2][1]);
  1417. }
  1418. return opt->stippleString[2];
  1419. #else
  1420. return "";
  1421. #endif
  1422. }
  1423. std::string opt_view_stipple3(OPT_ARGS_STR)
  1424. {
  1425. #if defined(HAVE_POST)
  1426. GET_VIEWo("");
  1427. if(action & GMSH_SET) {
  1428. opt->stippleString[3] = val;
  1429. _string2stipple(opt->stippleString[3], opt->stipple[3][0], opt->stipple[3][1]);
  1430. }
  1431. return opt->stippleString[3];
  1432. #else
  1433. return "";
  1434. #endif
  1435. }
  1436. std::string opt_view_stipple4(OPT_ARGS_STR)
  1437. {
  1438. #if defined(HAVE_POST)
  1439. GET_VIEWo("");
  1440. if(action & GMSH_SET) {
  1441. opt->stippleString[4] = val;
  1442. _string2stipple(opt->stippleString[4], opt->stipple[4][0], opt->stipple[4][1]);
  1443. }
  1444. return opt->stippleString[4];
  1445. #else
  1446. return "";
  1447. #endif
  1448. }
  1449. std::string opt_view_stipple5(OPT_ARGS_STR)
  1450. {
  1451. #if defined(HAVE_POST)
  1452. GET_VIEWo("");
  1453. if(action & GMSH_SET) {
  1454. opt->stippleString[5] = val;
  1455. _string2stipple(opt->stippleString[5], opt->stipple[5][0], opt->stipple[5][1]);
  1456. }
  1457. return opt->stippleString[5];
  1458. #else
  1459. return "";
  1460. #endif
  1461. }
  1462. std::string opt_view_stipple6(OPT_ARGS_STR)
  1463. {
  1464. #if defined(HAVE_POST)
  1465. GET_VIEWo("");
  1466. if(action & GMSH_SET) {
  1467. opt->stippleString[6] = val;
  1468. _string2stipple(opt->stippleString[6], opt->stipple[6][0], opt->stipple[6][1]);
  1469. }
  1470. return opt->stippleString[6];
  1471. #else
  1472. return "";
  1473. #endif
  1474. }
  1475. std::string opt_view_stipple7(OPT_ARGS_STR)
  1476. {
  1477. #if defined(HAVE_POST)
  1478. GET_VIEWo("");
  1479. if(action & GMSH_SET) {
  1480. opt->stippleString[7] = val;
  1481. _string2stipple(opt->stippleString[7], opt->stipple[7][0], opt->stipple[7][1]);
  1482. }
  1483. return opt->stippleString[7];
  1484. #else
  1485. return "";
  1486. #endif
  1487. }
  1488. std::string opt_view_stipple8(OPT_ARGS_STR)
  1489. {
  1490. #if defined(HAVE_POST)
  1491. GET_VIEWo("");
  1492. if(action & GMSH_SET) {
  1493. opt->stippleString[8] = val;
  1494. _string2stipple(opt->stippleString[8], opt->stipple[8][0], opt->stipple[8][1]);
  1495. }
  1496. return opt->stippleString[8];
  1497. #else
  1498. return "";
  1499. #endif
  1500. }
  1501. std::string opt_view_stipple9(OPT_ARGS_STR)
  1502. {
  1503. #if defined(HAVE_POST)
  1504. GET_VIEWo("");
  1505. if(action & GMSH_SET) {
  1506. opt->stippleString[9] = val;
  1507. _string2stipple(opt->stippleString[9], opt->stipple[9][0], opt->stipple[9][1]);
  1508. }
  1509. return opt->stippleString[9];
  1510. #else
  1511. return "";
  1512. #endif
  1513. }
  1514. std::string opt_view_attributes(OPT_ARGS_STR)
  1515. {
  1516. #if defined(HAVE_POST)
  1517. GET_VIEWo("");
  1518. if(action & GMSH_SET)
  1519. opt->attributes = val;
  1520. return opt->attributes;
  1521. #else
  1522. return "";
  1523. #endif
  1524. }
  1525. // Numeric option routines
  1526. double opt_general_initial_context(OPT_ARGS_NUM)
  1527. {
  1528. if(action & GMSH_SET)
  1529. CTX::instance()->initialContext = (int)val;
  1530. return CTX::instance()->initialContext;
  1531. }
  1532. double opt_general_fontsize(OPT_ARGS_NUM)
  1533. {
  1534. if(action & GMSH_SET)
  1535. CTX::instance()->fontSize = (int)val;
  1536. return CTX::instance()->fontSize;
  1537. }
  1538. double opt_general_graphics_fontsize(OPT_ARGS_NUM)
  1539. {
  1540. if(action & GMSH_SET)
  1541. CTX::instance()->glFontSize = (int)val;
  1542. #if defined(HAVE_FLTK)
  1543. if(FlGui::available() && (action & GMSH_GUI))
  1544. FlGui::instance()->options->general.value[12]->value
  1545. (CTX::instance()->glFontSize);
  1546. #endif
  1547. return CTX::instance()->glFontSize;
  1548. }
  1549. double opt_general_graphics_fontsize_title(OPT_ARGS_NUM)
  1550. {
  1551. if(action & GMSH_SET)
  1552. CTX::instance()->glFontSizeTitle = (int)val;
  1553. #if defined(HAVE_FLTK)
  1554. if(FlGui::available() && (action & GMSH_GUI))
  1555. FlGui::instance()->options->general.value[28]->value
  1556. (CTX::instance()->glFontSizeTitle);
  1557. #endif
  1558. return CTX::instance()->glFontSizeTitle;
  1559. }
  1560. double opt_general_polygon_offset_always(OPT_ARGS_NUM)
  1561. {
  1562. if(action & GMSH_SET)
  1563. CTX::instance()->polygonOffsetAlways = (int)val;
  1564. #if defined(HAVE_FLTK)
  1565. if(FlGui::available() && (action & GMSH_GUI))
  1566. FlGui::instance()->options->general.butt[4]->value
  1567. (CTX::instance()->polygonOffsetAlways);
  1568. #endif
  1569. return CTX::instance()->polygonOffsetAlways;
  1570. }
  1571. double opt_general_polygon_offset_factor(OPT_ARGS_NUM)
  1572. {
  1573. if(action & GMSH_SET)
  1574. CTX::instance()->polygonOffsetFactor = val;
  1575. #if defined(HAVE_FLTK)
  1576. if(FlGui::available() && (action & GMSH_GUI))
  1577. FlGui::instance()->options->general.value[15]->value
  1578. (CTX::instance()->polygonOffsetFactor);
  1579. #endif
  1580. return CTX::instance()->polygonOffsetFactor;
  1581. }
  1582. double opt_general_polygon_offset_units(OPT_ARGS_NUM)
  1583. {
  1584. if(action & GMSH_SET)
  1585. CTX::instance()->polygonOffsetUnits = val;
  1586. #if defined(HAVE_FLTK)
  1587. if(FlGui::available() && (action & GMSH_GUI))
  1588. FlGui::instance()->options->general.value[16]->value
  1589. (CTX::instance()->polygonOffsetUnits);
  1590. #endif
  1591. return CTX::instance()->polygonOffsetUnits;
  1592. }
  1593. double opt_general_graphics_position0(OPT_ARGS_NUM)
  1594. {
  1595. if(action & GMSH_SET)
  1596. CTX::instance()->glPosition[0] = (int)val;
  1597. return CTX::instance()->glPosition[0];
  1598. }
  1599. double opt_general_graphics_position1(OPT_ARGS_NUM)
  1600. {
  1601. if(action & GMSH_SET)
  1602. CTX::instance()->glPosition[1] = (int)val;
  1603. return CTX::instance()->glPosition[1];
  1604. }
  1605. double opt_general_graphics_size0(OPT_ARGS_NUM)
  1606. {
  1607. if(action & GMSH_SET){
  1608. CTX::instance()->glSize[0] = (int)val;
  1609. if(CTX::instance()->glSize[0] <= 0) CTX::instance()->glSize[0] = 600;
  1610. }
  1611. #if defined(HAVE_FLTK)
  1612. if(FlGui::available()){
  1613. if(action & GMSH_SET){
  1614. FlGui::instance()->graph[0]->win->size
  1615. (CTX::instance()->glSize[0],
  1616. FlGui::instance()->graph[0]->win->h());
  1617. // workaround resizing bug on Mac
  1618. FlGui::instance()->graph[0]->win->size_range
  1619. (FlGui::instance()->graph[0]->minWidth, FlGui::instance()->graph[0]->minHeight);
  1620. }
  1621. }
  1622. #endif
  1623. return CTX::instance()->glSize[0];
  1624. }
  1625. double opt_general_graphics_size1(OPT_ARGS_NUM)
  1626. {
  1627. if(action & GMSH_SET){
  1628. CTX::instance()->glSize[1] = (int)val;
  1629. if(CTX::instance()->glSize[1] <= 0) CTX::instance()->glSize[1] = 600;
  1630. }
  1631. #if defined(HAVE_FLTK)
  1632. if(FlGui::available()){
  1633. if(action & GMSH_SET){
  1634. FlGui::instance()->graph[0]->win->size
  1635. (FlGui::instance()->graph[0]->win->w(),
  1636. FlGui::instance()->graph[0]->bottom->h() + CTX::instance()->glSize[1]);
  1637. // workaround resizing bug on Mac
  1638. FlGui::instance()->graph[0]->win->size_range
  1639. (FlGui::instance()->graph[0]->minWidth, FlGui::instance()->graph[0]->minHeight);
  1640. }
  1641. }
  1642. #endif
  1643. return CTX::instance()->glSize[1];
  1644. }
  1645. double opt_general_context_position0(OPT_ARGS_NUM)
  1646. {
  1647. if(action & GMSH_SET)
  1648. CTX::instance()->ctxPosition[0] = (int)val;
  1649. return CTX::instance()->ctxPosition[0];
  1650. }
  1651. double opt_general_context_position1(OPT_ARGS_NUM)
  1652. {
  1653. if(action & GMSH_SET)
  1654. CTX::instance()->ctxPosition[1] = (int)val;
  1655. return CTX::instance()->ctxPosition[1];
  1656. }
  1657. double opt_general_file_chooser_position0(OPT_ARGS_NUM)
  1658. {
  1659. if(action & GMSH_SET)
  1660. CTX::instance()->fileChooserPosition[0] = (int)val;
  1661. return CTX::instance()->fileChooserPosition[0];
  1662. }
  1663. double opt_general_file_chooser_position1(OPT_ARGS_NUM)
  1664. {
  1665. if(action & GMSH_SET)
  1666. CTX::instance()->fileChooserPosition[1] = (int)val;
  1667. return CTX::instance()->fileChooserPosition[1];
  1668. }
  1669. double opt_general_system_menu_bar(OPT_ARGS_NUM)
  1670. {
  1671. if(action & GMSH_SET)
  1672. CTX::instance()->systemMenuBar = (int)val;
  1673. return CTX::instance()->systemMenuBar;
  1674. }
  1675. double opt_general_message_size(OPT_ARGS_NUM)
  1676. {
  1677. if(action & GMSH_SET){
  1678. CTX::instance()->msgSize = (int)val;
  1679. if(CTX::instance()->msgSize < 0) CTX::instance()->msgSize = 0;
  1680. }
  1681. return CTX::instance()->msgSize;
  1682. }
  1683. double opt_general_menu_size(OPT_ARGS_NUM)
  1684. {
  1685. if(action & GMSH_SET){
  1686. CTX::instance()->menuSize = (int)val;
  1687. if(CTX::instance()->menuSize < 0) CTX::instance()->menuSize = 0;
  1688. }
  1689. return CTX::instance()->menuSize;
  1690. }
  1691. double opt_general_option_position0(OPT_ARGS_NUM)
  1692. {
  1693. if(action & GMSH_SET)
  1694. CTX::instance()->optPosition[0] = (int)val;
  1695. return CTX::instance()->optPosition[0];
  1696. }
  1697. double opt_general_option_position1(OPT_ARGS_NUM)
  1698. {
  1699. if(action & GMSH_SET)
  1700. CTX::instance()->optPosition[1] = (int)val;
  1701. return CTX::instance()->optPosition[1];
  1702. }
  1703. double opt_general_plugin_position0(OPT_ARGS_NUM)
  1704. {
  1705. if(action & GMSH_SET)
  1706. CTX::instance()->pluginPosition[0] = (int)val;
  1707. return CTX::instance()->pluginPosition[0];
  1708. }
  1709. double opt_general_plugin_position1(OPT_ARGS_NUM)
  1710. {
  1711. if(action & GMSH_SET)
  1712. CTX::instance()->pluginPosition[1] = (int)val;
  1713. return CTX::instance()->pluginPosition[1];
  1714. }
  1715. double opt_general_plugin_size0(OPT_ARGS_NUM)
  1716. {
  1717. if(action & GMSH_SET)
  1718. CTX::instance()->pluginSize[0] = (int)val;
  1719. return CTX::instance()->pluginSize[0];
  1720. }
  1721. double opt_general_plugin_size1(OPT_ARGS_NUM)
  1722. {
  1723. if(action & GMSH_SET)
  1724. CTX::instance()->pluginSize[1] = (int)val;
  1725. return CTX::instance()->pluginSize[1];
  1726. }
  1727. double opt_general_field_position0(OPT_ARGS_NUM)
  1728. {
  1729. if(action & GMSH_SET)
  1730. CTX::instance()->fieldPosition[0] = (int)val;
  1731. return CTX::instance()->fieldPosition[0];
  1732. }
  1733. double opt_general_field_position1(OPT_ARGS_NUM)
  1734. {
  1735. if(action & GMSH_SET)
  1736. CTX::instance()->fieldPosition[1] = (int)val;
  1737. return CTX::instance()->fieldPosition[1];
  1738. }
  1739. double opt_general_field_size0(OPT_ARGS_NUM)
  1740. {
  1741. if(action & GMSH_SET)
  1742. CTX::instance()->fieldSize[0] = (int)val;
  1743. return CTX::instance()->fieldSize[0];
  1744. }
  1745. double opt_general_field_size1(OPT_ARGS_NUM)
  1746. {
  1747. if(action & GMSH_SET)
  1748. CTX::instance()->fieldSize[1] = (int)val;
  1749. return CTX::instance()->fieldSize[1];
  1750. }
  1751. double opt_general_extra_position0(OPT_ARGS_NUM)
  1752. {
  1753. if(action & GMSH_SET)
  1754. CTX::instance()->extraPosition[0] = (int)val;
  1755. return CTX::instance()->extraPosition[0];
  1756. }
  1757. double opt_general_extra_position1(OPT_ARGS_NUM)
  1758. {
  1759. if(action & GMSH_SET)
  1760. CTX::instance()->extraPosition[1] = (int)val;
  1761. return CTX::instance()->extraPosition[1];
  1762. }
  1763. double opt_general_extra_size0(OPT_ARGS_NUM)
  1764. {
  1765. if(action & GMSH_SET)
  1766. CTX::instance()->extraSize[0] = (int)val;
  1767. return CTX::instance()->extraSize[0];
  1768. }
  1769. double opt_general_extra_size1(OPT_ARGS_NUM)
  1770. {
  1771. if(action & GMSH_SET)
  1772. CTX::instance()->extraSize[1] = (int)val;
  1773. return CTX::instance()->extraSize[1];
  1774. }
  1775. double opt_general_statistics_position0(OPT_ARGS_NUM)
  1776. {
  1777. if(action & GMSH_SET)
  1778. CTX::instance()->statPosition[0] = (int)val;
  1779. return CTX::instance()->statPosition[0];
  1780. }
  1781. double opt_general_statistics_position1(OPT_ARGS_NUM)
  1782. {
  1783. if(action & GMSH_SET)
  1784. CTX::instance()->statPosition[1] = (int)val;
  1785. return CTX::instance()->statPosition[1];
  1786. }
  1787. double opt_general_visibility_position0(OPT_ARGS_NUM)
  1788. {
  1789. if(action & GMSH_SET)
  1790. CTX::instance()->visPosition[0] = (int)val;
  1791. return CTX::instance()->visPosition[0];
  1792. }
  1793. double opt_general_visibility_position1(OPT_ARGS_NUM)
  1794. {
  1795. if(action & GMSH_SET)
  1796. CTX::instance()->visPosition[1] = (int)val;
  1797. return CTX::instance()->visPosition[1];
  1798. }
  1799. double opt_general_clip_position0(OPT_ARGS_NUM)
  1800. {
  1801. if(action & GMSH_SET)
  1802. CTX::instance()->clipPosition[0] = (int)val;
  1803. return CTX::instance()->clipPosition[0];
  1804. }
  1805. double opt_general_clip_position1(OPT_ARGS_NUM)
  1806. {
  1807. if(action & GMSH_SET)
  1808. CTX::instance()->clipPosition[1] = (int)val;
  1809. return CTX::instance()->clipPosition[1];
  1810. }
  1811. double opt_general_manip_position0(OPT_ARGS_NUM)
  1812. {
  1813. if(action & GMSH_SET)
  1814. CTX::instance()->manipPosition[0] = (int)val;
  1815. return CTX::instance()->manipPosition[0];
  1816. }
  1817. double opt_general_manip_position1(OPT_ARGS_NUM)
  1818. {
  1819. if(action & GMSH_SET)
  1820. CTX::instance()->manipPosition[1] = (int)val;
  1821. return CTX::instance()->manipPosition[1];
  1822. }
  1823. double opt_general_session_save(OPT_ARGS_NUM)
  1824. {
  1825. if(action & GMSH_SET)
  1826. CTX::instance()->sessionSave = (int)val;
  1827. #if defined(HAVE_FLTK)
  1828. if(FlGui::available() && (action & GMSH_GUI))
  1829. FlGui::instance()->options->general.butt[8]->value
  1830. (CTX::instance()->sessionSave);
  1831. #endif
  1832. return CTX::instance()->sessionSave;
  1833. }
  1834. double opt_general_options_save(OPT_ARGS_NUM)
  1835. {
  1836. if(action & GMSH_SET)
  1837. CTX::instance()->optionsSave = (int)val;
  1838. #if defined(HAVE_FLTK)
  1839. if(FlGui::available() && (action & GMSH_GUI))
  1840. FlGui::instance()->options->general.butt[9]->value
  1841. (CTX::instance()->optionsSave ? 1 : 0);
  1842. #endif
  1843. return CTX::instance()->optionsSave;
  1844. }
  1845. double opt_general_confirm_overwrite(OPT_ARGS_NUM)
  1846. {
  1847. if(action & GMSH_SET)
  1848. CTX::instance()->confirmOverwrite = (int)val;
  1849. #if defined(HAVE_FLTK)
  1850. if(FlGui::available() && (action & GMSH_GUI))
  1851. FlGui::instance()->options->general.butt[14]->value
  1852. (CTX::instance()->confirmOverwrite);
  1853. #endif
  1854. return CTX::instance()->confirmOverwrite;
  1855. }
  1856. double opt_general_rotation0(OPT_ARGS_NUM)
  1857. {
  1858. if(action & GMSH_SET)
  1859. CTX::instance()->tmpRotation[0] = val;
  1860. #if defined(HAVE_FLTK)
  1861. if(FlGui::available()){
  1862. if(action & GMSH_SET)
  1863. FlGui::instance()->graph[0]->gl[0]->getDrawContext()->r[0] = val;
  1864. return FlGui::instance()->graph[0]->gl[0]->getDrawContext()->r[0];
  1865. }
  1866. #endif
  1867. return CTX::instance()->tmpRotation[0];
  1868. }
  1869. double opt_general_rotation1(OPT_ARGS_NUM)
  1870. {
  1871. if(action & GMSH_SET)
  1872. CTX::instance()->tmpRotation[1] = val;
  1873. #if defined(HAVE_FLTK)
  1874. if(FlGui::available()){
  1875. if(action & GMSH_SET)
  1876. FlGui::instance()->graph[0]->gl[0]->getDrawContext()->r[1] = val;
  1877. return FlGui::instance()->graph[0]->gl[0]->getDrawContext()->r[1];
  1878. }
  1879. #endif
  1880. return CTX::instance()->tmpRotation[1];
  1881. }
  1882. double opt_general_rotation2(OPT_ARGS_NUM)
  1883. {
  1884. if(action & GMSH_SET)
  1885. CTX::instance()->tmpRotation[2] = val;
  1886. #if defined(HAVE_FLTK)
  1887. if(FlGui::available()){
  1888. if(action & GMSH_SET)
  1889. FlGui::instance()->graph[0]->gl[0]->getDrawContext()->r[2] = val;
  1890. return FlGui::instance()->graph[0]->gl[0]->getDrawContext()->r[2];
  1891. }
  1892. #endif
  1893. return CTX::instance()->tmpRotation[2];
  1894. }
  1895. double opt_general_rotation_center0(OPT_ARGS_NUM)
  1896. {
  1897. if(action & GMSH_SET)
  1898. CTX::instance()->rotationCenter[0] = val;
  1899. #if defined(HAVE_FLTK)
  1900. if(FlGui::available() && (action & GMSH_GUI))
  1901. FlGui::instance()->options->general.value[8]->value
  1902. (CTX::instance()->rotationCenter[0]);
  1903. #endif
  1904. return CTX::instance()->rotationCenter[0];
  1905. }
  1906. double opt_general_rotation_center1(OPT_ARGS_NUM)
  1907. {
  1908. if(action & GMSH_SET)
  1909. CTX::instance()->rotationCenter[1] = val;
  1910. #if defined(HAVE_FLTK)
  1911. if(FlGui::available() && (action & GMSH_GUI))
  1912. FlGui::instance()->options->general.value[9]->value
  1913. (CTX::instance()->rotationCenter[1]);
  1914. #endif
  1915. return CTX::instance()->rotationCenter[1];
  1916. }
  1917. double opt_general_rotation_center2(OPT_ARGS_NUM)
  1918. {
  1919. if(action & GMSH_SET)
  1920. CTX::instance()->rotationCenter[2] = val;
  1921. #if defined(HAVE_FLTK)
  1922. if(FlGui::available() && (action & GMSH_GUI))
  1923. FlGui::instance()->options->general.value[10]->value
  1924. (CTX::instance()->rotationCenter[2]);
  1925. #endif
  1926. return CTX::instance()->rotationCenter[2];
  1927. }
  1928. double opt_general_quaternion0(OPT_ARGS_NUM)
  1929. {
  1930. if(action & GMSH_SET)
  1931. CTX::instance()->tmpQuaternion[0] = val;
  1932. #if defined(HAVE_FLTK)
  1933. if(FlGui::available()){
  1934. if(action & GMSH_SET)
  1935. FlGui::instance()->graph[0]->gl[0]->getDrawContext()->quaternion[0] = val;
  1936. if(action & GMSH_GUI)
  1937. FlGui::instance()->manip->update();
  1938. return FlGui::instance()->graph[0]->gl[0]->getDrawContext()->quaternion[0];
  1939. }
  1940. #endif
  1941. return CTX::instance()->tmpQuaternion[0];
  1942. }
  1943. double opt_general_quaternion1(OPT_ARGS_NUM)
  1944. {
  1945. if(action & GMSH_SET)
  1946. CTX::instance()->tmpQuaternion[1] = val;
  1947. #if defined(HAVE_FLTK)
  1948. if(FlGui::available()){
  1949. if(action & GMSH_SET)
  1950. FlGui::instance()->graph[0]->gl[0]->getDrawContext()->quaternion[1] = val;
  1951. if(action & GMSH_GUI)
  1952. FlGui::instance()->manip->update();
  1953. return FlGui::instance()->graph[0]->gl[0]->getDrawContext()->quaternion[1];
  1954. }
  1955. #endif
  1956. return CTX::instance()->tmpQuaternion[1];
  1957. }
  1958. double opt_general_quaternion2(OPT_ARGS_NUM)
  1959. {
  1960. if(action & GMSH_SET)
  1961. CTX::instance()->tmpQuaternion[2] = val;
  1962. #if defined(HAVE_FLTK)
  1963. if(FlGui::available()){
  1964. if(action & GMSH_SET)
  1965. FlGui::instance()->graph[0]->gl[0]->getDrawContext()->quaternion[2] = val;
  1966. if(action & GMSH_GUI)
  1967. FlGui::instance()->manip->update();
  1968. return FlGui::instance()->graph[0]->gl[0]->getDrawContext()->quaternion[2];
  1969. }
  1970. #endif
  1971. return CTX::instance()->tmpQuaternion[2];
  1972. }
  1973. double opt_general_quaternion3(OPT_ARGS_NUM)
  1974. {
  1975. if(action & GMSH_SET)
  1976. CTX::instance()->tmpQuaternion[3] = val;
  1977. #if defined(HAVE_FLTK)
  1978. if(FlGui::available()){
  1979. if(action & GMSH_SET)
  1980. FlGui::instance()->graph[0]->gl[0]->getDrawContext()->quaternion[3] = val;
  1981. if(action & GMSH_GUI)
  1982. FlGui::instance()->manip->update();
  1983. return FlGui::instance()->graph[0]->gl[0]->getDrawContext()->quaternion[3];
  1984. }
  1985. #endif
  1986. return CTX::instance()->tmpQuaternion[3];
  1987. }
  1988. double opt_general_translation0(OPT_ARGS_NUM)
  1989. {
  1990. if(action & GMSH_SET)
  1991. CTX::instance()->tmpTranslation[0] = val;
  1992. #if defined(HAVE_FLTK)
  1993. if(FlGui::available()){
  1994. if(action & GMSH_SET)
  1995. FlGui::instance()->graph[0]->gl[0]->getDrawContext()->t[0] = val;
  1996. if(action & GMSH_GUI)
  1997. FlGui::instance()->manip->update();
  1998. return FlGui::instance()->graph[0]->gl[0]->getDrawContext()->t[0];
  1999. }
  2000. #endif
  2001. return CTX::instance()->tmpTranslation[0];
  2002. }
  2003. double opt_general_translation1(OPT_ARGS_NUM)
  2004. {
  2005. if(action & GMSH_SET)
  2006. CTX::instance()->tmpTranslation[1] = val;
  2007. #if defined(HAVE_FLTK)
  2008. if(FlGui::available()){
  2009. if(action & GMSH_SET)
  2010. FlGui::instance()->graph[0]->gl[0]->getDrawContext()->t[1] = val;
  2011. if(action & GMSH_GUI)
  2012. FlGui::instance()->manip->update();
  2013. return FlGui::instance()->graph[0]->gl[0]->getDrawContext()->t[1];
  2014. }
  2015. #endif
  2016. return CTX::instance()->tmpTranslation[1];
  2017. }
  2018. double opt_general_translation2(OPT_ARGS_NUM)
  2019. {
  2020. if(action & GMSH_SET)
  2021. CTX::instance()->tmpTranslation[2] = val;
  2022. #if defined(HAVE_FLTK)
  2023. if(FlGui::available()){
  2024. if(action & GMSH_SET)
  2025. FlGui::instance()->graph[0]->gl[0]->getDrawContext()->t[2] = val;
  2026. if(action & GMSH_GUI)
  2027. FlGui::instance()->manip->update();
  2028. return FlGui::instance()->graph[0]->gl[0]->getDrawContext()->t[2];
  2029. }
  2030. #endif
  2031. return CTX::instance()->tmpTranslation[2];
  2032. }
  2033. double opt_general_scale0(OPT_ARGS_NUM)
  2034. {
  2035. if(action & GMSH_SET)
  2036. CTX::instance()->tmpScale[0] = val ? val : 1.0;
  2037. #if defined(HAVE_FLTK)
  2038. if(FlGui::available()){
  2039. if(action & GMSH_SET)
  2040. FlGui::instance()->graph[0]->gl[0]->getDrawContext()->s[0] = val ? val : 1.0;
  2041. if(action & GMSH_GUI)
  2042. FlGui::instance()->manip->update();
  2043. return FlGui::instance()->graph[0]->gl[0]->getDrawContext()->s[0];
  2044. }
  2045. #endif
  2046. return CTX::instance()->tmpScale[0];
  2047. }
  2048. double opt_general_scale1(OPT_ARGS_NUM)
  2049. {
  2050. if(action & GMSH_SET)
  2051. CTX::instance()->tmpScale[1] = val ? val : 1.0;
  2052. #if defined(HAVE_FLTK)
  2053. if(FlGui::available()){
  2054. if(action & GMSH_SET)
  2055. FlGui::instance()->graph[0]->gl[0]->getDrawContext()->s[1] = val ? val : 1.0;
  2056. if(action & GMSH_GUI)
  2057. FlGui::instance()->manip->update();
  2058. return FlGui::instance()->graph[0]->gl[0]->getDrawContext()->s[1];
  2059. }
  2060. #endif
  2061. return CTX::instance()->tmpScale[1];
  2062. }
  2063. double opt_general_scale2(OPT_ARGS_NUM)
  2064. {
  2065. if(action & GMSH_SET)
  2066. CTX::instance()->tmpScale[2] = val ? val : 1.0;
  2067. #if defined(HAVE_FLTK)
  2068. if(FlGui::available()){
  2069. if(action & GMSH_SET)
  2070. FlGui::instance()->graph[0]->gl[0]->getDrawContext()->s[2] = val ? val : 1.0;
  2071. if(action & GMSH_GUI)
  2072. FlGui::instance()->manip->update();
  2073. return FlGui::instance()->graph[0]->gl[0]->getDrawContext()->s[2];
  2074. }
  2075. #endif
  2076. return CTX::instance()->tmpScale[2];
  2077. }
  2078. double opt_general_clip_factor(OPT_ARGS_NUM)
  2079. {
  2080. if(action & GMSH_SET){
  2081. // should NEVER be zero (or negative)
  2082. if(val < 0.01)
  2083. CTX::instance()->clipFactor = 0.01;
  2084. else
  2085. CTX::instance()->clipFactor = val;
  2086. }
  2087. #if defined(HAVE_FLTK)
  2088. if(FlGui::available() && (action & GMSH_GUI))
  2089. FlGui::instance()->options->general.value[14]->value
  2090. (CTX::instance()->clipFactor);
  2091. #endif
  2092. return CTX::instance()->clipFactor;
  2093. }
  2094. double opt_general_display_border_factor(OPT_ARGS_NUM)
  2095. {
  2096. if(action & GMSH_SET)
  2097. CTX::instance()->displayBorderFactor = val;
  2098. return CTX::instance()->displayBorderFactor;
  2099. }
  2100. double opt_general_point_size(OPT_ARGS_NUM)
  2101. {
  2102. if(action & GMSH_SET)
  2103. CTX::instance()->pointSize = val;
  2104. #if defined(HAVE_FLTK)
  2105. if(FlGui::available() && (action & GMSH_GUI))
  2106. FlGui::instance()->options->general.value[6]->value
  2107. (CTX::instance()->pointSize);
  2108. #endif
  2109. return CTX::instance()->pointSize;
  2110. }
  2111. double opt_general_line_width(OPT_ARGS_NUM)
  2112. {
  2113. if(action & GMSH_SET)
  2114. CTX::instance()->lineWidth = val;
  2115. #if defined(HAVE_FLTK)
  2116. if(FlGui::available() && (action & GMSH_GUI))
  2117. FlGui::instance()->options->general.value[7]->value
  2118. (CTX::instance()->lineWidth);
  2119. #endif
  2120. return CTX::instance()->lineWidth;
  2121. }
  2122. double opt_general_shine(OPT_ARGS_NUM)
  2123. {
  2124. if(action & GMSH_SET)
  2125. CTX::instance()->shine = val;
  2126. #if defined(HAVE_FLTK)
  2127. if(FlGui::available() && (action & GMSH_GUI))
  2128. FlGui::instance()->options->general.value[1]->value
  2129. (CTX::instance()->shine);
  2130. #endif
  2131. return CTX::instance()->shine;
  2132. }
  2133. double opt_general_shine_exponent(OPT_ARGS_NUM)
  2134. {
  2135. if(action & GMSH_SET)
  2136. CTX::instance()->shineExponent = val;
  2137. #if defined(HAVE_FLTK)
  2138. if(FlGui::available() && (action & GMSH_GUI))
  2139. FlGui::instance()->options->general.value[0]->value
  2140. (CTX::instance()->shineExponent);
  2141. #endif
  2142. return CTX::instance()->shineExponent;
  2143. }
  2144. double opt_general_verbosity(OPT_ARGS_NUM)
  2145. {
  2146. if(action & GMSH_SET){
  2147. Msg::SetVerbosity((int)val);
  2148. }
  2149. #if defined(HAVE_FLTK)
  2150. if(FlGui::available() && (action & GMSH_GUI))
  2151. FlGui::instance()->options->general.value[5]->value
  2152. (Msg::GetVerbosity());
  2153. #endif
  2154. return Msg::GetVerbosity();
  2155. }
  2156. double opt_general_progress_meter_step(OPT_ARGS_NUM)
  2157. {
  2158. if(action & GMSH_SET){
  2159. Msg::SetProgressMeterStep((int)val);
  2160. }
  2161. return Msg::GetProgressMeterStep();
  2162. }
  2163. double opt_general_nopopup(OPT_ARGS_NUM)
  2164. {
  2165. if(action & GMSH_SET)
  2166. CTX::instance()->noPopup = (int)val;
  2167. return CTX::instance()->noPopup;
  2168. }
  2169. double opt_general_non_modal_windows(OPT_ARGS_NUM)
  2170. {
  2171. if(action & GMSH_SET)
  2172. CTX::instance()->nonModalWindows = (int)val;
  2173. return CTX::instance()->nonModalWindows;
  2174. }
  2175. double opt_general_terminal(OPT_ARGS_NUM)
  2176. {
  2177. if(action & GMSH_SET)
  2178. CTX::instance()->terminal = (int)val;
  2179. #if defined(HAVE_FLTK)
  2180. if(FlGui::available() && (action & GMSH_GUI))
  2181. FlGui::instance()->options->general.butt[7]->value
  2182. (CTX::instance()->terminal);
  2183. #endif
  2184. return CTX::instance()->terminal;
  2185. }
  2186. double opt_general_tooltips(OPT_ARGS_NUM)
  2187. {
  2188. if(action & GMSH_SET) {
  2189. CTX::instance()->tooltips = (int)val;
  2190. #if defined(HAVE_FLTK)
  2191. if(CTX::instance()->tooltips)
  2192. Fl_Tooltip::enable();
  2193. else
  2194. Fl_Tooltip::disable();
  2195. #endif
  2196. }
  2197. #if defined(HAVE_FLTK)
  2198. if(FlGui::available() && (action & GMSH_GUI))
  2199. FlGui::instance()->options->general.butt[13]->value
  2200. (CTX::instance()->tooltips);
  2201. #endif
  2202. return CTX::instance()->tooltips;
  2203. }
  2204. double opt_general_orthographic(OPT_ARGS_NUM)
  2205. {
  2206. if(action & GMSH_SET)
  2207. CTX::instance()->ortho = (int)val;
  2208. #if defined(HAVE_FLTK)
  2209. if(FlGui::available() && (action & GMSH_GUI)) {
  2210. if(CTX::instance()->ortho){
  2211. FlGui::instance()->options->general.choice[2]->value(0);
  2212. if(FlGui::available())
  2213. Msg::StatusBar(false, "Orthographic projection");
  2214. }
  2215. else{
  2216. FlGui::instance()->options->general.choice[2]->value(1);
  2217. if(FlGui::available())
  2218. Msg::StatusBar(false, "Perspective projection");
  2219. }
  2220. }
  2221. #endif
  2222. return CTX::instance()->ortho;
  2223. }
  2224. double opt_general_mouse_selection(OPT_ARGS_NUM)
  2225. {
  2226. if(action & GMSH_SET)
  2227. CTX::instance()->mouseSelection = (int)val;
  2228. #if defined(HAVE_FLTK)
  2229. if(FlGui::available() && (action & GMSH_GUI)) {
  2230. if(CTX::instance()->mouseSelection){
  2231. if(FlGui::available())
  2232. Msg::StatusBar(false, "Mouse selection ON");
  2233. for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++)
  2234. FlGui::instance()->graph[i]->butt[9]->color(FL_BACKGROUND_COLOR);
  2235. }
  2236. else{
  2237. if(FlGui::available())
  2238. Msg::StatusBar(false, "Mouse selection OFF");
  2239. for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++)
  2240. FlGui::instance()->graph[i]->butt[9]->color(FL_RED);
  2241. }
  2242. for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++)
  2243. FlGui::instance()->graph[i]->butt[9]->redraw();
  2244. }
  2245. #endif
  2246. return CTX::instance()->mouseSelection;
  2247. }
  2248. double opt_general_mouse_hover_meshes(OPT_ARGS_NUM)
  2249. {
  2250. if(action & GMSH_SET)
  2251. CTX::instance()->mouseHoverMeshes = (int)val;
  2252. #if defined(HAVE_FLTK)
  2253. if(FlGui::available() && (action & GMSH_GUI))
  2254. FlGui::instance()->options->general.butt[11]->value
  2255. (CTX::instance()->mouseHoverMeshes);
  2256. #endif
  2257. return CTX::instance()->mouseHoverMeshes;
  2258. }
  2259. double opt_general_fast_redraw(OPT_ARGS_NUM)
  2260. {
  2261. if(action & GMSH_SET)
  2262. CTX::instance()->fastRedraw = (int)val;
  2263. #if defined(HAVE_FLTK)
  2264. if(FlGui::available() && (action & GMSH_GUI)){
  2265. FlGui::instance()->options->general.butt[2]->value
  2266. (CTX::instance()->fastRedraw);
  2267. FlGui::instance()->options->activate("fast_redraw");
  2268. }
  2269. #endif
  2270. return CTX::instance()->fastRedraw;
  2271. }
  2272. double opt_general_draw_bounding_box(OPT_ARGS_NUM)
  2273. {
  2274. if(action & GMSH_SET)
  2275. CTX::instance()->drawBBox = (int)val;
  2276. #if defined(HAVE_FLTK)
  2277. if(FlGui::available() && (action & GMSH_GUI))
  2278. FlGui::instance()->options->general.butt[6]->value
  2279. (CTX::instance()->drawBBox);
  2280. #endif
  2281. return CTX::instance()->drawBBox;
  2282. }
  2283. double opt_general_xmin(OPT_ARGS_NUM)
  2284. {
  2285. SBoundingBox3d bb = GModel::current()->bounds();
  2286. return bb.empty() ? 0. : bb.min().x();
  2287. }
  2288. double opt_general_xmax(OPT_ARGS_NUM)
  2289. {
  2290. SBoundingBox3d bb = GModel::current()->bounds();
  2291. return bb.empty() ? 0. : bb.max().x();
  2292. }
  2293. double opt_general_ymin(OPT_ARGS_NUM)
  2294. {
  2295. SBoundingBox3d bb = GModel::current()->bounds();
  2296. return bb.empty() ? 0. : bb.min().y();
  2297. }
  2298. double opt_general_ymax(OPT_ARGS_NUM)
  2299. {
  2300. SBoundingBox3d bb = GModel::current()->bounds();
  2301. return bb.empty() ? 0. : bb.max().y();
  2302. }
  2303. double opt_general_zmin(OPT_ARGS_NUM)
  2304. {
  2305. SBoundingBox3d bb = GModel::current()->bounds();
  2306. return bb.empty() ? 0. : bb.min().z();
  2307. }
  2308. double opt_general_zmax(OPT_ARGS_NUM)
  2309. {
  2310. SBoundingBox3d bb = GModel::current()->bounds();
  2311. return bb.empty() ? 0. : bb.max().z();
  2312. }
  2313. double opt_general_axes(OPT_ARGS_NUM)
  2314. {
  2315. if(action & GMSH_SET){
  2316. CTX::instance()->axes = (int)val;
  2317. if(CTX::instance()->axes < 0 || CTX::instance()->axes > 5)
  2318. CTX::instance()->axes = 0;
  2319. }
  2320. #if defined(HAVE_FLTK)
  2321. if(FlGui::available() && (action & GMSH_GUI)){
  2322. FlGui::instance()->options->general.choice[4]->value
  2323. (CTX::instance()->axes);
  2324. FlGui::instance()->options->activate("general_axes");
  2325. }
  2326. #endif
  2327. return CTX::instance()->axes;
  2328. }
  2329. double opt_general_axes_mikado(OPT_ARGS_NUM)
  2330. {
  2331. if(action & GMSH_SET) {
  2332. CTX::instance()->axesMikado = (int)val;
  2333. }
  2334. #if defined(HAVE_FLTK)
  2335. if(FlGui::available() && (action & GMSH_GUI))
  2336. FlGui::instance()->options->general.butt[16]->value
  2337. (CTX::instance()->axesMikado);
  2338. #endif
  2339. return CTX::instance()->axesMikado;
  2340. }
  2341. double opt_general_axes_auto_position(OPT_ARGS_NUM)
  2342. {
  2343. if(action & GMSH_SET)
  2344. CTX::instance()->axesAutoPosition = (int)val;
  2345. #if defined(HAVE_FLTK)
  2346. if(FlGui::available() && (action & GMSH_GUI)){
  2347. FlGui::instance()->options->general.butt[0]->value
  2348. (CTX::instance()->axesAutoPosition);
  2349. FlGui::instance()->options->activate("general_axes_auto");
  2350. }
  2351. #endif
  2352. return CTX::instance()->axesAutoPosition;
  2353. }
  2354. double opt_general_axes_tics0(OPT_ARGS_NUM)
  2355. {
  2356. if(action & GMSH_SET)
  2357. CTX::instance()->axesTics[0] = val;
  2358. #if defined(HAVE_FLTK)
  2359. if(FlGui::available() && (action & GMSH_GUI))
  2360. FlGui::instance()->options->general.value[17]->value
  2361. (CTX::instance()->axesTics[0]);
  2362. #endif
  2363. return CTX::instance()->axesTics[0];
  2364. }
  2365. double opt_general_axes_tics1(OPT_ARGS_NUM)
  2366. {
  2367. if(action & GMSH_SET)
  2368. CTX::instance()->axesTics[1] = val;
  2369. #if defined(HAVE_FLTK)
  2370. if(FlGui::available() && (action & GMSH_GUI))
  2371. FlGui::instance()->options->general.value[18]->value
  2372. (CTX::instance()->axesTics[1]);
  2373. #endif
  2374. return CTX::instance()->axesTics[1];
  2375. }
  2376. double opt_general_axes_tics2(OPT_ARGS_NUM)
  2377. {
  2378. if(action & GMSH_SET)
  2379. CTX::instance()->axesTics[2] = val;
  2380. #if defined(HAVE_FLTK)
  2381. if(FlGui::available() && (action & GMSH_GUI))
  2382. FlGui::instance()->options->general.value[19]->value
  2383. (CTX::instance()->axesTics[2]);
  2384. #endif
  2385. return CTX::instance()->axesTics[2];
  2386. }
  2387. double opt_general_axes_xmin(OPT_ARGS_NUM)
  2388. {
  2389. if(action & GMSH_SET)
  2390. CTX::instance()->axesPosition[0] = val;
  2391. #if defined(HAVE_FLTK)
  2392. if(FlGui::available() && (action & GMSH_GUI))
  2393. FlGui::instance()->options->general.value[20]->value
  2394. (CTX::instance()->axesPosition[0]);
  2395. #endif
  2396. return CTX::instance()->axesPosition[0];
  2397. }
  2398. double opt_general_axes_xmax(OPT_ARGS_NUM)
  2399. {
  2400. if(action & GMSH_SET)
  2401. CTX::instance()->axesPosition[1] = val;
  2402. #if defined(HAVE_FLTK)
  2403. if(FlGui::available() && (action & GMSH_GUI))
  2404. FlGui::instance()->options->general.value[23]->value
  2405. (CTX::instance()->axesPosition[1]);
  2406. #endif
  2407. return CTX::instance()->axesPosition[1];
  2408. }
  2409. double opt_general_axes_ymin(OPT_ARGS_NUM)
  2410. {
  2411. if(action & GMSH_SET)
  2412. CTX::instance()->axesPosition[2] = val;
  2413. #if defined(HAVE_FLTK)
  2414. if(FlGui::available() && (action & GMSH_GUI))
  2415. FlGui::instance()->options->general.value[21]->value
  2416. (CTX::instance()->axesPosition[2]);
  2417. #endif
  2418. return CTX::instance()->axesPosition[2];
  2419. }
  2420. double opt_general_axes_ymax(OPT_ARGS_NUM)
  2421. {
  2422. if(action & GMSH_SET)
  2423. CTX::instance()->axesPosition[3] = val;
  2424. #if defined(HAVE_FLTK)
  2425. if(FlGui::available() && (action & GMSH_GUI))
  2426. FlGui::instance()->options->general.value[24]->value
  2427. (CTX::instance()->axesPosition[3]);
  2428. #endif
  2429. return CTX::instance()->axesPosition[3];
  2430. }
  2431. double opt_general_axes_zmin(OPT_ARGS_NUM)
  2432. {
  2433. if(action & GMSH_SET)
  2434. CTX::instance()->axesPosition[4] = val;
  2435. #if defined(HAVE_FLTK)
  2436. if(FlGui::available() && (action & GMSH_GUI))
  2437. FlGui::instance()->options->general.value[22]->value
  2438. (CTX::instance()->axesPosition[4]);
  2439. #endif
  2440. return CTX::instance()->axesPosition[4];
  2441. }
  2442. double opt_general_axes_zmax(OPT_ARGS_NUM)
  2443. {
  2444. if(action & GMSH_SET)
  2445. CTX::instance()->axesPosition[5] = val;
  2446. #if defined(HAVE_FLTK)
  2447. if(FlGui::available() && (action & GMSH_GUI))
  2448. FlGui::instance()->options->general.value[25]->value
  2449. (CTX::instance()->axesPosition[5]);
  2450. #endif
  2451. return CTX::instance()->axesPosition[5];
  2452. }
  2453. double opt_general_axes_force_value(OPT_ARGS_NUM)
  2454. {
  2455. if(action & GMSH_SET)
  2456. CTX::instance()->axesForceValue = (int)val;
  2457. return CTX::instance()->axesForceValue;
  2458. }
  2459. double opt_general_axes_value_xmin(OPT_ARGS_NUM)
  2460. {
  2461. if(action & GMSH_SET)
  2462. CTX::instance()->axesValue[0] = val;
  2463. return CTX::instance()->axesValue[0];
  2464. }
  2465. double opt_general_axes_value_xmax(OPT_ARGS_NUM)
  2466. {
  2467. if(action & GMSH_SET)
  2468. CTX::instance()->axesValue[1] = val;
  2469. return CTX::instance()->axesValue[1];
  2470. }
  2471. double opt_general_axes_value_ymin(OPT_ARGS_NUM)
  2472. {
  2473. if(action & GMSH_SET)
  2474. CTX::instance()->axesValue[2] = val;
  2475. return CTX::instance()->axesValue[2];
  2476. }
  2477. double opt_general_axes_value_ymax(OPT_ARGS_NUM)
  2478. {
  2479. if(action & GMSH_SET)
  2480. CTX::instance()->axesValue[3] = val;
  2481. return CTX::instance()->axesValue[3];
  2482. }
  2483. double opt_general_axes_value_zmin(OPT_ARGS_NUM)
  2484. {
  2485. if(action & GMSH_SET)
  2486. CTX::instance()->axesValue[4] = val;
  2487. return CTX::instance()->axesValue[4];
  2488. }
  2489. double opt_general_axes_value_zmax(OPT_ARGS_NUM)
  2490. {
  2491. if(action & GMSH_SET)
  2492. CTX::instance()->axesValue[5] = val;
  2493. return CTX::instance()->axesValue[5];
  2494. }
  2495. double opt_general_small_axes(OPT_ARGS_NUM)
  2496. {
  2497. if(action & GMSH_SET)
  2498. CTX::instance()->smallAxes = (int)val;
  2499. #if defined(HAVE_FLTK)
  2500. if(FlGui::available() && (action & GMSH_GUI)){
  2501. FlGui::instance()->options->general.butt[1]->value
  2502. (CTX::instance()->smallAxes);
  2503. FlGui::instance()->options->activate("general_small_axes");
  2504. }
  2505. #endif
  2506. return CTX::instance()->smallAxes;
  2507. }
  2508. double opt_general_small_axes_position0(OPT_ARGS_NUM)
  2509. {
  2510. if(action & GMSH_SET)
  2511. CTX::instance()->smallAxesPos[0] = (int)val;
  2512. #if defined(HAVE_FLTK)
  2513. if(FlGui::available() && (action & GMSH_GUI))
  2514. FlGui::instance()->options->general.value[26]->value
  2515. (CTX::instance()->smallAxesPos[0]);
  2516. #endif
  2517. return CTX::instance()->smallAxesPos[0];
  2518. }
  2519. double opt_general_small_axes_position1(OPT_ARGS_NUM)
  2520. {
  2521. if(action & GMSH_SET)
  2522. CTX::instance()->smallAxesPos[1] = (int)val;
  2523. #if defined(HAVE_FLTK)
  2524. if(FlGui::available() && (action & GMSH_GUI))
  2525. FlGui::instance()->options->general.value[27]->value
  2526. (CTX::instance()->smallAxesPos[1]);
  2527. #endif
  2528. return CTX::instance()->smallAxesPos[1];
  2529. }
  2530. double opt_general_small_axes_size(OPT_ARGS_NUM)
  2531. {
  2532. if(action & GMSH_SET)
  2533. CTX::instance()->smallAxesSize = (int)val;
  2534. return CTX::instance()->smallAxesSize;
  2535. }
  2536. double opt_general_quadric_subdivisions(OPT_ARGS_NUM)
  2537. {
  2538. if(action & GMSH_SET)
  2539. CTX::instance()->quadricSubdivisions = (int)val;
  2540. #if defined(HAVE_FLTK)
  2541. if(FlGui::available()){
  2542. if(action & GMSH_GUI)
  2543. FlGui::instance()->options->general.value[11]->value
  2544. (CTX::instance()->quadricSubdivisions);
  2545. }
  2546. #endif
  2547. return CTX::instance()->quadricSubdivisions;
  2548. }
  2549. double opt_general_double_buffer(OPT_ARGS_NUM)
  2550. {
  2551. if(action & GMSH_SET) {
  2552. CTX::instance()->db = (int)val;
  2553. #if defined(HAVE_FLTK)
  2554. if(FlGui::available()) {
  2555. int mode = FL_RGB | FL_DEPTH | (CTX::instance()->db ? FL_DOUBLE : FL_SINGLE);
  2556. if(CTX::instance()->antialiasing) mode |= FL_MULTISAMPLE;
  2557. for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++)
  2558. for(unsigned int j = 0; j < FlGui::instance()->graph[i]->gl.size(); j++)
  2559. FlGui::instance()->graph[i]->gl[j]->mode(mode);
  2560. }
  2561. #endif
  2562. }
  2563. #if defined(HAVE_FLTK)
  2564. if(FlGui::available() && (action & GMSH_GUI))
  2565. FlGui::instance()->options->general.butt[3]->value
  2566. (CTX::instance()->db);
  2567. #endif
  2568. return CTX::instance()->db;
  2569. }
  2570. double opt_general_antialiasing(OPT_ARGS_NUM)
  2571. {
  2572. if(action & GMSH_SET) {
  2573. CTX::instance()->antialiasing = (int)val;
  2574. #if defined(HAVE_FLTK)
  2575. if(FlGui::available()) {
  2576. int mode = FL_RGB | FL_DEPTH | (CTX::instance()->db ? FL_DOUBLE : FL_SINGLE);
  2577. if(CTX::instance()->antialiasing) mode |= FL_MULTISAMPLE;
  2578. for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++)
  2579. for(unsigned int j = 0; j < FlGui::instance()->graph[i]->gl.size(); j++)
  2580. FlGui::instance()->graph[i]->gl[j]->mode(mode);
  2581. }
  2582. #endif
  2583. }
  2584. #if defined(HAVE_FLTK)
  2585. if(FlGui::available() && (action & GMSH_GUI))
  2586. FlGui::instance()->options->general.butt[12]->value
  2587. (CTX::instance()->antialiasing);
  2588. #endif
  2589. return CTX::instance()->antialiasing;
  2590. }
  2591. double opt_general_alpha_blending(OPT_ARGS_NUM)
  2592. {
  2593. if(action & GMSH_SET)
  2594. CTX::instance()->alpha = (int)val;
  2595. return CTX::instance()->alpha;
  2596. }
  2597. double opt_general_vector_type(OPT_ARGS_NUM)
  2598. {
  2599. if(action & GMSH_SET){
  2600. CTX::instance()->vectorType = (int)val;
  2601. if(CTX::instance()->vectorType < 1 || CTX::instance()->vectorType > 4)
  2602. CTX::instance()->vectorType = 1;
  2603. }
  2604. #if defined(HAVE_FLTK)
  2605. if(FlGui::available() && (action & GMSH_GUI)){
  2606. FlGui::instance()->options->general.choice[0]->value
  2607. (CTX::instance()->vectorType - 1);
  2608. }
  2609. #endif
  2610. return CTX::instance()->vectorType;
  2611. }
  2612. double opt_general_arrow_head_radius(OPT_ARGS_NUM)
  2613. {
  2614. if(action & GMSH_SET){
  2615. if(val < 0.) val = 0.;
  2616. if(val > 1.) val = 1.;
  2617. CTX::instance()->arrowRelHeadRadius = val;
  2618. }
  2619. return CTX::instance()->arrowRelHeadRadius;
  2620. }
  2621. double opt_general_arrow_stem_length(OPT_ARGS_NUM)
  2622. {
  2623. if(action & GMSH_SET){
  2624. if(val < 0.) val = 0.;
  2625. if(val > 1.) val = 1.;
  2626. CTX::instance()->arrowRelStemLength = val;
  2627. }
  2628. return CTX::instance()->arrowRelStemLength;
  2629. }
  2630. double opt_general_arrow_stem_radius(OPT_ARGS_NUM)
  2631. {
  2632. if(action & GMSH_SET){
  2633. if(val < 0.) val = 0.;
  2634. if(val > 1.) val = 1.;
  2635. CTX::instance()->arrowRelStemRadius = val;
  2636. }
  2637. return CTX::instance()->arrowRelStemRadius;
  2638. }
  2639. double opt_general_color_scheme(OPT_ARGS_NUM)
  2640. {
  2641. if(action & GMSH_SET) {
  2642. CTX::instance()->colorScheme = (int)val;
  2643. if(CTX::instance()->colorScheme > 2)
  2644. CTX::instance()->colorScheme = 0;
  2645. SetDefaultColorOptions(0, GeneralOptions_Color);
  2646. SetDefaultColorOptions(0, GeometryOptions_Color);
  2647. SetDefaultColorOptions(0, MeshOptions_Color);
  2648. SetDefaultColorOptions(0, SolverOptions_Color);
  2649. SetDefaultColorOptions(0, PostProcessingOptions_Color);
  2650. #if defined(HAVE_POST)
  2651. for(unsigned int i = 0; i < PView::list.size(); i++)
  2652. SetDefaultColorOptions(i, ViewOptions_Color);
  2653. #endif
  2654. SetDefaultColorOptions(0, PrintOptions_Color);
  2655. SetColorOptionsGUI(0, GeneralOptions_Color);
  2656. SetColorOptionsGUI(0, GeometryOptions_Color);
  2657. SetColorOptionsGUI(0, MeshOptions_Color);
  2658. SetColorOptionsGUI(0, SolverOptions_Color);
  2659. SetColorOptionsGUI(0, PostProcessingOptions_Color);
  2660. #if defined(HAVE_POST)
  2661. for(unsigned int i = 0; i < PView::list.size(); i++)
  2662. SetColorOptionsGUI(i, ViewOptions_Color);
  2663. #endif
  2664. SetColorOptionsGUI(0, PrintOptions_Color);
  2665. #if defined(HAVE_POST)
  2666. // horrible trick so that opt_view_XXX will act on the reference view
  2667. std::vector<PView*> tmp = PView::list;
  2668. PView::list.clear();
  2669. SetDefaultColorOptions(0, ViewOptions_Color);
  2670. PView::list = tmp;
  2671. #endif
  2672. }
  2673. #if defined(HAVE_FLTK)
  2674. if(FlGui::available() && (action & GMSH_GUI))
  2675. FlGui::instance()->options->general.choice[3]->value
  2676. (CTX::instance()->colorScheme);
  2677. #endif
  2678. return CTX::instance()->colorScheme;
  2679. }
  2680. double opt_general_background_gradient(OPT_ARGS_NUM)
  2681. {
  2682. if(action & GMSH_SET){
  2683. CTX::instance()->bgGradient = (int)val;
  2684. if(CTX::instance()->bgGradient < 0 || CTX::instance()->bgGradient > 3)
  2685. CTX::instance()->bgGradient = 0;
  2686. }
  2687. #if defined(HAVE_FLTK)
  2688. if(FlGui::available() && (action & GMSH_GUI))
  2689. FlGui::instance()->options->general.choice[5]->value
  2690. (CTX::instance()->bgGradient);
  2691. #endif
  2692. return CTX::instance()->bgGradient;
  2693. }
  2694. double opt_general_background_image_position0(OPT_ARGS_NUM)
  2695. {
  2696. if(action & GMSH_SET)
  2697. CTX::instance()->bgImagePosition[0] = val;
  2698. return CTX::instance()->bgImagePosition[0];
  2699. }
  2700. double opt_general_background_image_position1(OPT_ARGS_NUM)
  2701. {
  2702. if(action & GMSH_SET)
  2703. CTX::instance()->bgImagePosition[1] = val;
  2704. return CTX::instance()->bgImagePosition[1];
  2705. }
  2706. double opt_general_trackball(OPT_ARGS_NUM)
  2707. {
  2708. if(action & GMSH_SET)
  2709. CTX::instance()->useTrackball = (int)val;
  2710. #if defined(HAVE_FLTK)
  2711. if(FlGui::available() && (action & GMSH_GUI))
  2712. FlGui::instance()->options->general.butt[5]->value
  2713. (CTX::instance()->useTrackball);
  2714. #endif
  2715. return CTX::instance()->useTrackball;
  2716. }
  2717. double opt_general_trackball_hyperbolic_sheet(OPT_ARGS_NUM)
  2718. {
  2719. if(action & GMSH_SET)
  2720. CTX::instance()->trackballHyperbolicSheet = (int)val;
  2721. return CTX::instance()->trackballHyperbolicSheet;
  2722. }
  2723. double opt_general_rotation_center_cg(OPT_ARGS_NUM)
  2724. {
  2725. if(action & GMSH_SET)
  2726. CTX::instance()->rotationCenterCg = (int)val;
  2727. #if defined(HAVE_FLTK)
  2728. if(FlGui::available() && (action & GMSH_GUI)){
  2729. FlGui::instance()->options->general.butt[15]->value
  2730. (CTX::instance()->rotationCenterCg);
  2731. FlGui::instance()->options->activate("rotation_center");
  2732. }
  2733. #endif
  2734. return CTX::instance()->rotationCenterCg;
  2735. }
  2736. double opt_general_zoom_factor(OPT_ARGS_NUM)
  2737. {
  2738. if(action & GMSH_SET)
  2739. CTX::instance()->zoomFactor = val;
  2740. return CTX::instance()->zoomFactor;
  2741. }
  2742. double opt_general_expert_mode(OPT_ARGS_NUM)
  2743. {
  2744. if(action & GMSH_SET)
  2745. CTX::instance()->expertMode = (int)val;
  2746. #if defined(HAVE_FLTK)
  2747. if(FlGui::available() && (action & GMSH_GUI))
  2748. FlGui::instance()->options->general.butt[10]->value
  2749. (CTX::instance()->expertMode);
  2750. #endif
  2751. return CTX::instance()->expertMode;
  2752. }
  2753. double opt_general_stereo_mode(OPT_ARGS_NUM)
  2754. {
  2755. if(action & GMSH_SET)
  2756. CTX::instance()->stereo = (int)val;
  2757. if (CTX::instance()->stereo) // when stereo mode is active camera mode is obligatory
  2758. opt_general_camera_mode(num, action, 1.);
  2759. #if defined(HAVE_FLTK)
  2760. if(FlGui::available() && (action & GMSH_GUI))
  2761. FlGui::instance()->options->general.butt[17]->value(CTX::instance()->stereo);
  2762. #endif
  2763. return CTX::instance()->stereo ;
  2764. }
  2765. double opt_general_eye_sep_ratio(OPT_ARGS_NUM)
  2766. {
  2767. if(action & GMSH_SET)
  2768. CTX::instance()->eye_sep_ratio = (double)val;
  2769. #if defined(HAVE_FLTK)
  2770. if(FlGui::available() && (action & GMSH_GUI))
  2771. FlGui::instance()->options->general.value[29]->value
  2772. (CTX::instance()->eye_sep_ratio) ;
  2773. #endif
  2774. return CTX::instance()->eye_sep_ratio ;
  2775. }
  2776. double opt_general_focallength_ratio(OPT_ARGS_NUM)
  2777. {
  2778. if(action & GMSH_SET)
  2779. CTX::instance()->focallength_ratio = (double) val;
  2780. #if defined(HAVE_FLTK)
  2781. if(FlGui::available() && (action & GMSH_GUI))
  2782. FlGui::instance()->options->general.value[30]->value
  2783. (CTX::instance()->focallength_ratio) ;
  2784. #endif
  2785. return CTX::instance()->focallength_ratio ;
  2786. }
  2787. double opt_general_camera_aperture(OPT_ARGS_NUM)
  2788. {
  2789. if(action & GMSH_SET)
  2790. CTX::instance()->camera_aperture = (double)val;
  2791. #if defined(HAVE_FLTK)
  2792. if(FlGui::available() && (action & GMSH_GUI))
  2793. FlGui::instance()->options->general.value[31]->value
  2794. (CTX::instance()->camera_aperture);
  2795. #endif
  2796. return CTX::instance()->camera_aperture;
  2797. }
  2798. double opt_general_camera_mode(OPT_ARGS_NUM)
  2799. {
  2800. if(action & GMSH_SET)
  2801. CTX::instance()->camera = (int)val;
  2802. #if defined(HAVE_FLTK)
  2803. if(FlGui::available() && (action & GMSH_GUI)){
  2804. FlGui::instance()->options->general.butt[18]->value
  2805. (CTX::instance()->camera);
  2806. FlGui::instance()->options->activate("general_camera");
  2807. }
  2808. #endif
  2809. return CTX::instance()->camera ;
  2810. }
  2811. double opt_general_clip0a(OPT_ARGS_NUM)
  2812. {
  2813. if(action & GMSH_SET)
  2814. CTX::instance()->clipPlane[0][0] = val;
  2815. #if defined(HAVE_FLTK)
  2816. if(FlGui::available() && (action & GMSH_GUI))
  2817. FlGui::instance()->clipping->resetBrowser();
  2818. #endif
  2819. return CTX::instance()->clipPlane[0][0];
  2820. }
  2821. double opt_general_clip0b(OPT_ARGS_NUM)
  2822. {
  2823. if(action & GMSH_SET)
  2824. CTX::instance()->clipPlane[0][1] = val;
  2825. #if defined(HAVE_FLTK)
  2826. if(FlGui::available() && (action & GMSH_GUI))
  2827. FlGui::instance()->clipping->resetBrowser();
  2828. #endif
  2829. return CTX::instance()->clipPlane[0][1];
  2830. }
  2831. double opt_general_clip0c(OPT_ARGS_NUM)
  2832. {
  2833. if(action & GMSH_SET)
  2834. CTX::instance()->clipPlane[0][2] = val;
  2835. #if defined(HAVE_FLTK)
  2836. if(FlGui::available() && (action & GMSH_GUI))
  2837. FlGui::instance()->clipping->resetBrowser();
  2838. #endif
  2839. return CTX::instance()->clipPlane[0][2];
  2840. }
  2841. double opt_general_clip0d(OPT_ARGS_NUM)
  2842. {
  2843. if(action & GMSH_SET)
  2844. CTX::instance()->clipPlane[0][3] = val;
  2845. #if defined(HAVE_FLTK)
  2846. if(FlGui::available() && (action & GMSH_GUI))
  2847. FlGui::instance()->clipping->resetBrowser();
  2848. #endif
  2849. return CTX::instance()->clipPlane[0][3];
  2850. }
  2851. double opt_general_clip1a(OPT_ARGS_NUM)
  2852. {
  2853. if(action & GMSH_SET)
  2854. CTX::instance()->clipPlane[1][0] = val;
  2855. #if defined(HAVE_FLTK)
  2856. if(FlGui::available() && (action & GMSH_GUI))
  2857. FlGui::instance()->clipping->resetBrowser();
  2858. #endif
  2859. return CTX::instance()->clipPlane[1][0];
  2860. }
  2861. double opt_general_clip1b(OPT_ARGS_NUM)
  2862. {
  2863. if(action & GMSH_SET)
  2864. CTX::instance()->clipPlane[1][1] = val;
  2865. #if defined(HAVE_FLTK)
  2866. if(FlGui::available() && (action & GMSH_GUI))
  2867. FlGui::instance()->clipping->resetBrowser();
  2868. #endif
  2869. return CTX::instance()->clipPlane[1][1];
  2870. }
  2871. double opt_general_clip1c(OPT_ARGS_NUM)
  2872. {
  2873. if(action & GMSH_SET)
  2874. CTX::instance()->clipPlane[1][2] = val;
  2875. #if defined(HAVE_FLTK)
  2876. if(FlGui::available() && (action & GMSH_GUI))
  2877. FlGui::instance()->clipping->resetBrowser();
  2878. #endif
  2879. return CTX::instance()->clipPlane[1][2];
  2880. }
  2881. double opt_general_clip1d(OPT_ARGS_NUM)
  2882. {
  2883. if(action & GMSH_SET)
  2884. CTX::instance()->clipPlane[1][3] = val;
  2885. #if defined(HAVE_FLTK)
  2886. if(FlGui::available() && (action & GMSH_GUI))
  2887. FlGui::instance()->clipping->resetBrowser();
  2888. #endif
  2889. return CTX::instance()->clipPlane[1][3];
  2890. }
  2891. double opt_general_clip2a(OPT_ARGS_NUM)
  2892. {
  2893. if(action & GMSH_SET)
  2894. CTX::instance()->clipPlane[2][0] = val;
  2895. #if defined(HAVE_FLTK)
  2896. if(FlGui::available() && (action & GMSH_GUI))
  2897. FlGui::instance()->clipping->resetBrowser();
  2898. #endif
  2899. return CTX::instance()->clipPlane[2][0];
  2900. }
  2901. double opt_general_clip2b(OPT_ARGS_NUM)
  2902. {
  2903. if(action & GMSH_SET)
  2904. CTX::instance()->clipPlane[2][1] = val;
  2905. #if defined(HAVE_FLTK)
  2906. if(FlGui::available() && (action & GMSH_GUI))
  2907. FlGui::instance()->clipping->resetBrowser();
  2908. #endif
  2909. return CTX::instance()->clipPlane[2][1];
  2910. }
  2911. double opt_general_clip2c(OPT_ARGS_NUM)
  2912. {
  2913. if(action & GMSH_SET)
  2914. CTX::instance()->clipPlane[2][2] = val;
  2915. #if defined(HAVE_FLTK)
  2916. if(FlGui::available() && (action & GMSH_GUI))
  2917. FlGui::instance()->clipping->resetBrowser();
  2918. #endif
  2919. return CTX::instance()->clipPlane[2][2];
  2920. }
  2921. double opt_general_clip2d(OPT_ARGS_NUM)
  2922. {
  2923. if(action & GMSH_SET)
  2924. CTX::instance()->clipPlane[2][3] = val;
  2925. #if defined(HAVE_FLTK)
  2926. if(FlGui::available() && (action & GMSH_GUI))
  2927. FlGui::instance()->clipping->resetBrowser();
  2928. #endif
  2929. return CTX::instance()->clipPlane[2][3];
  2930. }
  2931. double opt_general_clip3a(OPT_ARGS_NUM)
  2932. {
  2933. if(action & GMSH_SET)
  2934. CTX::instance()->clipPlane[3][0] = val;
  2935. #if defined(HAVE_FLTK)
  2936. if(FlGui::available() && (action & GMSH_GUI))
  2937. FlGui::instance()->clipping->resetBrowser();
  2938. #endif
  2939. return CTX::instance()->clipPlane[3][0];
  2940. }
  2941. double opt_general_clip3b(OPT_ARGS_NUM)
  2942. {
  2943. if(action & GMSH_SET)
  2944. CTX::instance()->clipPlane[3][1] = val;
  2945. #if defined(HAVE_FLTK)
  2946. if(FlGui::available() && (action & GMSH_GUI))
  2947. FlGui::instance()->clipping->resetBrowser();
  2948. #endif
  2949. return CTX::instance()->clipPlane[3][1];
  2950. }
  2951. double opt_general_clip3c(OPT_ARGS_NUM)
  2952. {
  2953. if(action & GMSH_SET)
  2954. CTX::instance()->clipPlane[3][2] = val;
  2955. #if defined(HAVE_FLTK)
  2956. if(FlGui::available() && (action & GMSH_GUI))
  2957. FlGui::instance()->clipping->resetBrowser();
  2958. #endif
  2959. return CTX::instance()->clipPlane[3][2];
  2960. }
  2961. double opt_general_clip3d(OPT_ARGS_NUM)
  2962. {
  2963. if(action & GMSH_SET)
  2964. CTX::instance()->clipPlane[3][3] = val;
  2965. #if defined(HAVE_FLTK)
  2966. if(FlGui::available() && (action & GMSH_GUI))
  2967. FlGui::instance()->clipping->resetBrowser();
  2968. #endif
  2969. return CTX::instance()->clipPlane[3][3];
  2970. }
  2971. double opt_general_clip4a(OPT_ARGS_NUM)
  2972. {
  2973. if(action & GMSH_SET)
  2974. CTX::instance()->clipPlane[4][0] = val;
  2975. #if defined(HAVE_FLTK)
  2976. if(FlGui::available() && (action & GMSH_GUI))
  2977. FlGui::instance()->clipping->resetBrowser();
  2978. #endif
  2979. return CTX::instance()->clipPlane[4][0];
  2980. }
  2981. double opt_general_clip4b(OPT_ARGS_NUM)
  2982. {
  2983. if(action & GMSH_SET)
  2984. CTX::instance()->clipPlane[4][1] = val;
  2985. #if defined(HAVE_FLTK)
  2986. if(FlGui::available() && (action & GMSH_GUI))
  2987. FlGui::instance()->clipping->resetBrowser();
  2988. #endif
  2989. return CTX::instance()->clipPlane[4][1];
  2990. }
  2991. double opt_general_clip4c(OPT_ARGS_NUM)
  2992. {
  2993. if(action & GMSH_SET)
  2994. CTX::instance()->clipPlane[4][2] = val;
  2995. #if defined(HAVE_FLTK)
  2996. if(FlGui::available() && (action & GMSH_GUI))
  2997. FlGui::instance()->clipping->resetBrowser();
  2998. #endif
  2999. return CTX::instance()->clipPlane[4][2];
  3000. }
  3001. double opt_general_clip4d(OPT_ARGS_NUM)
  3002. {
  3003. if(action & GMSH_SET)
  3004. CTX::instance()->clipPlane[4][3] = val;
  3005. #if defined(HAVE_FLTK)
  3006. if(FlGui::available() && (action & GMSH_GUI))
  3007. FlGui::instance()->clipping->resetBrowser();
  3008. #endif
  3009. return CTX::instance()->clipPlane[4][3];
  3010. }
  3011. double opt_general_clip5a(OPT_ARGS_NUM)
  3012. {
  3013. if(action & GMSH_SET)
  3014. CTX::instance()->clipPlane[5][0] = val;
  3015. #if defined(HAVE_FLTK)
  3016. if(FlGui::available() && (action & GMSH_GUI))
  3017. FlGui::instance()->clipping->resetBrowser();
  3018. #endif
  3019. return CTX::instance()->clipPlane[5][0];
  3020. }
  3021. double opt_general_clip5b(OPT_ARGS_NUM)
  3022. {
  3023. if(action & GMSH_SET)
  3024. CTX::instance()->clipPlane[5][1] = val;
  3025. #if defined(HAVE_FLTK)
  3026. if(FlGui::available() && (action & GMSH_GUI))
  3027. FlGui::instance()->clipping->resetBrowser();
  3028. #endif
  3029. return CTX::instance()->clipPlane[5][1];
  3030. }
  3031. double opt_general_clip5c(OPT_ARGS_NUM)
  3032. {
  3033. if(action & GMSH_SET)
  3034. CTX::instance()->clipPlane[5][2] = val;
  3035. #if defined(HAVE_FLTK)
  3036. if(FlGui::available() && (action & GMSH_GUI))
  3037. FlGui::instance()->clipping->resetBrowser();
  3038. #endif
  3039. return CTX::instance()->clipPlane[5][2];
  3040. }
  3041. double opt_general_clip5d(OPT_ARGS_NUM)
  3042. {
  3043. if(action & GMSH_SET)
  3044. CTX::instance()->clipPlane[5][3] = val;
  3045. #if defined(HAVE_FLTK)
  3046. if(FlGui::available() && (action & GMSH_GUI))
  3047. FlGui::instance()->clipping->resetBrowser();
  3048. #endif
  3049. return CTX::instance()->clipPlane[5][3];
  3050. }
  3051. double opt_general_clip_whole_elements(OPT_ARGS_NUM)
  3052. {
  3053. if(action & GMSH_SET)
  3054. CTX::instance()->clipWholeElements = (int)val;
  3055. #if defined(HAVE_FLTK)
  3056. if(FlGui::available() && (action & GMSH_GUI)){
  3057. FlGui::instance()->clipping->butt[0]->value
  3058. (CTX::instance()->clipWholeElements);
  3059. FlGui::instance()->options->activate("clip_whole_elements");
  3060. }
  3061. #endif
  3062. return CTX::instance()->clipWholeElements;
  3063. }
  3064. double opt_general_clip_only_draw_intersecting_volume(OPT_ARGS_NUM)
  3065. {
  3066. if(action & GMSH_SET)
  3067. CTX::instance()->clipOnlyDrawIntersectingVolume = (int)val;
  3068. #if defined(HAVE_FLTK)
  3069. if(FlGui::available() && (action & GMSH_GUI))
  3070. FlGui::instance()->clipping->butt[1]->value
  3071. (CTX::instance()->clipOnlyDrawIntersectingVolume);
  3072. #endif
  3073. return CTX::instance()->clipOnlyDrawIntersectingVolume;
  3074. }
  3075. double opt_general_clip_only_volume(OPT_ARGS_NUM)
  3076. {
  3077. if(action & GMSH_SET)
  3078. CTX::instance()->clipOnlyVolume = (int)val;
  3079. #if defined(HAVE_FLTK)
  3080. if(FlGui::available() && (action & GMSH_GUI))
  3081. FlGui::instance()->clipping->butt[2]->value
  3082. (CTX::instance()->clipOnlyVolume);
  3083. #endif
  3084. return CTX::instance()->clipOnlyVolume;
  3085. }
  3086. double opt_general_light0(OPT_ARGS_NUM)
  3087. {
  3088. if(action & GMSH_SET)
  3089. CTX::instance()->light[0] = (int)val;
  3090. return CTX::instance()->light[0];
  3091. }
  3092. double opt_general_light00(OPT_ARGS_NUM)
  3093. {
  3094. if(action & GMSH_SET)
  3095. CTX::instance()->lightPosition[0][0] = val;
  3096. #if defined(HAVE_FLTK)
  3097. if(FlGui::available() && (action & GMSH_GUI)){
  3098. FlGui::instance()->options->general.value[2]->value
  3099. (CTX::instance()->lightPosition[0][0]);
  3100. FlGui::instance()->options->general.sphere->setValue
  3101. (CTX::instance()->lightPosition[0][0],
  3102. CTX::instance()->lightPosition[0][1],
  3103. CTX::instance()->lightPosition[0][2]);
  3104. }
  3105. #endif
  3106. return CTX::instance()->lightPosition[0][0];
  3107. }
  3108. double opt_general_light01(OPT_ARGS_NUM)
  3109. {
  3110. if(action & GMSH_SET)
  3111. CTX::instance()->lightPosition[0][1] = val;
  3112. #if defined(HAVE_FLTK)
  3113. if(FlGui::available() && (action & GMSH_GUI)){
  3114. FlGui::instance()->options->general.value[3]->value
  3115. (CTX::instance()->lightPosition[0][1]);
  3116. FlGui::instance()->options->general.sphere->setValue
  3117. (CTX::instance()->lightPosition[0][0],
  3118. CTX::instance()->lightPosition[0][1],
  3119. CTX::instance()->lightPosition[0][2]);
  3120. }
  3121. #endif
  3122. return CTX::instance()->lightPosition[0][1];
  3123. }
  3124. double opt_general_light02(OPT_ARGS_NUM)
  3125. {
  3126. if(action & GMSH_SET)
  3127. CTX::instance()->lightPosition[0][2] = val;
  3128. #if defined(HAVE_FLTK)
  3129. if(FlGui::available() && (action & GMSH_GUI)){
  3130. FlGui::instance()->options->general.value[4]->value
  3131. (CTX::instance()->lightPosition[0][2]);
  3132. FlGui::instance()->options->general.sphere->setValue
  3133. (CTX::instance()->lightPosition[0][0],
  3134. CTX::instance()->lightPosition[0][1],
  3135. CTX::instance()->lightPosition[0][2]);
  3136. }
  3137. #endif
  3138. return CTX::instance()->lightPosition[0][2];
  3139. }
  3140. double opt_general_light03(OPT_ARGS_NUM)
  3141. {
  3142. if(action & GMSH_SET)
  3143. CTX::instance()->lightPosition[0][3] = val;
  3144. #if defined(HAVE_FLTK)
  3145. if(FlGui::available() && (action & GMSH_GUI))
  3146. FlGui::instance()->options->general.value[13]->value
  3147. (CTX::instance()->lightPosition[0][3]);
  3148. #endif
  3149. return CTX::instance()->lightPosition[0][3];
  3150. }
  3151. double opt_general_light1(OPT_ARGS_NUM)
  3152. {
  3153. if(action & GMSH_SET)
  3154. CTX::instance()->light[1] = (int)val;
  3155. return CTX::instance()->light[1];
  3156. }
  3157. double opt_general_light10(OPT_ARGS_NUM)
  3158. {
  3159. if(action & GMSH_SET)
  3160. CTX::instance()->lightPosition[1][0] = val;
  3161. return CTX::instance()->lightPosition[1][0];
  3162. }
  3163. double opt_general_light11(OPT_ARGS_NUM)
  3164. {
  3165. if(action & GMSH_SET)
  3166. CTX::instance()->lightPosition[1][1] = val;
  3167. return CTX::instance()->lightPosition[1][1];
  3168. }
  3169. double opt_general_light12(OPT_ARGS_NUM)
  3170. {
  3171. if(action & GMSH_SET)
  3172. CTX::instance()->lightPosition[1][2] = val;
  3173. return CTX::instance()->lightPosition[1][2];
  3174. }
  3175. double opt_general_light13(OPT_ARGS_NUM)
  3176. {
  3177. if(action & GMSH_SET)
  3178. CTX::instance()->lightPosition[1][3] = val;
  3179. return CTX::instance()->lightPosition[1][3];
  3180. }
  3181. double opt_general_light2(OPT_ARGS_NUM)
  3182. {
  3183. if(action & GMSH_SET)
  3184. CTX::instance()->light[2] = (int)val;
  3185. return CTX::instance()->light[2];
  3186. }
  3187. double opt_general_light20(OPT_ARGS_NUM)
  3188. {
  3189. if(action & GMSH_SET)
  3190. CTX::instance()->lightPosition[2][0] = val;
  3191. return CTX::instance()->lightPosition[2][0];
  3192. }
  3193. double opt_general_light21(OPT_ARGS_NUM)
  3194. {
  3195. if(action & GMSH_SET)
  3196. CTX::instance()->lightPosition[2][1] = val;
  3197. return CTX::instance()->lightPosition[2][1];
  3198. }
  3199. double opt_general_light22(OPT_ARGS_NUM)
  3200. {
  3201. if(action & GMSH_SET)
  3202. CTX::instance()->lightPosition[2][2] = val;
  3203. return CTX::instance()->lightPosition[2][2];
  3204. }
  3205. double opt_general_light23(OPT_ARGS_NUM)
  3206. {
  3207. if(action & GMSH_SET)
  3208. CTX::instance()->lightPosition[2][3] = val;
  3209. return CTX::instance()->lightPosition[2][3];
  3210. }
  3211. double opt_general_light3(OPT_ARGS_NUM)
  3212. {
  3213. if(action & GMSH_SET)
  3214. CTX::instance()->light[3] = (int)val;
  3215. return CTX::instance()->light[3];
  3216. }
  3217. double opt_general_light30(OPT_ARGS_NUM)
  3218. {
  3219. if(action & GMSH_SET)
  3220. CTX::instance()->lightPosition[3][0] = val;
  3221. return CTX::instance()->lightPosition[3][0];
  3222. }
  3223. double opt_general_light31(OPT_ARGS_NUM)
  3224. {
  3225. if(action & GMSH_SET)
  3226. CTX::instance()->lightPosition[3][1] = val;
  3227. return CTX::instance()->lightPosition[3][1];
  3228. }
  3229. double opt_general_light32(OPT_ARGS_NUM)
  3230. {
  3231. if(action & GMSH_SET)
  3232. CTX::instance()->lightPosition[3][2] = val;
  3233. return CTX::instance()->lightPosition[3][2];
  3234. }
  3235. double opt_general_light33(OPT_ARGS_NUM)
  3236. {
  3237. if(action & GMSH_SET)
  3238. CTX::instance()->lightPosition[3][3] = val;
  3239. return CTX::instance()->lightPosition[3][3];
  3240. }
  3241. double opt_general_light4(OPT_ARGS_NUM)
  3242. {
  3243. if(action & GMSH_SET)
  3244. CTX::instance()->light[4] = (int)val;
  3245. return CTX::instance()->light[4];
  3246. }
  3247. double opt_general_light40(OPT_ARGS_NUM)
  3248. {
  3249. if(action & GMSH_SET)
  3250. CTX::instance()->lightPosition[4][0] = val;
  3251. return CTX::instance()->lightPosition[4][0];
  3252. }
  3253. double opt_general_light41(OPT_ARGS_NUM)
  3254. {
  3255. if(action & GMSH_SET)
  3256. CTX::instance()->lightPosition[4][1] = val;
  3257. return CTX::instance()->lightPosition[4][1];
  3258. }
  3259. double opt_general_light42(OPT_ARGS_NUM)
  3260. {
  3261. if(action & GMSH_SET)
  3262. CTX::instance()->lightPosition[4][2] = val;
  3263. return CTX::instance()->lightPosition[4][2];
  3264. }
  3265. double opt_general_light43(OPT_ARGS_NUM)
  3266. {
  3267. if(action & GMSH_SET)
  3268. CTX::instance()->lightPosition[4][3] = val;
  3269. return CTX::instance()->lightPosition[4][3];
  3270. }
  3271. double opt_general_light5(OPT_ARGS_NUM)
  3272. {
  3273. if(action & GMSH_SET)
  3274. CTX::instance()->light[5] = (int)val;
  3275. return CTX::instance()->light[5];
  3276. }
  3277. double opt_general_light50(OPT_ARGS_NUM)
  3278. {
  3279. if(action & GMSH_SET)
  3280. CTX::instance()->lightPosition[5][0] = val;
  3281. return CTX::instance()->lightPosition[5][0];
  3282. }
  3283. double opt_general_light51(OPT_ARGS_NUM)
  3284. {
  3285. if(action & GMSH_SET)
  3286. CTX::instance()->lightPosition[5][1] = val;
  3287. return CTX::instance()->lightPosition[5][1];
  3288. }
  3289. double opt_general_light52(OPT_ARGS_NUM)
  3290. {
  3291. if(action & GMSH_SET)
  3292. CTX::instance()->lightPosition[5][2] = val;
  3293. return CTX::instance()->lightPosition[5][2];
  3294. }
  3295. double opt_general_light53(OPT_ARGS_NUM)
  3296. {
  3297. if(action & GMSH_SET)
  3298. CTX::instance()->lightPosition[5][3] = val;
  3299. return CTX::instance()->lightPosition[5][3];
  3300. }
  3301. double opt_geometry_transform(OPT_ARGS_NUM)
  3302. {
  3303. if(action & GMSH_SET){
  3304. CTX::instance()->geom.useTransform = (int)val;
  3305. if(CTX::instance()->geom.useTransform < 0 ||
  3306. CTX::instance()->geom.useTransform > 1)
  3307. CTX::instance()->geom.useTransform = 0;
  3308. }
  3309. #if defined(HAVE_FLTK)
  3310. if(FlGui::available()){
  3311. if(action & GMSH_GUI)
  3312. FlGui::instance()->options->geo.choice[3]->value
  3313. (CTX::instance()->geom.useTransform);
  3314. if(action & GMSH_SET){
  3315. if(CTX::instance()->geom.useTransform == 1){
  3316. drawTransform *tr = new drawTransformScaled
  3317. (CTX::instance()->geom.transform, CTX::instance()->geom.offset);
  3318. FlGui::instance()->graph[0]->gl[0]->getDrawContext()->setTransform(tr);
  3319. }
  3320. else{
  3321. drawTransform *tr = FlGui::instance()->graph[0]->gl[0]->
  3322. getDrawContext()->getTransform();
  3323. FlGui::instance()->graph[0]->gl[0]->getDrawContext()->setTransform(0);
  3324. if(tr) delete tr;
  3325. }
  3326. }
  3327. FlGui::instance()->options->activate("geo_transform");
  3328. }
  3329. #endif
  3330. return CTX::instance()->geom.useTransform;
  3331. }
  3332. static double _opt_geometry_transform(OPT_ARGS_NUM, int ii, int jj, int nn)
  3333. {
  3334. if(action & GMSH_SET)
  3335. CTX::instance()->geom.transform[ii][jj] = val;
  3336. #if defined(HAVE_FLTK)
  3337. if(FlGui::available()){
  3338. if(action & GMSH_GUI)
  3339. FlGui::instance()->options->geo.value[nn]->value
  3340. (CTX::instance()->geom.transform[ii][jj]);
  3341. if(action & GMSH_SET){
  3342. drawTransform *tr = FlGui::instance()->graph[0]->gl[0]->
  3343. getDrawContext()->getTransform();
  3344. if(tr) tr->setMatrix(CTX::instance()->geom.transform,
  3345. CTX::instance()->geom.offset);
  3346. }
  3347. }
  3348. #endif
  3349. return CTX::instance()->geom.transform[ii][jj];
  3350. }
  3351. double opt_geometry_transform00(OPT_ARGS_NUM)
  3352. {
  3353. return _opt_geometry_transform(num, action, val, 0, 0, 7);
  3354. }
  3355. double opt_geometry_transform01(OPT_ARGS_NUM)
  3356. {
  3357. return _opt_geometry_transform(num, action, val, 0, 1, 8);
  3358. }
  3359. double opt_geometry_transform02(OPT_ARGS_NUM)
  3360. {
  3361. return _opt_geometry_transform(num, action, val, 0, 2, 9);
  3362. }
  3363. double opt_geometry_transform10(OPT_ARGS_NUM)
  3364. {
  3365. return _opt_geometry_transform(num, action, val, 1, 0, 11);
  3366. }
  3367. double opt_geometry_transform11(OPT_ARGS_NUM)
  3368. {
  3369. return _opt_geometry_transform(num, action, val, 1, 1, 12);
  3370. }
  3371. double opt_geometry_transform12(OPT_ARGS_NUM)
  3372. {
  3373. return _opt_geometry_transform(num, action, val, 1, 2, 13);
  3374. }
  3375. double opt_geometry_transform20(OPT_ARGS_NUM)
  3376. {
  3377. return _opt_geometry_transform(num, action, val, 2, 0, 15);
  3378. }
  3379. double opt_geometry_transform21(OPT_ARGS_NUM)
  3380. {
  3381. return _opt_geometry_transform(num, action, val, 2, 1, 16);
  3382. }
  3383. double opt_geometry_transform22(OPT_ARGS_NUM)
  3384. {
  3385. return _opt_geometry_transform(num, action, val, 2, 2, 17);
  3386. }
  3387. static double _opt_geometry_offset(OPT_ARGS_NUM, int ii, int nn)
  3388. {
  3389. if(action & GMSH_SET)
  3390. CTX::instance()->geom.offset[ii] = val;
  3391. #if defined(HAVE_FLTK)
  3392. if(FlGui::available()){
  3393. if(action & GMSH_GUI)
  3394. FlGui::instance()->options->geo.value[nn]->value
  3395. (CTX::instance()->geom.offset[ii]);
  3396. if(action & GMSH_SET){
  3397. drawTransform *tr = FlGui::instance()->graph[0]->gl[0]->
  3398. getDrawContext()->getTransform();
  3399. if(tr) tr->setMatrix(CTX::instance()->geom.transform,
  3400. CTX::instance()->geom.offset);
  3401. }
  3402. }
  3403. #endif
  3404. return CTX::instance()->geom.offset[ii];
  3405. }
  3406. double opt_geometry_offset0(OPT_ARGS_NUM)
  3407. {
  3408. return _opt_geometry_offset(num, action, val, 0, 10);
  3409. }
  3410. double opt_geometry_offset1(OPT_ARGS_NUM)
  3411. {
  3412. return _opt_geometry_offset(num, action, val, 1, 14);
  3413. }
  3414. double opt_geometry_offset2(OPT_ARGS_NUM)
  3415. {
  3416. return _opt_geometry_offset(num, action, val, 2, 18);
  3417. }
  3418. double opt_geometry_auto_coherence(OPT_ARGS_NUM)
  3419. {
  3420. if(action & GMSH_SET)
  3421. CTX::instance()->geom.autoCoherence = (int)val;
  3422. #if defined(HAVE_FLTK)
  3423. if(FlGui::available() && (action & GMSH_GUI))
  3424. FlGui::instance()->options->geo.butt[8]->value
  3425. (CTX::instance()->geom.autoCoherence);
  3426. #endif
  3427. return CTX::instance()->geom.autoCoherence;
  3428. }
  3429. double opt_geometry_hide_compounds(OPT_ARGS_NUM)
  3430. {
  3431. if(action & GMSH_SET)
  3432. CTX::instance()->geom.hideCompounds = (int)val;
  3433. #if defined(HAVE_FLTK)
  3434. if(FlGui::available() && (action & GMSH_GUI)){
  3435. FlGui::instance()->options->geo.butt[17]->value
  3436. (CTX::instance()->geom.hideCompounds);
  3437. }
  3438. #endif
  3439. return CTX::instance()->geom.hideCompounds;
  3440. }
  3441. double opt_geometry_highlight_orphans(OPT_ARGS_NUM)
  3442. {
  3443. if(action & GMSH_SET)
  3444. CTX::instance()->geom.highlightOrphans = (int)val;
  3445. #if defined(HAVE_FLTK)
  3446. if(FlGui::available() && (action & GMSH_GUI))
  3447. FlGui::instance()->options->geo.butt[10]->value
  3448. (CTX::instance()->geom.highlightOrphans);
  3449. #endif
  3450. return CTX::instance()->geom.highlightOrphans;
  3451. }
  3452. double opt_geometry_tolerance(OPT_ARGS_NUM)
  3453. {
  3454. if(action & GMSH_SET)
  3455. CTX::instance()->geom.tolerance = val;
  3456. #if defined(HAVE_FLTK)
  3457. if(FlGui::available() && (action & GMSH_GUI))
  3458. FlGui::instance()->options->geo.value[2]->value
  3459. (CTX::instance()->geom.tolerance);
  3460. #endif
  3461. return CTX::instance()->geom.tolerance;
  3462. }
  3463. double opt_geometry_normals(OPT_ARGS_NUM)
  3464. {
  3465. if(action & GMSH_SET)
  3466. CTX::instance()->geom.normals = val;
  3467. #if defined(HAVE_FLTK)
  3468. if(FlGui::available() && (action & GMSH_GUI))
  3469. FlGui::instance()->options->geo.value[0]->value
  3470. (CTX::instance()->geom.normals);
  3471. #endif
  3472. return CTX::instance()->geom.normals;
  3473. }
  3474. double opt_geometry_tangents(OPT_ARGS_NUM)
  3475. {
  3476. if(action & GMSH_SET)
  3477. CTX::instance()->geom.tangents = val;
  3478. #if defined(HAVE_FLTK)
  3479. if(FlGui::available() && (action & GMSH_GUI))
  3480. FlGui::instance()->options->geo.value[1]->value
  3481. (CTX::instance()->geom.tangents);
  3482. #endif
  3483. return CTX::instance()->geom.tangents;
  3484. }
  3485. double opt_geometry_points(OPT_ARGS_NUM)
  3486. {
  3487. if(action & GMSH_SET)
  3488. CTX::instance()->geom.points = (int)val;
  3489. #if defined(HAVE_FLTK)
  3490. if(FlGui::available() && (action & GMSH_GUI))
  3491. FlGui::instance()->options->geo.butt[0]->value
  3492. (CTX::instance()->geom.points);
  3493. #endif
  3494. return CTX::instance()->geom.points;
  3495. }
  3496. double opt_geometry_lines(OPT_ARGS_NUM)
  3497. {
  3498. if(action & GMSH_SET)
  3499. CTX::instance()->geom.lines = (int)val;
  3500. #if defined(HAVE_FLTK)
  3501. if(FlGui::available() && (action & GMSH_GUI))
  3502. FlGui::instance()->options->geo.butt[1]->value
  3503. (CTX::instance()->geom.lines);
  3504. #endif
  3505. return CTX::instance()->geom.lines;
  3506. }
  3507. double opt_geometry_surfaces(OPT_ARGS_NUM)
  3508. {
  3509. if(action & GMSH_SET)
  3510. CTX::instance()->geom.surfaces = (int)val;
  3511. #if defined(HAVE_FLTK)
  3512. if(FlGui::available() && (action & GMSH_GUI))
  3513. FlGui::instance()->options->geo.butt[2]->value
  3514. (CTX::instance()->geom.surfaces);
  3515. #endif
  3516. return CTX::instance()->geom.surfaces;
  3517. }
  3518. double opt_geometry_volumes(OPT_ARGS_NUM)
  3519. {
  3520. if(action & GMSH_SET)
  3521. CTX::instance()->geom.volumes = (int)val;
  3522. #if defined(HAVE_FLTK)
  3523. if(FlGui::available() && (action & GMSH_GUI))
  3524. FlGui::instance()->options->geo.butt[3]->value
  3525. (CTX::instance()->geom.volumes);
  3526. #endif
  3527. return CTX::instance()->geom.volumes;
  3528. }
  3529. double opt_geometry_points_num(OPT_ARGS_NUM)
  3530. {
  3531. if(action & GMSH_SET)
  3532. CTX::instance()->geom.pointsNum = (int)val;
  3533. #if defined(HAVE_FLTK)
  3534. if(FlGui::available() && (action & GMSH_GUI))
  3535. FlGui::instance()->options->geo.butt[4]->value
  3536. (CTX::instance()->geom.pointsNum);
  3537. #endif
  3538. return CTX::instance()->geom.pointsNum;
  3539. }
  3540. double opt_geometry_lines_num(OPT_ARGS_NUM)
  3541. {
  3542. if(action & GMSH_SET)
  3543. CTX::instance()->geom.linesNum = (int)val;
  3544. #if defined(HAVE_FLTK)
  3545. if(FlGui::available() && (action & GMSH_GUI))
  3546. FlGui::instance()->options->geo.butt[5]->value
  3547. (CTX::instance()->geom.linesNum);
  3548. #endif
  3549. return CTX::instance()->geom.linesNum;
  3550. }
  3551. double opt_geometry_surfaces_num(OPT_ARGS_NUM)
  3552. {
  3553. if(action & GMSH_SET)
  3554. CTX::instance()->geom.surfacesNum = (int)val;
  3555. #if defined(HAVE_FLTK)
  3556. if(FlGui::available() && (action & GMSH_GUI))
  3557. FlGui::instance()->options->geo.butt[6]->value
  3558. (CTX::instance()->geom.surfacesNum);
  3559. #endif
  3560. return CTX::instance()->geom.surfacesNum;
  3561. }
  3562. double opt_geometry_volumes_num(OPT_ARGS_NUM)
  3563. {
  3564. if(action & GMSH_SET)
  3565. CTX::instance()->geom.volumesNum = (int)val;
  3566. #if defined(HAVE_FLTK)
  3567. if(FlGui::available() && (action & GMSH_GUI))
  3568. FlGui::instance()->options->geo.butt[7]->value
  3569. (CTX::instance()->geom.volumesNum);
  3570. #endif
  3571. return CTX::instance()->geom.volumesNum;
  3572. }
  3573. double opt_geometry_point_size(OPT_ARGS_NUM)
  3574. {
  3575. if(action & GMSH_SET)
  3576. CTX::instance()->geom.pointSize = val;
  3577. #if defined(HAVE_FLTK)
  3578. if(FlGui::available() && (action & GMSH_GUI))
  3579. FlGui::instance()->options->geo.value[3]->value
  3580. (CTX::instance()->geom.pointSize);
  3581. #endif
  3582. return CTX::instance()->geom.pointSize;
  3583. }
  3584. double opt_geometry_point_sel_size(OPT_ARGS_NUM)
  3585. {
  3586. if(action & GMSH_SET)
  3587. CTX::instance()->geom.selectedPointSize = val;
  3588. #if defined(HAVE_FLTK)
  3589. if(FlGui::available() && (action & GMSH_GUI))
  3590. FlGui::instance()->options->geo.value[5]->value
  3591. (CTX::instance()->geom.selectedPointSize);
  3592. #endif
  3593. return CTX::instance()->geom.selectedPointSize;
  3594. }
  3595. double opt_geometry_point_type(OPT_ARGS_NUM)
  3596. {
  3597. if(action & GMSH_SET) {
  3598. CTX::instance()->geom.pointType = (int)val;
  3599. }
  3600. #if defined(HAVE_FLTK)
  3601. if(FlGui::available() && (action & GMSH_GUI)) {
  3602. FlGui::instance()->options->geo.choice[0]->value
  3603. (CTX::instance()->geom.pointType);
  3604. }
  3605. #endif
  3606. return CTX::instance()->geom.pointType;
  3607. }
  3608. double opt_geometry_line_width(OPT_ARGS_NUM)
  3609. {
  3610. if(action & GMSH_SET)
  3611. CTX::instance()->geom.lineWidth = val;
  3612. #if defined(HAVE_FLTK)
  3613. if(FlGui::available() && (action & GMSH_GUI))
  3614. FlGui::instance()->options->geo.value[4]->value
  3615. (CTX::instance()->geom.lineWidth);
  3616. #endif
  3617. return CTX::instance()->geom.lineWidth;
  3618. }
  3619. double opt_geometry_line_sel_width(OPT_ARGS_NUM)
  3620. {
  3621. if(action & GMSH_SET)
  3622. CTX::instance()->geom.selectedLineWidth = val;
  3623. #if defined(HAVE_FLTK)
  3624. if(FlGui::available() && (action & GMSH_GUI))
  3625. FlGui::instance()->options->geo.value[6]->value
  3626. (CTX::instance()->geom.selectedLineWidth);
  3627. #endif
  3628. return CTX::instance()->geom.selectedLineWidth;
  3629. }
  3630. double opt_geometry_line_type(OPT_ARGS_NUM)
  3631. {
  3632. if(action & GMSH_SET) {
  3633. CTX::instance()->geom.lineType = (int)val;
  3634. }
  3635. #if defined(HAVE_FLTK)
  3636. if(FlGui::available() && (action & GMSH_GUI)) {
  3637. FlGui::instance()->options->geo.choice[1]->value
  3638. (CTX::instance()->geom.lineType);
  3639. }
  3640. #endif
  3641. return CTX::instance()->geom.lineType;
  3642. }
  3643. double opt_geometry_surface_type(OPT_ARGS_NUM)
  3644. {
  3645. if(action & GMSH_SET) {
  3646. CTX::instance()->geom.surfaceType = (int)val;
  3647. if(CTX::instance()->geom.surfaceType < 0 ||
  3648. CTX::instance()->geom.surfaceType > 2)
  3649. CTX::instance()->geom.surfaceType = 0;
  3650. }
  3651. #if defined(HAVE_FLTK)
  3652. if(FlGui::available() && (action & GMSH_GUI)) {
  3653. FlGui::instance()->options->geo.choice[2]->value
  3654. (CTX::instance()->geom.surfaceType);
  3655. }
  3656. #endif
  3657. return CTX::instance()->geom.surfaceType;
  3658. }
  3659. double opt_geometry_light(OPT_ARGS_NUM)
  3660. {
  3661. if(action & GMSH_SET)
  3662. CTX::instance()->geom.light = (int)val;
  3663. #if defined(HAVE_FLTK)
  3664. if(FlGui::available() && (action & GMSH_GUI)) {
  3665. FlGui::instance()->options->geo.butt[9]->value
  3666. (CTX::instance()->geom.light);
  3667. }
  3668. #endif
  3669. return CTX::instance()->geom.light;
  3670. }
  3671. double opt_geometry_light_two_side(OPT_ARGS_NUM)
  3672. {
  3673. if(action & GMSH_SET)
  3674. CTX::instance()->geom.lightTwoSide = (int)val;
  3675. #if defined(HAVE_FLTK)
  3676. if(FlGui::available() && (action & GMSH_GUI))
  3677. FlGui::instance()->options->geo.butt[14]->value
  3678. (CTX::instance()->geom.lightTwoSide);
  3679. #endif
  3680. return CTX::instance()->geom.lightTwoSide;
  3681. }
  3682. double opt_geometry_occ_fix_degenerated(OPT_ARGS_NUM)
  3683. {
  3684. if(action & GMSH_SET)
  3685. CTX::instance()->geom.occFixDegenerated = val ? 1 : 0;
  3686. #if defined(HAVE_FLTK)
  3687. if(FlGui::available() && (action & GMSH_GUI)) {
  3688. FlGui::instance()->options->geo.butt[16]->value
  3689. (CTX::instance()->geom.occFixDegenerated);
  3690. }
  3691. #endif
  3692. return CTX::instance()->geom.occFixDegenerated;
  3693. }
  3694. double opt_geometry_occ_fix_small_edges(OPT_ARGS_NUM)
  3695. {
  3696. if(action & GMSH_SET)
  3697. CTX::instance()->geom.occFixSmallEdges = val ? 1 : 0;
  3698. #if defined(HAVE_FLTK)
  3699. if(FlGui::available() && (action & GMSH_GUI)) {
  3700. FlGui::instance()->options->geo.butt[11]->value
  3701. (CTX::instance()->geom.occFixSmallEdges);
  3702. }
  3703. #endif
  3704. return CTX::instance()->geom.occFixSmallEdges;
  3705. }
  3706. double opt_geometry_occ_fix_small_faces(OPT_ARGS_NUM)
  3707. {
  3708. if(action & GMSH_SET)
  3709. CTX::instance()->geom.occFixSmallFaces = val ? 1 : 0;
  3710. #if defined(HAVE_FLTK)
  3711. if(FlGui::available() && (action & GMSH_GUI)) {
  3712. FlGui::instance()->options->geo.butt[12]->value
  3713. (CTX::instance()->geom.occFixSmallFaces);
  3714. }
  3715. #endif
  3716. return CTX::instance()->geom.occFixSmallFaces;
  3717. }
  3718. double opt_geometry_occ_sew_faces(OPT_ARGS_NUM)
  3719. {
  3720. if(action & GMSH_SET)
  3721. CTX::instance()->geom.occSewFaces = val ? 1 : 0;
  3722. #if defined(HAVE_FLTK)
  3723. if(FlGui::available() && (action & GMSH_GUI)) {
  3724. FlGui::instance()->options->geo.butt[13]->value
  3725. (CTX::instance()->geom.occSewFaces);
  3726. }
  3727. #endif
  3728. return CTX::instance()->geom.occSewFaces;
  3729. }
  3730. double opt_geometry_occ_connect_faces(OPT_ARGS_NUM)
  3731. {
  3732. if(action & GMSH_SET)
  3733. CTX::instance()->geom.occConnectFaces = val ? 1 : 0;
  3734. #if defined(HAVE_FLTK)
  3735. if(FlGui::available() && (action & GMSH_GUI)) {
  3736. FlGui::instance()->options->geo.butt[15]->value
  3737. (CTX::instance()->geom.occConnectFaces);
  3738. }
  3739. #endif
  3740. return CTX::instance()->geom.occConnectFaces;
  3741. }
  3742. double opt_geometry_old_circle(OPT_ARGS_NUM)
  3743. {
  3744. if(action & GMSH_SET)
  3745. CTX::instance()->geom.oldCircle = (int)val;
  3746. return CTX::instance()->geom.oldCircle;
  3747. }
  3748. double opt_geometry_old_newreg(OPT_ARGS_NUM)
  3749. {
  3750. if(action & GMSH_SET)
  3751. CTX::instance()->geom.oldNewreg = (int)val;
  3752. return CTX::instance()->geom.oldNewreg;
  3753. }
  3754. double opt_geometry_num_sub_edges(OPT_ARGS_NUM)
  3755. {
  3756. if(action & GMSH_SET){
  3757. CTX::instance()->geom.numSubEdges = (int)val;
  3758. if(CTX::instance()->geom.numSubEdges < 1)
  3759. CTX::instance()->geom.numSubEdges = 1;
  3760. }
  3761. #if defined(HAVE_FLTK)
  3762. if(FlGui::available() && (action & GMSH_GUI)) {
  3763. FlGui::instance()->options->geo.value[19]->value
  3764. (CTX::instance()->geom.numSubEdges);
  3765. }
  3766. #endif
  3767. return CTX::instance()->geom.numSubEdges;
  3768. }
  3769. double opt_geometry_extrude_spline_points(OPT_ARGS_NUM)
  3770. {
  3771. if(action & GMSH_SET)
  3772. CTX::instance()->geom.extrudeSplinePoints = (int)val;
  3773. return CTX::instance()->geom.extrudeSplinePoints;
  3774. }
  3775. double opt_geometry_extrude_return_lateral(OPT_ARGS_NUM)
  3776. {
  3777. if(action & GMSH_SET)
  3778. CTX::instance()->geom.extrudeReturnLateral = (int)val;
  3779. return CTX::instance()->geom.extrudeReturnLateral;
  3780. }
  3781. double opt_geometry_scaling_factor(OPT_ARGS_NUM)
  3782. {
  3783. if(action & GMSH_SET)
  3784. CTX::instance()->geom.scalingFactor = val;
  3785. return CTX::instance()->geom.scalingFactor;
  3786. }
  3787. double opt_geometry_snap0(OPT_ARGS_NUM)
  3788. {
  3789. if(action & GMSH_SET)
  3790. CTX::instance()->geom.snap[0] = val;
  3791. #if defined(HAVE_FLTK)
  3792. if(FlGui::available() && (action & GMSH_GUI))
  3793. FlGui::instance()->geoContext->value[0]->value
  3794. (CTX::instance()->geom.snap[0]);
  3795. #endif
  3796. return CTX::instance()->geom.snap[0];
  3797. }
  3798. double opt_geometry_snap1(OPT_ARGS_NUM)
  3799. {
  3800. if(action & GMSH_SET)
  3801. CTX::instance()->geom.snap[1] = val;
  3802. #if defined(HAVE_FLTK)
  3803. if(FlGui::available() && (action & GMSH_GUI))
  3804. FlGui::instance()->geoContext->value[1]->value
  3805. (CTX::instance()->geom.snap[1]);
  3806. #endif
  3807. return CTX::instance()->geom.snap[1];
  3808. }
  3809. double opt_geometry_snap2(OPT_ARGS_NUM)
  3810. {
  3811. if(action & GMSH_SET)
  3812. CTX::instance()->geom.snap[2] = val;
  3813. #if defined(HAVE_FLTK)
  3814. if(FlGui::available() && (action & GMSH_GUI))
  3815. FlGui::instance()->geoContext->value[2]->value
  3816. (CTX::instance()->geom.snap[2]);
  3817. #endif
  3818. return CTX::instance()->geom.snap[2];
  3819. }
  3820. double opt_geometry_clip(OPT_ARGS_NUM)
  3821. {
  3822. if(action & GMSH_SET)
  3823. CTX::instance()->geom.clip = (int)val;
  3824. #if defined(HAVE_FLTK)
  3825. if(FlGui::available() && (action & GMSH_GUI))
  3826. FlGui::instance()->clipping->resetBrowser();
  3827. #endif
  3828. return CTX::instance()->geom.clip;
  3829. }
  3830. double opt_geometry_copy_meshing_method(OPT_ARGS_NUM)
  3831. {
  3832. if(action & GMSH_SET)
  3833. CTX::instance()->geom.copyMeshingMethod = (int)val;
  3834. return CTX::instance()->geom.copyMeshingMethod;
  3835. }
  3836. double opt_geometry_exact_extrusion(OPT_ARGS_NUM)
  3837. {
  3838. if(action & GMSH_SET)
  3839. CTX::instance()->geom.exactExtrusion = (int)val;
  3840. return CTX::instance()->geom.exactExtrusion;
  3841. }
  3842. double opt_geometry_match_geom_and_mesh(OPT_ARGS_NUM)
  3843. {
  3844. if(action & GMSH_SET)
  3845. CTX::instance()->geom.matchGeomAndMesh = (int)val;
  3846. return CTX::instance()->geom.matchGeomAndMesh;
  3847. }
  3848. double opt_mesh_optimize(OPT_ARGS_NUM)
  3849. {
  3850. if(action & GMSH_SET)
  3851. CTX::instance()->mesh.optimize = (int)val;
  3852. #if defined(HAVE_FLTK)
  3853. if(FlGui::available() && (action & GMSH_GUI))
  3854. FlGui::instance()->options->mesh.butt[2]->value
  3855. (CTX::instance()->mesh.optimize);
  3856. #endif
  3857. return CTX::instance()->mesh.optimize;
  3858. }
  3859. double opt_mesh_optimize_netgen(OPT_ARGS_NUM)
  3860. {
  3861. if(action & GMSH_SET)
  3862. CTX::instance()->mesh.optimizeNetgen = (int)val;
  3863. #if defined(HAVE_FLTK)
  3864. if(FlGui::available() && (action & GMSH_GUI))
  3865. FlGui::instance()->options->mesh.butt[24]->value
  3866. (CTX::instance()->mesh.optimizeNetgen);
  3867. #endif
  3868. return CTX::instance()->mesh.optimizeNetgen;
  3869. }
  3870. double opt_mesh_remove_4_triangles(OPT_ARGS_NUM)
  3871. {
  3872. if(action & GMSH_SET)
  3873. CTX::instance()->mesh.remove4triangles = (int)val;
  3874. #if defined(HAVE_FLTK)
  3875. if(FlGui::available() && (action & GMSH_GUI))
  3876. FlGui::instance()->options->mesh.butt[25]->value
  3877. (CTX::instance()->mesh.remove4triangles);
  3878. #endif
  3879. return CTX::instance()->mesh.remove4triangles;
  3880. }
  3881. double opt_mesh_refine_steps(OPT_ARGS_NUM)
  3882. {
  3883. if(action & GMSH_SET)
  3884. CTX::instance()->mesh.refineSteps = (int)val;
  3885. return CTX::instance()->mesh.refineSteps;
  3886. }
  3887. double opt_mesh_normals(OPT_ARGS_NUM)
  3888. {
  3889. if(action & GMSH_SET) {
  3890. CTX::instance()->mesh.normals = val;
  3891. }
  3892. #if defined(HAVE_FLTK)
  3893. if(FlGui::available() && (action & GMSH_GUI))
  3894. FlGui::instance()->options->mesh.value[8]->value
  3895. (CTX::instance()->mesh.normals);
  3896. #endif
  3897. return CTX::instance()->mesh.normals;
  3898. }
  3899. double opt_mesh_num_sub_edges(OPT_ARGS_NUM)
  3900. {
  3901. if(action & GMSH_SET){
  3902. if(CTX::instance()->mesh.numSubEdges != val)
  3903. CTX::instance()->mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
  3904. CTX::instance()->mesh.numSubEdges = (int)val;
  3905. if(CTX::instance()->mesh.numSubEdges < 1)
  3906. CTX::instance()->mesh.numSubEdges = 1;
  3907. }
  3908. #if defined(HAVE_FLTK)
  3909. if(FlGui::available() && (action & GMSH_GUI))
  3910. FlGui::instance()->options->mesh.value[14]->value
  3911. (CTX::instance()->mesh.numSubEdges);
  3912. #endif
  3913. return CTX::instance()->mesh.numSubEdges;
  3914. }
  3915. double opt_mesh_tangents(OPT_ARGS_NUM)
  3916. {
  3917. if(action & GMSH_SET) {
  3918. CTX::instance()->mesh.tangents = val;
  3919. }
  3920. #if defined(HAVE_FLTK)
  3921. if(FlGui::available() && (action & GMSH_GUI))
  3922. FlGui::instance()->options->mesh.value[13]->value
  3923. (CTX::instance()->mesh.tangents);
  3924. #endif
  3925. return CTX::instance()->mesh.tangents;
  3926. }
  3927. double opt_mesh_explode(OPT_ARGS_NUM)
  3928. {
  3929. if(action & GMSH_SET) {
  3930. if(CTX::instance()->mesh.explode != val)
  3931. CTX::instance()->mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
  3932. CTX::instance()->mesh.explode = val;
  3933. }
  3934. #if defined(HAVE_FLTK)
  3935. if(FlGui::available() && (action & GMSH_GUI))
  3936. FlGui::instance()->options->mesh.value[9]->value
  3937. (CTX::instance()->mesh.explode);
  3938. #endif
  3939. return CTX::instance()->mesh.explode;
  3940. }
  3941. double opt_mesh_scaling_factor(OPT_ARGS_NUM)
  3942. {
  3943. if(action & GMSH_SET)
  3944. CTX::instance()->mesh.scalingFactor = val;
  3945. return CTX::instance()->mesh.scalingFactor;
  3946. }
  3947. double opt_mesh_lc_factor(OPT_ARGS_NUM)
  3948. {
  3949. if(action & GMSH_SET){
  3950. if(val > 0)
  3951. CTX::instance()->mesh.lcFactor = val;
  3952. }
  3953. #if defined(HAVE_FLTK)
  3954. if(FlGui::available() && (action & GMSH_GUI))
  3955. FlGui::instance()->options->mesh.value[2]->value
  3956. (CTX::instance()->mesh.lcFactor);
  3957. #endif
  3958. return CTX::instance()->mesh.lcFactor;
  3959. }
  3960. double opt_mesh_lc_min(OPT_ARGS_NUM)
  3961. {
  3962. if(action & GMSH_SET)
  3963. CTX::instance()->mesh.lcMin = val;
  3964. #if defined(HAVE_FLTK)
  3965. if(FlGui::available() && (action & GMSH_GUI))
  3966. FlGui::instance()->options->mesh.value[25]->value
  3967. (CTX::instance()->mesh.lcMin);
  3968. #endif
  3969. return CTX::instance()->mesh.lcMin;
  3970. }
  3971. double opt_mesh_lc_max(OPT_ARGS_NUM)
  3972. {
  3973. if(action & GMSH_SET)
  3974. CTX::instance()->mesh.lcMax = val;
  3975. #if defined(HAVE_FLTK)
  3976. if(FlGui::available() && (action & GMSH_GUI))
  3977. FlGui::instance()->options->mesh.value[26]->value
  3978. (CTX::instance()->mesh.lcMax);
  3979. #endif
  3980. return CTX::instance()->mesh.lcMax;
  3981. }
  3982. double opt_mesh_tolerance_edge_length(OPT_ARGS_NUM)
  3983. {
  3984. if(action & GMSH_SET)
  3985. CTX::instance()->mesh.toleranceEdgeLength = val;
  3986. return CTX::instance()->mesh.toleranceEdgeLength;
  3987. }
  3988. double opt_mesh_lc_from_curvature(OPT_ARGS_NUM)
  3989. {
  3990. if(action & GMSH_SET)
  3991. CTX::instance()->mesh.lcFromCurvature = (int)val;
  3992. #if defined(HAVE_FLTK)
  3993. if(FlGui::available() && (action & GMSH_GUI))
  3994. FlGui::instance()->options->mesh.butt[1]->value
  3995. (CTX::instance()->mesh.lcFromCurvature ? 1 : 0);
  3996. #endif
  3997. return CTX::instance()->mesh.lcFromCurvature;
  3998. }
  3999. double opt_mesh_lc_from_points(OPT_ARGS_NUM)
  4000. {
  4001. if(action & GMSH_SET)
  4002. CTX::instance()->mesh.lcFromPoints = (int)val;
  4003. #if defined(HAVE_FLTK)
  4004. if(FlGui::available() && (action & GMSH_GUI))
  4005. FlGui::instance()->options->mesh.butt[5]->value
  4006. (CTX::instance()->mesh.lcFromPoints ? 1 : 0);
  4007. #endif
  4008. return CTX::instance()->mesh.lcFromPoints;
  4009. }
  4010. double opt_mesh_lc_extend_from_boundary(OPT_ARGS_NUM)
  4011. {
  4012. if(action & GMSH_SET)
  4013. CTX::instance()->mesh.lcExtendFromBoundary = (int)val;
  4014. #if defined(HAVE_FLTK)
  4015. if(FlGui::available() && (action & GMSH_GUI))
  4016. FlGui::instance()->options->mesh.butt[16]->value
  4017. (CTX::instance()->mesh.lcExtendFromBoundary ? 1 : 0);
  4018. #endif
  4019. return CTX::instance()->mesh.lcExtendFromBoundary;
  4020. }
  4021. double opt_mesh_lc_integration_precision(OPT_ARGS_NUM)
  4022. {
  4023. if(action & GMSH_SET)
  4024. CTX::instance()->mesh.lcIntegrationPrecision = val;
  4025. return CTX::instance()->mesh.lcIntegrationPrecision;
  4026. }
  4027. double opt_mesh_rand_factor(OPT_ARGS_NUM)
  4028. {
  4029. if(action & GMSH_SET)
  4030. CTX::instance()->mesh.randFactor = val;
  4031. return CTX::instance()->mesh.randFactor;
  4032. }
  4033. double opt_mesh_quality_type(OPT_ARGS_NUM)
  4034. {
  4035. if(action & GMSH_SET) {
  4036. if(CTX::instance()->mesh.qualityType != val)
  4037. CTX::instance()->mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
  4038. CTX::instance()->mesh.qualityType = (int)val;
  4039. if(CTX::instance()->mesh.qualityType < 0 || CTX::instance()->mesh.qualityType > 3)
  4040. CTX::instance()->mesh.qualityType = 0;
  4041. }
  4042. #if defined(HAVE_FLTK)
  4043. if(FlGui::available() && (action & GMSH_GUI)){
  4044. FlGui::instance()->options->mesh.choice[6]->value
  4045. (CTX::instance()->mesh.qualityType);
  4046. }
  4047. #endif
  4048. return CTX::instance()->mesh.qualityType;
  4049. }
  4050. double opt_mesh_quality_inf(OPT_ARGS_NUM)
  4051. {
  4052. if(action & GMSH_SET) {
  4053. if(CTX::instance()->mesh.qualityInf != val)
  4054. CTX::instance()->mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
  4055. CTX::instance()->mesh.qualityInf = val;
  4056. }
  4057. #if defined(HAVE_FLTK)
  4058. if(FlGui::available() && (action & GMSH_GUI))
  4059. FlGui::instance()->options->mesh.value[4]->value
  4060. (CTX::instance()->mesh.qualityInf);
  4061. #endif
  4062. return CTX::instance()->mesh.qualityInf;
  4063. }
  4064. double opt_mesh_quality_sup(OPT_ARGS_NUM)
  4065. {
  4066. if(action & GMSH_SET) {
  4067. if(CTX::instance()->mesh.qualitySup != val)
  4068. CTX::instance()->mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
  4069. CTX::instance()->mesh.qualitySup = val;
  4070. }
  4071. #if defined(HAVE_FLTK)
  4072. if(FlGui::available() && (action & GMSH_GUI))
  4073. FlGui::instance()->options->mesh.value[5]->value
  4074. (CTX::instance()->mesh.qualitySup);
  4075. #endif
  4076. return CTX::instance()->mesh.qualitySup;
  4077. }
  4078. double opt_mesh_radius_inf(OPT_ARGS_NUM)
  4079. {
  4080. if(action & GMSH_SET) {
  4081. if(CTX::instance()->mesh.radiusInf != val)
  4082. CTX::instance()->mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
  4083. CTX::instance()->mesh.radiusInf = val;
  4084. }
  4085. #if defined(HAVE_FLTK)
  4086. if(FlGui::available() && (action & GMSH_GUI))
  4087. FlGui::instance()->options->mesh.value[6]->value
  4088. (CTX::instance()->mesh.radiusInf);
  4089. #endif
  4090. return CTX::instance()->mesh.radiusInf;
  4091. }
  4092. double opt_mesh_radius_sup(OPT_ARGS_NUM)
  4093. {
  4094. if(action & GMSH_SET) {
  4095. if(CTX::instance()->mesh.radiusSup != val)
  4096. CTX::instance()->mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
  4097. CTX::instance()->mesh.radiusSup = val;
  4098. }
  4099. #if defined(HAVE_FLTK)
  4100. if(FlGui::available() && (action & GMSH_GUI))
  4101. FlGui::instance()->options->mesh.value[7]->value
  4102. (CTX::instance()->mesh.radiusSup);
  4103. #endif
  4104. return CTX::instance()->mesh.radiusSup;
  4105. }
  4106. double opt_mesh_label_type(OPT_ARGS_NUM)
  4107. {
  4108. if(action & GMSH_SET) {
  4109. CTX::instance()->mesh.labelType = (int)val;
  4110. if(CTX::instance()->mesh.labelType < 0 || CTX::instance()->mesh.labelType > 4)
  4111. CTX::instance()->mesh.labelType = 0;
  4112. }
  4113. #if defined(HAVE_FLTK)
  4114. if(FlGui::available() && (action & GMSH_GUI)){
  4115. FlGui::instance()->options->mesh.choice[7]->value
  4116. (CTX::instance()->mesh.labelType);
  4117. }
  4118. #endif
  4119. return CTX::instance()->mesh.labelType;
  4120. }
  4121. double opt_mesh_points(OPT_ARGS_NUM)
  4122. {
  4123. if(action & GMSH_SET) {
  4124. CTX::instance()->mesh.points = (int)val;
  4125. }
  4126. #if defined(HAVE_FLTK)
  4127. if(FlGui::available() && (action & GMSH_GUI))
  4128. FlGui::instance()->options->mesh.butt[6]->value
  4129. (CTX::instance()->mesh.points);
  4130. #endif
  4131. return CTX::instance()->mesh.points;
  4132. }
  4133. double opt_mesh_lines(OPT_ARGS_NUM)
  4134. {
  4135. if(action & GMSH_SET) {
  4136. if(CTX::instance()->mesh.lines != val)
  4137. CTX::instance()->mesh.changed |= ENT_LINE;
  4138. CTX::instance()->mesh.lines = (int)val;
  4139. }
  4140. #if defined(HAVE_FLTK)
  4141. if(FlGui::available() && (action & GMSH_GUI))
  4142. FlGui::instance()->options->mesh.butt[7]->value
  4143. (CTX::instance()->mesh.lines);
  4144. #endif
  4145. return CTX::instance()->mesh.lines;
  4146. }
  4147. double opt_mesh_triangles(OPT_ARGS_NUM)
  4148. {
  4149. if(action & GMSH_SET) {
  4150. if(CTX::instance()->mesh.triangles != val)
  4151. CTX::instance()->mesh.changed |= ENT_SURFACE;
  4152. CTX::instance()->mesh.triangles = (int)val;
  4153. }
  4154. #if defined(HAVE_FLTK)
  4155. if(FlGui::available() && (action & GMSH_GUI)){
  4156. if(CTX::instance()->mesh.triangles)
  4157. ((Fl_Menu_Item*)FlGui::instance()->options->mesh.menu->menu())[0].set();
  4158. else
  4159. ((Fl_Menu_Item*)FlGui::instance()->options->mesh.menu->menu())[0].clear();
  4160. }
  4161. #endif
  4162. return CTX::instance()->mesh.triangles;
  4163. }
  4164. double opt_mesh_quadrangles(OPT_ARGS_NUM)
  4165. {
  4166. if(action & GMSH_SET) {
  4167. if(CTX::instance()->mesh.quadrangles != val)
  4168. CTX::instance()->mesh.changed |= ENT_SURFACE;
  4169. CTX::instance()->mesh.quadrangles = (int)val;
  4170. }
  4171. #if defined(HAVE_FLTK)
  4172. if(FlGui::available() && (action & GMSH_GUI)){
  4173. if(CTX::instance()->mesh.quadrangles)
  4174. ((Fl_Menu_Item*)FlGui::instance()->options->mesh.menu->menu())[1].set();
  4175. else
  4176. ((Fl_Menu_Item*)FlGui::instance()->options->mesh.menu->menu())[1].clear();
  4177. }
  4178. #endif
  4179. return CTX::instance()->mesh.quadrangles;
  4180. }
  4181. double opt_mesh_tetrahedra(OPT_ARGS_NUM)
  4182. {
  4183. if(action & GMSH_SET) {
  4184. if(CTX::instance()->mesh.tetrahedra != val)
  4185. CTX::instance()->mesh.changed |= ENT_VOLUME;
  4186. CTX::instance()->mesh.tetrahedra = (int)val;
  4187. }
  4188. #if defined(HAVE_FLTK)
  4189. if(FlGui::available() && (action & GMSH_GUI)){
  4190. if(CTX::instance()->mesh.tetrahedra)
  4191. ((Fl_Menu_Item*)FlGui::instance()->options->mesh.menu->menu())[2].set();
  4192. else
  4193. ((Fl_Menu_Item*)FlGui::instance()->options->mesh.menu->menu())[2].clear();
  4194. }
  4195. #endif
  4196. return CTX::instance()->mesh.tetrahedra;
  4197. }
  4198. double opt_mesh_hexahedra(OPT_ARGS_NUM)
  4199. {
  4200. if(action & GMSH_SET) {
  4201. if(CTX::instance()->mesh.hexahedra != val)
  4202. CTX::instance()->mesh.changed |= ENT_VOLUME;
  4203. CTX::instance()->mesh.hexahedra = (int)val;
  4204. }
  4205. #if defined(HAVE_FLTK)
  4206. if(FlGui::available() && (action & GMSH_GUI)){
  4207. if(CTX::instance()->mesh.hexahedra)
  4208. ((Fl_Menu_Item*)FlGui::instance()->options->mesh.menu->menu())[3].set();
  4209. else
  4210. ((Fl_Menu_Item*)FlGui::instance()->options->mesh.menu->menu())[3].clear();
  4211. }
  4212. #endif
  4213. return CTX::instance()->mesh.hexahedra;
  4214. }
  4215. double opt_mesh_prisms(OPT_ARGS_NUM)
  4216. {
  4217. if(action & GMSH_SET) {
  4218. if(CTX::instance()->mesh.prisms != val)
  4219. CTX::instance()->mesh.changed |= ENT_VOLUME;
  4220. CTX::instance()->mesh.prisms = (int)val;
  4221. }
  4222. #if defined(HAVE_FLTK)
  4223. if(FlGui::available() && (action & GMSH_GUI)){
  4224. if(CTX::instance()->mesh.prisms)
  4225. ((Fl_Menu_Item*)FlGui::instance()->options->mesh.menu->menu())[4].set();
  4226. else
  4227. ((Fl_Menu_Item*)FlGui::instance()->options->mesh.menu->menu())[4].clear();
  4228. }
  4229. #endif
  4230. return CTX::instance()->mesh.prisms;
  4231. }
  4232. double opt_mesh_pyramids(OPT_ARGS_NUM)
  4233. {
  4234. if(action & GMSH_SET) {
  4235. if(CTX::instance()->mesh.pyramids != val)
  4236. CTX::instance()->mesh.changed |= ENT_VOLUME;
  4237. CTX::instance()->mesh.pyramids = (int)val;
  4238. }
  4239. #if defined(HAVE_FLTK)
  4240. if(FlGui::available() && (action & GMSH_GUI)){
  4241. if(CTX::instance()->mesh.pyramids)
  4242. ((Fl_Menu_Item*)FlGui::instance()->options->mesh.menu->menu())[5].set();
  4243. else
  4244. ((Fl_Menu_Item*)FlGui::instance()->options->mesh.menu->menu())[5].clear();
  4245. }
  4246. #endif
  4247. return CTX::instance()->mesh.pyramids;
  4248. }
  4249. double opt_mesh_surfaces_edges(OPT_ARGS_NUM)
  4250. {
  4251. if(action & GMSH_SET) {
  4252. if(CTX::instance()->mesh.surfacesEdges != val)
  4253. CTX::instance()->mesh.changed |= ENT_SURFACE;
  4254. CTX::instance()->mesh.surfacesEdges = (int)val;
  4255. }
  4256. #if defined(HAVE_FLTK)
  4257. if(FlGui::available() && (action & GMSH_GUI))
  4258. FlGui::instance()->options->mesh.butt[8]->value
  4259. (CTX::instance()->mesh.surfacesEdges);
  4260. #endif
  4261. return CTX::instance()->mesh.surfacesEdges;
  4262. }
  4263. double opt_mesh_surfaces_faces(OPT_ARGS_NUM)
  4264. {
  4265. if(action & GMSH_SET) {
  4266. if(CTX::instance()->mesh.surfacesFaces != val)
  4267. CTX::instance()->mesh.changed |= ENT_SURFACE;
  4268. CTX::instance()->mesh.surfacesFaces = (int)val;
  4269. }
  4270. #if defined(HAVE_FLTK)
  4271. if(FlGui::available() && (action & GMSH_GUI))
  4272. FlGui::instance()->options->mesh.butt[9]->value
  4273. (CTX::instance()->mesh.surfacesFaces);
  4274. #endif
  4275. return CTX::instance()->mesh.surfacesFaces;
  4276. }
  4277. double opt_mesh_volumes_edges(OPT_ARGS_NUM)
  4278. {
  4279. if(action & GMSH_SET) {
  4280. if(CTX::instance()->mesh.volumesEdges != val)
  4281. CTX::instance()->mesh.changed |= ENT_VOLUME;
  4282. CTX::instance()->mesh.volumesEdges = (int)val;
  4283. }
  4284. #if defined(HAVE_FLTK)
  4285. if(FlGui::available() && (action & GMSH_GUI))
  4286. FlGui::instance()->options->mesh.butt[10]->value
  4287. (CTX::instance()->mesh.volumesEdges);
  4288. #endif
  4289. return CTX::instance()->mesh.volumesEdges;
  4290. }
  4291. double opt_mesh_volumes_faces(OPT_ARGS_NUM)
  4292. {
  4293. if(action & GMSH_SET) {
  4294. if(CTX::instance()->mesh.volumesFaces != val)
  4295. CTX::instance()->mesh.changed |= ENT_VOLUME;
  4296. CTX::instance()->mesh.volumesFaces = (int)val;
  4297. }
  4298. #if defined(HAVE_FLTK)
  4299. if(FlGui::available() && (action & GMSH_GUI))
  4300. FlGui::instance()->options->mesh.butt[11]->value
  4301. (CTX::instance()->mesh.volumesFaces);
  4302. #endif
  4303. return CTX::instance()->mesh.volumesFaces;
  4304. }
  4305. double opt_mesh_points_num(OPT_ARGS_NUM)
  4306. {
  4307. if(action & GMSH_SET) {
  4308. CTX::instance()->mesh.pointsNum = (int)val;
  4309. }
  4310. #if defined(HAVE_FLTK)
  4311. if(FlGui::available() && (action & GMSH_GUI))
  4312. FlGui::instance()->options->mesh.butt[12]->value
  4313. (CTX::instance()->mesh.pointsNum);
  4314. #endif
  4315. return CTX::instance()->mesh.pointsNum;
  4316. }
  4317. double opt_mesh_lines_num(OPT_ARGS_NUM)
  4318. {
  4319. if(action & GMSH_SET) {
  4320. CTX::instance()->mesh.linesNum = (int)val;
  4321. }
  4322. #if defined(HAVE_FLTK)
  4323. if(FlGui::available() && (action & GMSH_GUI))
  4324. FlGui::instance()->options->mesh.butt[13]->value
  4325. (CTX::instance()->mesh.linesNum);
  4326. #endif
  4327. return CTX::instance()->mesh.linesNum;
  4328. }
  4329. double opt_mesh_surfaces_num(OPT_ARGS_NUM)
  4330. {
  4331. if(action & GMSH_SET) {
  4332. CTX::instance()->mesh.surfacesNum = (int)val;
  4333. }
  4334. #if defined(HAVE_FLTK)
  4335. if(FlGui::available() && (action & GMSH_GUI))
  4336. FlGui::instance()->options->mesh.butt[14]->value
  4337. (CTX::instance()->mesh.surfacesNum);
  4338. #endif
  4339. return CTX::instance()->mesh.surfacesNum;
  4340. }
  4341. double opt_mesh_volumes_num(OPT_ARGS_NUM)
  4342. {
  4343. if(action & GMSH_SET) {
  4344. CTX::instance()->mesh.volumesNum = (int)val;
  4345. }
  4346. #if defined(HAVE_FLTK)
  4347. if(FlGui::available() && (action & GMSH_GUI))
  4348. FlGui::instance()->options->mesh.butt[15]->value
  4349. (CTX::instance()->mesh.volumesNum);
  4350. #endif
  4351. return CTX::instance()->mesh.volumesNum;
  4352. }
  4353. double opt_mesh_point_size(OPT_ARGS_NUM)
  4354. {
  4355. if(action & GMSH_SET) {
  4356. CTX::instance()->mesh.pointSize = val;
  4357. }
  4358. #if defined(HAVE_FLTK)
  4359. if(FlGui::available() && (action & GMSH_GUI))
  4360. FlGui::instance()->options->mesh.value[10]->value
  4361. (CTX::instance()->mesh.pointSize);
  4362. #endif
  4363. return CTX::instance()->mesh.pointSize;
  4364. }
  4365. double opt_mesh_point_type(OPT_ARGS_NUM)
  4366. {
  4367. if(action & GMSH_SET) {
  4368. CTX::instance()->mesh.pointType = (int)val;
  4369. }
  4370. #if defined(HAVE_FLTK)
  4371. if(FlGui::available() && (action & GMSH_GUI)) {
  4372. FlGui::instance()->options->mesh.choice[0]->value
  4373. (CTX::instance()->mesh.pointType ? 1 : 0);
  4374. }
  4375. #endif
  4376. return CTX::instance()->mesh.pointType;
  4377. }
  4378. double opt_mesh_line_width(OPT_ARGS_NUM)
  4379. {
  4380. if(action & GMSH_SET) {
  4381. CTX::instance()->mesh.lineWidth = val;
  4382. }
  4383. #if defined(HAVE_FLTK)
  4384. if(FlGui::available() && (action & GMSH_GUI))
  4385. FlGui::instance()->options->mesh.value[11]->value
  4386. (CTX::instance()->mesh.lineWidth);
  4387. #endif
  4388. return CTX::instance()->mesh.lineWidth;
  4389. }
  4390. double opt_mesh_label_sampling(OPT_ARGS_NUM)
  4391. {
  4392. if(action & GMSH_SET) {
  4393. CTX::instance()->mesh.labelSampling = (int)val;
  4394. }
  4395. #if defined(HAVE_FLTK)
  4396. if(FlGui::available() && (action & GMSH_GUI))
  4397. FlGui::instance()->options->mesh.value[12]->value
  4398. (CTX::instance()->mesh.labelSampling);
  4399. #endif
  4400. return CTX::instance()->mesh.labelSampling;
  4401. }
  4402. double opt_mesh_reverse_all_normals(OPT_ARGS_NUM)
  4403. {
  4404. if(action & GMSH_SET) {
  4405. if(CTX::instance()->mesh.reverseAllNormals != val)
  4406. CTX::instance()->mesh.changed |= (ENT_SURFACE | ENT_VOLUME);
  4407. CTX::instance()->mesh.reverseAllNormals = (int)val;
  4408. }
  4409. #if defined(HAVE_FLTK)
  4410. if(FlGui::available() && (action & GMSH_GUI))
  4411. FlGui::instance()->options->mesh.butt[0]->value
  4412. (CTX::instance()->mesh.reverseAllNormals);
  4413. #endif
  4414. return CTX::instance()->mesh.reverseAllNormals;
  4415. }
  4416. double opt_mesh_smooth_normals(OPT_ARGS_NUM)
  4417. {
  4418. if(action & GMSH_SET) {
  4419. if(CTX::instance()->mesh.smoothNormals != val)
  4420. CTX::instance()->mesh.changed |= ENT_SURFACE;
  4421. CTX::instance()->mesh.smoothNormals = (int)val;
  4422. }
  4423. #if defined(HAVE_FLTK)
  4424. if(FlGui::available() && (action & GMSH_GUI))
  4425. FlGui::instance()->options->mesh.butt[19]->value
  4426. (CTX::instance()->mesh.smoothNormals);
  4427. #endif
  4428. return CTX::instance()->mesh.smoothNormals;
  4429. }
  4430. double opt_mesh_smooth_ratio(OPT_ARGS_NUM)
  4431. {
  4432. if(action & GMSH_SET)
  4433. CTX::instance()->mesh.smoothRatio = val;
  4434. return CTX::instance()->mesh.smoothRatio;
  4435. }
  4436. double opt_mesh_aniso_max(OPT_ARGS_NUM)
  4437. {
  4438. if(action & GMSH_SET)
  4439. CTX::instance()->mesh.anisoMax = val;
  4440. return CTX::instance()->mesh.anisoMax;
  4441. }
  4442. double opt_mesh_angle_smooth_normals(OPT_ARGS_NUM)
  4443. {
  4444. if(action & GMSH_SET) {
  4445. if(CTX::instance()->mesh.angleSmoothNormals != val)
  4446. CTX::instance()->mesh.changed |= ENT_SURFACE;
  4447. CTX::instance()->mesh.angleSmoothNormals = val;
  4448. }
  4449. #if defined(HAVE_FLTK)
  4450. if(FlGui::available() && (action & GMSH_GUI))
  4451. FlGui::instance()->options->mesh.value[18]->value
  4452. (CTX::instance()->mesh.angleSmoothNormals);
  4453. #endif
  4454. return CTX::instance()->mesh.angleSmoothNormals;
  4455. }
  4456. double opt_mesh_light(OPT_ARGS_NUM)
  4457. {
  4458. if(action & GMSH_SET)
  4459. CTX::instance()->mesh.light = (int)val;
  4460. #if defined(HAVE_FLTK)
  4461. if(FlGui::available() && (action & GMSH_GUI)){
  4462. FlGui::instance()->options->mesh.butt[17]->value
  4463. (CTX::instance()->mesh.light);
  4464. FlGui::instance()->options->activate("mesh_light");
  4465. }
  4466. #endif
  4467. return CTX::instance()->mesh.light;
  4468. }
  4469. double opt_mesh_light_lines(OPT_ARGS_NUM)
  4470. {
  4471. if(action & GMSH_SET)
  4472. CTX::instance()->mesh.lightLines = (int)val;
  4473. #if defined(HAVE_FLTK)
  4474. if(FlGui::available() && (action & GMSH_GUI))
  4475. FlGui::instance()->options->mesh.butt[20]->value
  4476. (CTX::instance()->mesh.lightLines);
  4477. #endif
  4478. return CTX::instance()->mesh.lightLines;
  4479. }
  4480. double opt_mesh_light_two_side(OPT_ARGS_NUM)
  4481. {
  4482. if(action & GMSH_SET)
  4483. CTX::instance()->mesh.lightTwoSide = (int)val;
  4484. #if defined(HAVE_FLTK)
  4485. if(FlGui::available() && (action & GMSH_GUI))
  4486. FlGui::instance()->options->mesh.butt[18]->value
  4487. (CTX::instance()->mesh.lightTwoSide);
  4488. #endif
  4489. return CTX::instance()->mesh.lightTwoSide;
  4490. }
  4491. double opt_mesh_file_format(OPT_ARGS_NUM)
  4492. {
  4493. if(action & GMSH_SET)
  4494. CTX::instance()->mesh.fileFormat = (int)val;
  4495. return CTX::instance()->mesh.fileFormat;
  4496. }
  4497. double opt_mesh_msh_file_version(OPT_ARGS_NUM)
  4498. {
  4499. if(action & GMSH_SET)
  4500. CTX::instance()->mesh.mshFileVersion = val;
  4501. return CTX::instance()->mesh.mshFileVersion;
  4502. }
  4503. double opt_mesh_msh_file_partitioned(OPT_ARGS_NUM)
  4504. {
  4505. if(action & GMSH_SET)
  4506. CTX::instance()->mesh.mshFilePartitioned = val;
  4507. return CTX::instance()->mesh.mshFilePartitioned;
  4508. }
  4509. double opt_mesh_partition_hex_weight(OPT_ARGS_NUM)
  4510. {
  4511. if (action & GMSH_SET)
  4512. CTX::instance()->partitionOptions.hexWeight = (int) val;
  4513. return CTX::instance()->partitionOptions.hexWeight;
  4514. }
  4515. double opt_mesh_partition_pri_weight(OPT_ARGS_NUM)
  4516. {
  4517. if (action & GMSH_SET)
  4518. CTX::instance()->partitionOptions.priWeight = (int) val;
  4519. return CTX::instance()->partitionOptions.priWeight;
  4520. }
  4521. double opt_mesh_partition_pyr_weight(OPT_ARGS_NUM)
  4522. {
  4523. if (action & GMSH_SET)
  4524. CTX::instance()->partitionOptions.pyrWeight = (int) val;
  4525. return CTX::instance()->partitionOptions.pyrWeight;
  4526. }
  4527. double opt_mesh_partition_qua_weight(OPT_ARGS_NUM)
  4528. {
  4529. if (action & GMSH_SET)
  4530. CTX::instance()->partitionOptions.quaWeight = (int) val;
  4531. return CTX::instance()->partitionOptions.quaWeight;
  4532. }
  4533. double opt_mesh_partition_tet_weight(OPT_ARGS_NUM)
  4534. {
  4535. if (action & GMSH_SET)
  4536. CTX::instance()->partitionOptions.tetWeight = (int) val;
  4537. return CTX::instance()->partitionOptions.tetWeight;
  4538. }
  4539. double opt_mesh_partition_tri_weight(OPT_ARGS_NUM)
  4540. {
  4541. if (action & GMSH_SET)
  4542. CTX::instance()->partitionOptions.triWeight = (int) val;
  4543. return CTX::instance()->partitionOptions.triWeight;
  4544. }
  4545. double opt_mesh_binary(OPT_ARGS_NUM)
  4546. {
  4547. if(action & GMSH_SET)
  4548. CTX::instance()->mesh.binary = (int)val;
  4549. return CTX::instance()->mesh.binary;
  4550. }
  4551. double opt_mesh_bunin(OPT_ARGS_NUM)
  4552. {
  4553. if(action & GMSH_SET)
  4554. CTX::instance()->mesh.bunin = (int)val;
  4555. return CTX::instance()->mesh.bunin;
  4556. }
  4557. double opt_mesh_bdf_field_format(OPT_ARGS_NUM)
  4558. {
  4559. if(action & GMSH_SET){
  4560. CTX::instance()->mesh.bdfFieldFormat = (int)val;
  4561. if(CTX::instance()->mesh.bdfFieldFormat < 0 ||
  4562. CTX::instance()->mesh.bdfFieldFormat > 2)
  4563. CTX::instance()->mesh.bdfFieldFormat = 1;
  4564. }
  4565. return CTX::instance()->mesh.bdfFieldFormat;
  4566. }
  4567. double opt_mesh_nb_smoothing(OPT_ARGS_NUM)
  4568. {
  4569. if(action & GMSH_SET)
  4570. CTX::instance()->mesh.nbSmoothing = (int)val;
  4571. #if defined(HAVE_FLTK)
  4572. if(FlGui::available() && (action & GMSH_GUI))
  4573. FlGui::instance()->options->mesh.value[0]->value
  4574. (CTX::instance()->mesh.nbSmoothing);
  4575. #endif
  4576. return CTX::instance()->mesh.nbSmoothing;
  4577. }
  4578. double opt_mesh_algo2d(OPT_ARGS_NUM)
  4579. {
  4580. if(action & GMSH_SET){
  4581. int algo = (int)val;
  4582. CTX::instance()->mesh.algo2d = algo;
  4583. }
  4584. #if defined(HAVE_FLTK)
  4585. if(FlGui::available() && (action & GMSH_GUI)) {
  4586. switch (CTX::instance()->mesh.algo2d) {
  4587. case ALGO_2D_MESHADAPT:
  4588. FlGui::instance()->options->mesh.choice[2]->value(1);
  4589. break;
  4590. case ALGO_2D_DELAUNAY:
  4591. FlGui::instance()->options->mesh.choice[2]->value(2);
  4592. break;
  4593. case ALGO_2D_FRONTAL:
  4594. FlGui::instance()->options->mesh.choice[2]->value(3);
  4595. break;
  4596. case ALGO_2D_FRONTAL_QUAD:
  4597. FlGui::instance()->options->mesh.choice[2]->value(4);
  4598. break;
  4599. case ALGO_2D_AUTO:
  4600. default:
  4601. FlGui::instance()->options->mesh.choice[2]->value(0);
  4602. break;
  4603. }
  4604. }
  4605. #endif
  4606. return CTX::instance()->mesh.algo2d;
  4607. }
  4608. double opt_mesh_algo_recombine(OPT_ARGS_NUM)
  4609. {
  4610. if(action & GMSH_SET){
  4611. CTX::instance()->mesh.algoRecombine = (int)val;
  4612. if(CTX::instance()->mesh.algoRecombine < 0 &&
  4613. CTX::instance()->mesh.algoRecombine > 1)
  4614. CTX::instance()->mesh.algoRecombine = 0;
  4615. }
  4616. #if defined(HAVE_FLTK)
  4617. if(FlGui::available() && (action & GMSH_GUI)) {
  4618. FlGui::instance()->options->mesh.choice[1]->value
  4619. (CTX::instance()->mesh.algoRecombine);
  4620. }
  4621. #endif
  4622. return CTX::instance()->mesh.algoRecombine;
  4623. }
  4624. double opt_mesh_recombine_all(OPT_ARGS_NUM)
  4625. {
  4626. if(action & GMSH_SET){
  4627. CTX::instance()->mesh.recombineAll = (int)val;
  4628. }
  4629. #if defined(HAVE_FLTK)
  4630. if(FlGui::available() && (action & GMSH_GUI))
  4631. FlGui::instance()->options->mesh.butt[21]->value
  4632. (CTX::instance()->mesh.recombineAll);
  4633. #endif
  4634. return CTX::instance()->mesh.recombineAll;
  4635. }
  4636. double opt_mesh_remesh_algo(OPT_ARGS_NUM)
  4637. {
  4638. if(action & GMSH_SET){
  4639. CTX::instance()->mesh.remeshAlgo = (int)val;
  4640. if(CTX::instance()->mesh.remeshAlgo < 0 &&
  4641. CTX::instance()->mesh.remeshAlgo > 2)
  4642. CTX::instance()->mesh.remeshAlgo = 0;
  4643. }
  4644. #if defined(HAVE_FLTK)
  4645. if(FlGui::available() && (action & GMSH_GUI)) {
  4646. FlGui::instance()->options->mesh.choice[8]->value
  4647. (CTX::instance()->mesh.remeshAlgo);
  4648. }
  4649. #endif
  4650. return CTX::instance()->mesh.remeshAlgo;
  4651. }
  4652. double opt_mesh_remesh_param(OPT_ARGS_NUM)
  4653. {
  4654. if(action & GMSH_SET){
  4655. CTX::instance()->mesh.remeshParam = (int)val;
  4656. if(CTX::instance()->mesh.remeshParam < 0 &&
  4657. CTX::instance()->mesh.remeshParam > 2)
  4658. CTX::instance()->mesh.remeshParam = 0;
  4659. }
  4660. #if defined(HAVE_FLTK)
  4661. if(FlGui::available() && (action & GMSH_GUI)) {
  4662. FlGui::instance()->options->mesh.choice[9]->value
  4663. (CTX::instance()->mesh.remeshParam);
  4664. }
  4665. #endif
  4666. return CTX::instance()->mesh.remeshParam;
  4667. }
  4668. double opt_mesh_algo_subdivide(OPT_ARGS_NUM)
  4669. {
  4670. if(action & GMSH_SET){
  4671. CTX::instance()->mesh.algoSubdivide = (int)val;
  4672. if(CTX::instance()->mesh.algoSubdivide < 0 &&
  4673. CTX::instance()->mesh.algoSubdivide > 2)
  4674. CTX::instance()->mesh.algoSubdivide = 0;
  4675. }
  4676. #if defined(HAVE_FLTK)
  4677. if(FlGui::available() && (action & GMSH_GUI)) {
  4678. FlGui::instance()->options->mesh.choice[5]->value
  4679. (CTX::instance()->mesh.algoSubdivide);
  4680. }
  4681. #endif
  4682. return CTX::instance()->mesh.algoSubdivide;
  4683. }
  4684. double opt_mesh_algo3d(OPT_ARGS_NUM)
  4685. {
  4686. if(action & GMSH_SET){
  4687. int algo = (int)val;
  4688. CTX::instance()->mesh.algo3d = algo;
  4689. }
  4690. #if defined(HAVE_FLTK)
  4691. if(FlGui::available() && (action & GMSH_GUI)) {
  4692. switch (CTX::instance()->mesh.algo3d) {
  4693. case ALGO_3D_MMG3D:
  4694. FlGui::instance()->options->mesh.choice[3]->value(4);
  4695. break;
  4696. case ALGO_3D_FRONTAL_HEX:
  4697. FlGui::instance()->options->mesh.choice[3]->value(3);
  4698. break;
  4699. case ALGO_3D_FRONTAL_DEL:
  4700. FlGui::instance()->options->mesh.choice[3]->value(2);
  4701. break;
  4702. case ALGO_3D_FRONTAL:
  4703. FlGui::instance()->options->mesh.choice[3]->value(1);
  4704. break;
  4705. case ALGO_3D_RTREE:
  4706. FlGui::instance()->options->mesh.choice[3]->value(5);
  4707. break;
  4708. case ALGO_3D_DELAUNAY:
  4709. default:
  4710. FlGui::instance()->options->mesh.choice[3]->value(0);
  4711. break;
  4712. }
  4713. }
  4714. #endif
  4715. return CTX::instance()->mesh.algo3d;
  4716. }
  4717. double opt_mesh_mesh_only_visible(OPT_ARGS_NUM)
  4718. {
  4719. if(action & GMSH_SET)
  4720. CTX::instance()->mesh.meshOnlyVisible = (int)val;
  4721. return CTX::instance()->mesh.meshOnlyVisible;
  4722. }
  4723. double opt_mesh_min_circ_points(OPT_ARGS_NUM)
  4724. {
  4725. if(action & GMSH_SET)
  4726. CTX::instance()->mesh.minCircPoints = (int)val;
  4727. return CTX::instance()->mesh.minCircPoints;
  4728. }
  4729. double opt_mesh_allow_swap_edge_angle(OPT_ARGS_NUM)
  4730. {
  4731. if(action & GMSH_SET)
  4732. CTX::instance()->mesh.allowSwapEdgeAngle = val;
  4733. return CTX::instance()->mesh.allowSwapEdgeAngle;
  4734. }
  4735. double opt_mesh_min_curv_points(OPT_ARGS_NUM)
  4736. {
  4737. if(action & GMSH_SET)
  4738. CTX::instance()->mesh.minCurvPoints = (int)val;
  4739. return CTX::instance()->mesh.minCurvPoints;
  4740. }
  4741. double opt_mesh_order(OPT_ARGS_NUM)
  4742. {
  4743. if(action & GMSH_SET)
  4744. CTX::instance()->mesh.order = (int)val;
  4745. #if defined(HAVE_FLTK)
  4746. if(FlGui::available() && (action & GMSH_GUI))
  4747. FlGui::instance()->options->mesh.value[3]->value
  4748. (CTX::instance()->mesh.order);
  4749. #endif
  4750. return CTX::instance()->mesh.order;
  4751. }
  4752. double opt_mesh_smooth_internal_edges(OPT_ARGS_NUM)
  4753. {
  4754. if(action & GMSH_SET)
  4755. CTX::instance()->mesh.smoothInternalEdges = (int)val;
  4756. #if defined(HAVE_FLTK)
  4757. if(FlGui::available() && (action & GMSH_GUI))
  4758. FlGui::instance()->options->mesh.butt[3]->value
  4759. (CTX::instance()->mesh.smoothInternalEdges);
  4760. #endif
  4761. return CTX::instance()->mesh.smoothInternalEdges;
  4762. }
  4763. double opt_mesh_ho_nlayers(OPT_ARGS_NUM)
  4764. {
  4765. if(action & GMSH_SET)
  4766. CTX::instance()->mesh.smoothNLayers = (int)val;
  4767. return CTX::instance()->mesh.smoothNLayers;
  4768. }
  4769. double opt_mesh_ho_mindisto(OPT_ARGS_NUM)
  4770. {
  4771. if(action & GMSH_SET)
  4772. CTX::instance()->mesh.smoothDistoThreshold = val;
  4773. return CTX::instance()->mesh.smoothDistoThreshold;
  4774. }
  4775. double opt_mesh_ho_poisson(OPT_ARGS_NUM)
  4776. {
  4777. if(action & GMSH_SET) {
  4778. double ratio = val;
  4779. if (ratio <= -1.0)
  4780. ratio = -0.999;
  4781. else if (ratio >= 0.5)
  4782. ratio = 0.499;
  4783. CTX::instance()->mesh.smoothPoissonRatio = ratio;
  4784. }
  4785. return CTX::instance()->mesh.smoothPoissonRatio;
  4786. }
  4787. double opt_mesh_second_order_experimental(OPT_ARGS_NUM)
  4788. {
  4789. if(action & GMSH_SET)
  4790. CTX::instance()->mesh.secondOrderExperimental = (int)val;
  4791. return CTX::instance()->mesh.secondOrderExperimental;
  4792. }
  4793. double opt_mesh_multiple_passes(OPT_ARGS_NUM)
  4794. {
  4795. if(action & GMSH_SET)
  4796. CTX::instance()->mesh.multiplePasses = (int)val;
  4797. return CTX::instance()->mesh.multiplePasses;
  4798. }
  4799. double opt_mesh_second_order_linear(OPT_ARGS_NUM)
  4800. {
  4801. if(action & GMSH_SET)
  4802. CTX::instance()->mesh.secondOrderLinear = (int)val;
  4803. return CTX::instance()->mesh.secondOrderLinear;
  4804. }
  4805. double opt_mesh_second_order_incomplete(OPT_ARGS_NUM)
  4806. {
  4807. if(action & GMSH_SET)
  4808. CTX::instance()->mesh.secondOrderIncomplete = (int)val;
  4809. #if defined(HAVE_FLTK)
  4810. if(FlGui::available() && (action & GMSH_GUI))
  4811. FlGui::instance()->options->mesh.butt[4]->value
  4812. (CTX::instance()->mesh.secondOrderIncomplete);
  4813. #endif
  4814. return CTX::instance()->mesh.secondOrderIncomplete;
  4815. }
  4816. double opt_mesh_cgns_import_order(OPT_ARGS_NUM)
  4817. {
  4818. if(action & GMSH_SET) {
  4819. int value = (int)val;
  4820. double order = val;
  4821. while(order >= 2.0) {
  4822. order = order / 2.0;
  4823. }
  4824. if (order != 1.0)
  4825. value = 1;
  4826. CTX::instance()->mesh.cgnsImportOrder = value;
  4827. }
  4828. return CTX::instance()->mesh.cgnsImportOrder;
  4829. }
  4830. double opt_mesh_dual(OPT_ARGS_NUM)
  4831. {
  4832. if(action & GMSH_SET) {
  4833. CTX::instance()->mesh.dual = (int)val;
  4834. }
  4835. return CTX::instance()->mesh.dual;
  4836. }
  4837. double opt_mesh_voronoi(OPT_ARGS_NUM)
  4838. {
  4839. if(action & GMSH_SET) {
  4840. CTX::instance()->mesh.voronoi= (int)val;
  4841. }
  4842. return CTX::instance()->mesh.voronoi;
  4843. }
  4844. double opt_mesh_draw_skin_only(OPT_ARGS_NUM)
  4845. {
  4846. if(action & GMSH_SET) {
  4847. CTX::instance()->mesh.drawSkinOnly = (int)val;
  4848. }
  4849. return CTX::instance()->mesh.drawSkinOnly;
  4850. }
  4851. double opt_mesh_save_all(OPT_ARGS_NUM)
  4852. {
  4853. if(action & GMSH_SET)
  4854. CTX::instance()->mesh.saveAll = val ? 1 : 0;
  4855. return CTX::instance()->mesh.saveAll;
  4856. }
  4857. double opt_mesh_save_element_tag_type(OPT_ARGS_NUM)
  4858. {
  4859. if(action & GMSH_SET)
  4860. CTX::instance()->mesh.saveElementTagType = (int)val;
  4861. return CTX::instance()->mesh.saveElementTagType;
  4862. }
  4863. double opt_mesh_save_parametric(OPT_ARGS_NUM)
  4864. {
  4865. if(action & GMSH_SET)
  4866. CTX::instance()->mesh.saveParametric = val ? 1 : 0;
  4867. return CTX::instance()->mesh.saveParametric;
  4868. }
  4869. double opt_mesh_save_groups_of_nodes(OPT_ARGS_NUM)
  4870. {
  4871. if(action & GMSH_SET)
  4872. CTX::instance()->mesh.saveGroupsOfNodes = val ? 1 : 0;
  4873. return CTX::instance()->mesh.saveGroupsOfNodes;
  4874. }
  4875. double opt_mesh_color_carousel(OPT_ARGS_NUM)
  4876. {
  4877. if(action & GMSH_SET) {
  4878. // vertex arrays need to be regenerated only when we color by
  4879. // element type or by partition
  4880. if(CTX::instance()->mesh.colorCarousel != (int)val &&
  4881. ((val == 0. || val == 3.) || CTX::instance()->pickElements))
  4882. CTX::instance()->mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
  4883. CTX::instance()->mesh.colorCarousel = (int)val;
  4884. if(CTX::instance()->mesh.colorCarousel < 0 ||
  4885. CTX::instance()->mesh.colorCarousel > 3)
  4886. CTX::instance()->mesh.colorCarousel = 0;
  4887. }
  4888. #if defined(HAVE_FLTK)
  4889. if(FlGui::available() && (action & GMSH_GUI)){
  4890. FlGui::instance()->options->mesh.choice[4]->value
  4891. (CTX::instance()->mesh.colorCarousel);
  4892. drawContext::global()->resetFontTextures();
  4893. }
  4894. #endif
  4895. return CTX::instance()->mesh.colorCarousel;
  4896. }
  4897. double opt_mesh_switch_elem_tags(OPT_ARGS_NUM)
  4898. {
  4899. if(action & GMSH_SET)
  4900. CTX::instance()->mesh.switchElementTags = val ? 1 : 0;
  4901. return CTX::instance()->mesh.switchElementTags;
  4902. }
  4903. double opt_mesh_zone_definition(OPT_ARGS_NUM)
  4904. {
  4905. if(action & GMSH_SET){
  4906. CTX::instance()->mesh.zoneDefinition = (int)val;
  4907. if( (CTX::instance()->mesh.zoneDefinition < 0 ||
  4908. CTX::instance()->mesh.zoneDefinition > 2) ||
  4909. (CTX::instance()->mesh.zoneDefinition == 1 &&
  4910. GModel::current()->getMinPartitionSize() +
  4911. GModel::current()->getMaxPartitionSize() == 0) )
  4912. CTX::instance()->mesh.zoneDefinition = 0;
  4913. }
  4914. return CTX::instance()->mesh.zoneDefinition;
  4915. }
  4916. #if !defined(HAVE_MESH)
  4917. static void GetStatistics(double stat[50])
  4918. {
  4919. for(int i = 0; i < 50; i++) stat[i] = 0;
  4920. }
  4921. #endif
  4922. double opt_mesh_nb_nodes(OPT_ARGS_NUM)
  4923. {
  4924. double s[50];
  4925. GetStatistics(s);
  4926. return s[4] + s[5] + s[6];
  4927. }
  4928. double opt_mesh_nb_triangles(OPT_ARGS_NUM)
  4929. {
  4930. double s[50];
  4931. GetStatistics(s);
  4932. return s[7];
  4933. }
  4934. double opt_mesh_nb_quadrangles(OPT_ARGS_NUM)
  4935. {
  4936. double s[50];
  4937. GetStatistics(s);
  4938. return s[8];
  4939. }
  4940. double opt_mesh_nb_tetrahedra(OPT_ARGS_NUM)
  4941. {
  4942. double s[50];
  4943. GetStatistics(s);
  4944. return s[9];
  4945. }
  4946. double opt_mesh_nb_hexahedra(OPT_ARGS_NUM)
  4947. {
  4948. double s[50];
  4949. GetStatistics(s);
  4950. return s[10];
  4951. }
  4952. double opt_mesh_nb_prisms(OPT_ARGS_NUM)
  4953. {
  4954. double s[50];
  4955. GetStatistics(s);
  4956. return s[11];
  4957. }
  4958. double opt_mesh_nb_pyramids(OPT_ARGS_NUM)
  4959. {
  4960. double s[50];
  4961. GetStatistics(s);
  4962. return s[12];
  4963. }
  4964. double opt_mesh_cpu_time(OPT_ARGS_NUM)
  4965. {
  4966. double s[50];
  4967. GetStatistics(s);
  4968. return s[13] + s[14] + s[15];
  4969. }
  4970. double opt_mesh_partition_partitioner(OPT_ARGS_NUM)
  4971. {
  4972. if(action & GMSH_SET) {
  4973. const int ival = (int)val;
  4974. CTX::instance()->partitionOptions.partitioner =
  4975. (ival < 1 || ival > 2) ? 1 : ival;
  4976. }
  4977. return CTX::instance()->partitionOptions.partitioner;
  4978. }
  4979. double opt_mesh_partition_num(OPT_ARGS_NUM)
  4980. {
  4981. if(action & GMSH_SET) {
  4982. const int ival = std::max(1, (int)val);
  4983. CTX::instance()->partitionOptions.num_partitions = ival;
  4984. unsigned hcdim = 0; // log2 to get hypercube dimensions
  4985. unsigned jval = ival;
  4986. while(jval >>= 1) ++hcdim;
  4987. CTX::instance()->partitionOptions.ndims_tot = hcdim;
  4988. CTX::instance()->partitionOptions.mesh_dims[0] = ival;
  4989. CTX::instance()->partitionOptions.mesh_dims[1] = 1;
  4990. CTX::instance()->partitionOptions.mesh_dims[2] = 1;
  4991. if(CTX::instance()->partitionOptions.partitioner == 2) // METIS
  4992. CTX::instance()->partitionOptions.algorithm = (ival <= 8) ? 1 : 2;
  4993. }
  4994. return CTX::instance()->partitionOptions.num_partitions;
  4995. }
  4996. double opt_mesh_partition_chaco_global_method(OPT_ARGS_NUM)
  4997. {
  4998. if(action & GMSH_SET) {
  4999. int ival = (int)val;
  5000. CTX::instance()->partitionOptions.global_method =
  5001. (ival < 1 || ival > 6 || ival == 3) ? 1 : ival;
  5002. }
  5003. return CTX::instance()->partitionOptions.global_method;
  5004. }
  5005. double opt_mesh_partition_chaco_architecture(OPT_ARGS_NUM)
  5006. {
  5007. if(action & GMSH_SET) {
  5008. const int ival = (int)val;
  5009. CTX::instance()->partitionOptions.architecture =
  5010. (ival < 0 || ival > 3) ? 1 : ival;
  5011. }
  5012. return CTX::instance()->partitionOptions.architecture;
  5013. }
  5014. double opt_mesh_partition_chaco_ndims_tot(OPT_ARGS_NUM)
  5015. {
  5016. if(action & GMSH_SET) {
  5017. const int ival = std::max(1, (int)val);
  5018. CTX::instance()->partitionOptions.ndims_tot = ival;
  5019. CTX::instance()->partitionOptions.num_partitions = 1 << ival;
  5020. }
  5021. return CTX::instance()->partitionOptions.ndims_tot;
  5022. }
  5023. double opt_mesh_partition_chaco_mesh_dims1(OPT_ARGS_NUM)
  5024. {
  5025. if(action & GMSH_SET) {
  5026. const int ival = std::max(1, (int)val);
  5027. CTX::instance()->partitionOptions.mesh_dims[0] = ival;
  5028. CTX::instance()->partitionOptions.num_partitions = ival;
  5029. if(CTX::instance()->partitionOptions.architecture >= 2)
  5030. CTX::instance()->partitionOptions.num_partitions *=
  5031. CTX::instance()->partitionOptions.mesh_dims[1];
  5032. if(CTX::instance()->partitionOptions.architecture == 3)
  5033. CTX::instance()->partitionOptions.num_partitions *=
  5034. CTX::instance()->partitionOptions.mesh_dims[2];
  5035. }
  5036. return CTX::instance()->partitionOptions.mesh_dims[0];
  5037. }
  5038. double opt_mesh_partition_chaco_mesh_dims2(OPT_ARGS_NUM)
  5039. {
  5040. if(action & GMSH_SET) {
  5041. const int ival = std::max(1, (int)val);
  5042. CTX::instance()->partitionOptions.mesh_dims[1] = ival;
  5043. CTX::instance()->partitionOptions.num_partitions =
  5044. CTX::instance()->partitionOptions.mesh_dims[0]*ival;
  5045. if(CTX::instance()->partitionOptions.architecture == 3)
  5046. CTX::instance()->partitionOptions.num_partitions *=
  5047. CTX::instance()->partitionOptions.mesh_dims[2];
  5048. }
  5049. return CTX::instance()->partitionOptions.mesh_dims[1];
  5050. }
  5051. double opt_mesh_partition_chaco_mesh_dims3(OPT_ARGS_NUM)
  5052. {
  5053. if(action & GMSH_SET) {
  5054. const int ival = std::max(1, (int)val);
  5055. CTX::instance()->partitionOptions.mesh_dims[2] = ival;
  5056. CTX::instance()->partitionOptions.num_partitions =
  5057. CTX::instance()->partitionOptions.mesh_dims[0]*
  5058. CTX::instance()->partitionOptions.mesh_dims[1]*ival;
  5059. }
  5060. return CTX::instance()->partitionOptions.mesh_dims[2];
  5061. }
  5062. double opt_mesh_partition_chaco_local_method(OPT_ARGS_NUM)
  5063. {
  5064. if(action & GMSH_SET) {
  5065. int ival = (int)val;
  5066. if(CTX::instance()->partitionOptions.algorithm == 1) ival = 1;
  5067. CTX::instance()->partitionOptions.local_method = (ival < 0 || ival > 1) ? 1 : ival;
  5068. }
  5069. return CTX::instance()->partitionOptions.local_method;
  5070. }
  5071. double opt_mesh_partition_chaco_eigensolver(OPT_ARGS_NUM)
  5072. {
  5073. if(action & GMSH_SET) {
  5074. int ival = val ? 1 : 0;
  5075. CTX::instance()->partitionOptions.rqi_flag = ival;
  5076. }
  5077. return CTX::instance()->partitionOptions.rqi_flag;
  5078. }
  5079. double opt_mesh_partition_chaco_vmax(OPT_ARGS_NUM)
  5080. {
  5081. if(action & GMSH_SET) {
  5082. const int ival = (int)val;
  5083. CTX::instance()->partitionOptions.vmax = (ival < 1) ? 1 : ival;
  5084. }
  5085. return CTX::instance()->partitionOptions.vmax;
  5086. }
  5087. double opt_mesh_partition_chaco_nsection(OPT_ARGS_NUM)
  5088. {
  5089. if(action & GMSH_SET) {
  5090. const int ival = (int)val;
  5091. CTX::instance()->partitionOptions.ndims = (ival < 1 || ival > 3) ? 1 : ival;
  5092. if(CTX::instance()->partitionOptions.ndims > 1 &&
  5093. CTX::instance()->partitionOptions.algorithm == 2)
  5094. CTX::instance()->partitionOptions.terminal_propogation = false;
  5095. }
  5096. return CTX::instance()->partitionOptions.ndims;
  5097. }
  5098. double opt_mesh_partition_chaco_eigtol(OPT_ARGS_NUM)
  5099. {
  5100. if(action & GMSH_SET)
  5101. CTX::instance()->partitionOptions.eigtol = (val <= 0.) ? 1.E-3 : val;
  5102. return CTX::instance()->partitionOptions.eigtol;
  5103. }
  5104. double opt_mesh_partition_chaco_seed(OPT_ARGS_NUM)
  5105. {
  5106. if(action & GMSH_SET)
  5107. CTX::instance()->partitionOptions.seed = (long)val;
  5108. return CTX::instance()->partitionOptions.seed;
  5109. }
  5110. double opt_mesh_partition_chaco_refine_partition(OPT_ARGS_NUM)
  5111. {
  5112. if(action & GMSH_SET)
  5113. CTX::instance()->partitionOptions.refine_partition = val ? 1 : 0;
  5114. return CTX::instance()->partitionOptions.refine_partition;
  5115. }
  5116. double opt_mesh_partition_chaco_internal_vertices(OPT_ARGS_NUM)
  5117. {
  5118. if(action & GMSH_SET)
  5119. CTX::instance()->partitionOptions.internal_vertices = val ? 1 : 0;
  5120. return CTX::instance()->partitionOptions.internal_vertices;
  5121. }
  5122. double opt_mesh_partition_chaco_refine_map(OPT_ARGS_NUM)
  5123. {
  5124. if(action & GMSH_SET)
  5125. CTX::instance()->partitionOptions.refine_map = val ? 1 : 0;
  5126. return CTX::instance()->partitionOptions.refine_map;
  5127. }
  5128. double opt_mesh_partition_chaco_terminal_propogation(OPT_ARGS_NUM)
  5129. {
  5130. if(action & GMSH_SET) {
  5131. CTX::instance()->partitionOptions.terminal_propogation = val ? 1 : 0;
  5132. if(CTX::instance()->partitionOptions.terminal_propogation &&
  5133. CTX::instance()->partitionOptions.algorithm == 2)
  5134. CTX::instance()->partitionOptions.ndims = 1;
  5135. }
  5136. return CTX::instance()->partitionOptions.terminal_propogation;
  5137. }
  5138. double opt_mesh_partition_metis_algorithm(OPT_ARGS_NUM)
  5139. {
  5140. if(action & GMSH_SET) {
  5141. int ival = (int)val;
  5142. if(ival < 1 || ival > 3)
  5143. ival = (CTX::instance()->partitionOptions.num_partitions <= 8) ? 1 : 2;
  5144. CTX::instance()->partitionOptions.algorithm = ival;
  5145. }
  5146. return CTX::instance()->partitionOptions.algorithm;
  5147. }
  5148. double opt_mesh_partition_metis_edge_matching(OPT_ARGS_NUM)
  5149. {
  5150. if(action & GMSH_SET) {
  5151. const int ival = (int)val;
  5152. CTX::instance()->partitionOptions.edge_matching =
  5153. (ival < 1 || ival > 3) ? 3 : ival;
  5154. }
  5155. return CTX::instance()->partitionOptions.edge_matching;
  5156. }
  5157. double opt_mesh_partition_metis_refine_algorithm(OPT_ARGS_NUM)
  5158. {
  5159. if(action & GMSH_SET) {
  5160. const int ival = (int)val;
  5161. CTX::instance()->partitionOptions.refine_algorithm =
  5162. (ival < 1 || ival > 3) ? 3 : ival;
  5163. }
  5164. return CTX::instance()->partitionOptions.refine_algorithm;
  5165. }
  5166. double opt_mesh_clip(OPT_ARGS_NUM)
  5167. {
  5168. if(action & GMSH_SET)
  5169. CTX::instance()->mesh.clip = (int)val;
  5170. #if defined(HAVE_FLTK)
  5171. if(FlGui::available() && (action & GMSH_GUI))
  5172. FlGui::instance()->clipping->resetBrowser();
  5173. #endif
  5174. return CTX::instance()->mesh.clip;
  5175. }
  5176. double opt_mesh_ignore_part_bound(OPT_ARGS_NUM)
  5177. {
  5178. if(action & GMSH_SET)
  5179. CTX::instance()->mesh.ignorePartBound = (int) val;
  5180. return CTX::instance()->mesh.ignorePartBound;
  5181. }
  5182. double opt_solver_listen(OPT_ARGS_NUM)
  5183. {
  5184. if(action & GMSH_SET)
  5185. CTX::instance()->solver.listen = (int)val;
  5186. #if defined(HAVE_FLTK)
  5187. if(FlGui::available() && (action & GMSH_GUI))
  5188. FlGui::instance()->options->solver.butt[0]->value
  5189. (CTX::instance()->solver.listen);
  5190. #endif
  5191. return CTX::instance()->solver.listen;
  5192. }
  5193. double opt_solver_timeout(OPT_ARGS_NUM)
  5194. {
  5195. if(action & GMSH_SET)
  5196. CTX::instance()->solver.timeout = val;
  5197. #if defined(HAVE_FLTK)
  5198. if(FlGui::available() && (action & GMSH_GUI))
  5199. FlGui::instance()->options->solver.value[0]->value(CTX::instance()->solver.timeout);
  5200. #endif
  5201. return CTX::instance()->solver.timeout;
  5202. }
  5203. double opt_solver_plugins(OPT_ARGS_NUM)
  5204. {
  5205. if(action & GMSH_SET)
  5206. CTX::instance()->solver.plugins = (int)val;
  5207. return CTX::instance()->solver.plugins;
  5208. }
  5209. double opt_solver_auto_save_database(OPT_ARGS_NUM)
  5210. {
  5211. if(action & GMSH_SET)
  5212. CTX::instance()->solver.autoSaveDatabase = (int)val;
  5213. return CTX::instance()->solver.autoSaveDatabase;
  5214. }
  5215. double opt_solver_auto_archive_output_files(OPT_ARGS_NUM)
  5216. {
  5217. if(action & GMSH_SET)
  5218. CTX::instance()->solver.autoArchiveOutputFiles = (int)val;
  5219. return CTX::instance()->solver.autoArchiveOutputFiles;
  5220. }
  5221. double opt_solver_auto_check(OPT_ARGS_NUM)
  5222. {
  5223. if(action & GMSH_SET)
  5224. CTX::instance()->solver.autoCheck = (int)val;
  5225. return CTX::instance()->solver.autoCheck;
  5226. }
  5227. double opt_solver_auto_mesh(OPT_ARGS_NUM)
  5228. {
  5229. if(action & GMSH_SET)
  5230. CTX::instance()->solver.autoMesh = (int)val;
  5231. return CTX::instance()->solver.autoMesh;
  5232. }
  5233. double opt_solver_auto_merge_file(OPT_ARGS_NUM)
  5234. {
  5235. if(action & GMSH_SET)
  5236. CTX::instance()->solver.autoMergeFile = (int)val;
  5237. return CTX::instance()->solver.autoMergeFile;
  5238. }
  5239. double opt_solver_auto_hide_new_views(OPT_ARGS_NUM)
  5240. {
  5241. if(action & GMSH_SET)
  5242. CTX::instance()->solver.autoHideNewViews = (int)val;
  5243. return CTX::instance()->solver.autoHideNewViews;
  5244. }
  5245. double opt_solver_auto_show_last_step(OPT_ARGS_NUM)
  5246. {
  5247. if(action & GMSH_SET)
  5248. CTX::instance()->solver.autoShowLastStep = (int)val;
  5249. return CTX::instance()->solver.autoShowLastStep;
  5250. }
  5251. double opt_post_horizontal_scales(OPT_ARGS_NUM)
  5252. {
  5253. if(action & GMSH_SET)
  5254. CTX::instance()->post.horizontalScales = (int)val;
  5255. #if defined(HAVE_FLTK)
  5256. if(FlGui::available() && (action & GMSH_GUI))
  5257. FlGui::instance()->options->post.butt[2]->value
  5258. (CTX::instance()->post.horizontalScales);
  5259. #endif
  5260. return CTX::instance()->post.horizontalScales;
  5261. }
  5262. double opt_post_link(OPT_ARGS_NUM)
  5263. {
  5264. if(action & GMSH_SET){
  5265. CTX::instance()->post.link = (int)val;
  5266. if(CTX::instance()->post.link < 0 || CTX::instance()->post.link > 4)
  5267. CTX::instance()->post.link = 0;
  5268. }
  5269. #if defined(HAVE_FLTK)
  5270. if(FlGui::available() && (action & GMSH_GUI)) {
  5271. FlGui::instance()->options->post.choice[0]->value
  5272. (CTX::instance()->post.link);
  5273. }
  5274. #endif
  5275. return CTX::instance()->post.link;
  5276. }
  5277. double opt_post_smooth(OPT_ARGS_NUM)
  5278. {
  5279. if(action & GMSH_SET)
  5280. CTX::instance()->post.smooth = (int)val;
  5281. return CTX::instance()->post.smooth;
  5282. }
  5283. double opt_post_anim_delay(OPT_ARGS_NUM)
  5284. {
  5285. if(action & GMSH_SET)
  5286. CTX::instance()->post.animDelay = (val >= 0.) ? val : 0.;
  5287. #if defined(HAVE_FLTK)
  5288. if(FlGui::available() && (action & GMSH_GUI))
  5289. FlGui::instance()->options->post.value[0]->value
  5290. (CTX::instance()->post.animDelay);
  5291. #endif
  5292. return CTX::instance()->post.animDelay;
  5293. }
  5294. double opt_post_anim_cycle(OPT_ARGS_NUM)
  5295. {
  5296. if(action & GMSH_SET)
  5297. CTX::instance()->post.animCycle = (int)val;
  5298. #if defined(HAVE_FLTK)
  5299. if(FlGui::available() && (action & GMSH_GUI))
  5300. FlGui::instance()->options->post.butt[0]->value
  5301. (CTX::instance()->post.animCycle);
  5302. if(FlGui::available())
  5303. for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++)
  5304. FlGui::instance()->graph[i]->checkAnimButtons();
  5305. #endif
  5306. return CTX::instance()->post.animCycle;
  5307. }
  5308. double opt_post_anim_step(OPT_ARGS_NUM)
  5309. {
  5310. if(action & GMSH_SET){
  5311. CTX::instance()->post.animStep = (int)val;
  5312. if(CTX::instance()->post.animStep < 1) CTX::instance()->post.animStep = 1;
  5313. }
  5314. #if defined(HAVE_FLTK)
  5315. if(FlGui::available() && (action & GMSH_GUI))
  5316. FlGui::instance()->options->post.value[1]->value
  5317. (CTX::instance()->post.animStep);
  5318. #endif
  5319. return CTX::instance()->post.animStep;
  5320. }
  5321. double opt_post_combine_remove_orig(OPT_ARGS_NUM)
  5322. {
  5323. if(action & GMSH_SET)
  5324. CTX::instance()->post.combineRemoveOrig = (int)val;
  5325. #if defined(HAVE_FLTK)
  5326. if(FlGui::available() && (action & GMSH_GUI))
  5327. FlGui::instance()->options->post.butt[1]->value
  5328. (CTX::instance()->post.combineRemoveOrig);
  5329. #endif
  5330. return CTX::instance()->post.combineRemoveOrig;
  5331. }
  5332. double opt_post_plugins(OPT_ARGS_NUM)
  5333. {
  5334. if(action & GMSH_SET)
  5335. CTX::instance()->post.plugins = (int)val;
  5336. return CTX::instance()->post.plugins;
  5337. }
  5338. double opt_post_nb_views(OPT_ARGS_NUM)
  5339. {
  5340. #if defined(HAVE_POST)
  5341. return PView::list.size();
  5342. #else
  5343. return 0;
  5344. #endif
  5345. }
  5346. double opt_post_file_format(OPT_ARGS_NUM)
  5347. {
  5348. if(action & GMSH_SET)
  5349. CTX::instance()->post.fileFormat = (int)val;
  5350. return CTX::instance()->post.fileFormat;
  5351. }
  5352. double opt_view_nb_timestep(OPT_ARGS_NUM)
  5353. {
  5354. #if defined(HAVE_POST)
  5355. GET_VIEWd(0.);
  5356. if(!data) return 1;
  5357. #if defined(HAVE_FLTK)
  5358. if(_gui_action_valid(action, num))
  5359. FlGui::instance()->options->view.value[50]->maximum(data->getNumTimeSteps() - 1);
  5360. if(FlGui::available())
  5361. for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++)
  5362. FlGui::instance()->graph[i]->checkAnimButtons();
  5363. #endif
  5364. return data->getNumTimeSteps();
  5365. #else
  5366. return 0.;
  5367. #endif
  5368. }
  5369. double opt_view_nb_non_empty_timestep(OPT_ARGS_NUM)
  5370. {
  5371. #if defined(HAVE_POST)
  5372. GET_VIEWd(0.);
  5373. if(!data) return 0;
  5374. int n = 0;
  5375. for(int i = 0; i < data->getNumTimeSteps(); i++)
  5376. if(data->hasTimeStep(i)) n++;
  5377. return n;
  5378. #else
  5379. return 0.;
  5380. #endif
  5381. }
  5382. double opt_view_timestep(OPT_ARGS_NUM)
  5383. {
  5384. #if defined(HAVE_POST)
  5385. GET_VIEW(0.);
  5386. if(!data) return 0;
  5387. if(action & GMSH_SET) {
  5388. opt->timeStep = (int)val;
  5389. if(opt->timeStep > data->getNumTimeSteps() - 1)
  5390. opt->timeStep = 0;
  5391. else if(opt->timeStep < 0)
  5392. opt->timeStep = data->getNumTimeSteps() - 1;
  5393. if(data->getAdaptiveData())
  5394. data->getAdaptiveData()->changeResolution
  5395. (opt->timeStep, opt->maxRecursionLevel, opt->targetError);
  5396. if(view) view->setChanged(true);
  5397. }
  5398. #if defined(HAVE_FLTK)
  5399. if(_gui_action_valid(action, num))
  5400. FlGui::instance()->options->view.value[50]->value(opt->timeStep);
  5401. #endif
  5402. return opt->timeStep;
  5403. #else
  5404. return 0.;
  5405. #endif
  5406. }
  5407. double opt_view_min(OPT_ARGS_NUM)
  5408. {
  5409. #if defined(HAVE_POST)
  5410. GET_VIEWd(0.);
  5411. if(!data) return 0.;
  5412. // use adaptive data if available
  5413. return view->getData(true)->getMin();
  5414. #else
  5415. return 0.;
  5416. #endif
  5417. }
  5418. double opt_view_max(OPT_ARGS_NUM)
  5419. {
  5420. #if defined(HAVE_POST)
  5421. GET_VIEWd(0.);
  5422. if(!data) return 0.;
  5423. // use adaptive data if available
  5424. return view->getData(true)->getMax();
  5425. #else
  5426. return 0.;
  5427. #endif
  5428. }
  5429. double opt_view_custom_min(OPT_ARGS_NUM)
  5430. {
  5431. #if defined(HAVE_POST)
  5432. GET_VIEWo(0.);
  5433. if(action & GMSH_SET) {
  5434. opt->customMin = val;
  5435. if(view) view->setChanged(true);
  5436. }
  5437. #if defined(HAVE_FLTK)
  5438. if(_gui_action_valid(action, num)) {
  5439. FlGui::instance()->options->view.value[31]->value(opt->customMin);
  5440. }
  5441. #endif
  5442. return opt->customMin;
  5443. #else
  5444. return 0.;
  5445. #endif
  5446. }
  5447. double opt_view_custom_max(OPT_ARGS_NUM)
  5448. {
  5449. #if defined(HAVE_POST)
  5450. GET_VIEWo(0.);
  5451. if(action & GMSH_SET) {
  5452. opt->customMax = val;
  5453. if(view) view->setChanged(true);
  5454. }
  5455. #if defined(HAVE_FLTK)
  5456. if(_gui_action_valid(action, num))
  5457. FlGui::instance()->options->view.value[32]->value(opt->customMax);
  5458. #endif
  5459. return opt->customMax;
  5460. #else
  5461. return 0.;
  5462. #endif
  5463. }
  5464. double opt_view_custom_abscissa_min(OPT_ARGS_NUM)
  5465. {
  5466. #if defined(HAVE_POST)
  5467. GET_VIEWo(0.);
  5468. if(action & GMSH_SET) {
  5469. opt->customAbscissaMin = val;
  5470. if(view) view->setChanged(true);
  5471. }
  5472. return opt->customAbscissaMin;
  5473. #else
  5474. return 0.;
  5475. #endif
  5476. }
  5477. double opt_view_custom_abscissa_max(OPT_ARGS_NUM)
  5478. {
  5479. #if defined(HAVE_POST)
  5480. GET_VIEWo(0.);
  5481. if(action & GMSH_SET) {
  5482. opt->customAbscissaMax = val;
  5483. if(view) view->setChanged(true);
  5484. }
  5485. return opt->customAbscissaMax;
  5486. #else
  5487. return 0.;
  5488. #endif
  5489. }
  5490. double opt_view_xmin(OPT_ARGS_NUM)
  5491. {
  5492. #if defined(HAVE_POST)
  5493. GET_VIEWd(0.);
  5494. if(!data) return 0.;
  5495. return data->getBoundingBox().min().x();
  5496. #else
  5497. return 0.;
  5498. #endif
  5499. }
  5500. double opt_view_xmax(OPT_ARGS_NUM)
  5501. {
  5502. #if defined(HAVE_POST)
  5503. GET_VIEWd(0.);
  5504. if(!data) return 0.;
  5505. return data->getBoundingBox().max().x();
  5506. #else
  5507. return 0.;
  5508. #endif
  5509. }
  5510. double opt_view_ymin(OPT_ARGS_NUM)
  5511. {
  5512. #if defined(HAVE_POST)
  5513. GET_VIEWd(0.);
  5514. if(!data) return 0.;
  5515. return data->getBoundingBox().min().y();
  5516. #else
  5517. return 0.;
  5518. #endif
  5519. }
  5520. double opt_view_ymax(OPT_ARGS_NUM)
  5521. {
  5522. #if defined(HAVE_POST)
  5523. GET_VIEWd(0.);
  5524. if(!data) return 0.;
  5525. return data->getBoundingBox().max().y();
  5526. #else
  5527. return 0.;
  5528. #endif
  5529. }
  5530. double opt_view_zmin(OPT_ARGS_NUM)
  5531. {
  5532. #if defined(HAVE_POST)
  5533. GET_VIEWd(0.);
  5534. if(!data) return 0.;
  5535. return data->getBoundingBox().min().z();
  5536. #else
  5537. return 0.;
  5538. #endif
  5539. }
  5540. double opt_view_zmax(OPT_ARGS_NUM)
  5541. {
  5542. #if defined(HAVE_POST)
  5543. GET_VIEWd(0.);
  5544. if(!data) return 0.;
  5545. return data->getBoundingBox().max().z();
  5546. #else
  5547. return 0.;
  5548. #endif
  5549. }
  5550. double opt_view_offset0(OPT_ARGS_NUM)
  5551. {
  5552. #if defined(HAVE_POST)
  5553. GET_VIEWo(0.);
  5554. if(action & GMSH_SET) {
  5555. opt->offset[0] = val;
  5556. if(view) view->setChanged(true);
  5557. }
  5558. #if defined(HAVE_FLTK)
  5559. if(_gui_action_valid(action, num))
  5560. FlGui::instance()->options->view.value[40]->value(opt->offset[0]);
  5561. #endif
  5562. return opt->offset[0];
  5563. #else
  5564. return 0.;
  5565. #endif
  5566. }
  5567. double opt_view_offset1(OPT_ARGS_NUM)
  5568. {
  5569. #if defined(HAVE_POST)
  5570. GET_VIEWo(0.);
  5571. if(action & GMSH_SET) {
  5572. opt->offset[1] = val;
  5573. if(view) view->setChanged(true);
  5574. }
  5575. #if defined(HAVE_FLTK)
  5576. if(_gui_action_valid(action, num))
  5577. FlGui::instance()->options->view.value[41]->value(opt->offset[1]);
  5578. #endif
  5579. return opt->offset[1];
  5580. #else
  5581. return 0.;
  5582. #endif
  5583. }
  5584. double opt_view_offset2(OPT_ARGS_NUM)
  5585. {
  5586. #if defined(HAVE_POST)
  5587. GET_VIEWo(0.);
  5588. if(action & GMSH_SET) {
  5589. opt->offset[2] = val;
  5590. if(view) view->setChanged(true);
  5591. }
  5592. #if defined(HAVE_FLTK)
  5593. if(_gui_action_valid(action, num))
  5594. FlGui::instance()->options->view.value[42]->value(opt->offset[2]);
  5595. #endif
  5596. return opt->offset[2];
  5597. #else
  5598. return 0.;
  5599. #endif
  5600. }
  5601. double opt_view_raise0(OPT_ARGS_NUM)
  5602. {
  5603. #if defined(HAVE_POST)
  5604. GET_VIEWo(0.);
  5605. if(action & GMSH_SET) {
  5606. opt->raise[0] = val;
  5607. if(view) view->setChanged(true);
  5608. }
  5609. #if defined(HAVE_FLTK)
  5610. if(_gui_action_valid(action, num))
  5611. FlGui::instance()->options->view.value[43]->value(opt->raise[0]);
  5612. #endif
  5613. return opt->raise[0];
  5614. #else
  5615. return 0.;
  5616. #endif
  5617. }
  5618. double opt_view_raise1(OPT_ARGS_NUM)
  5619. {
  5620. #if defined(HAVE_POST)
  5621. GET_VIEWo(0.);
  5622. if(action & GMSH_SET) {
  5623. opt->raise[1] = val;
  5624. if(view) view->setChanged(true);
  5625. }
  5626. #if defined(HAVE_FLTK)
  5627. if(_gui_action_valid(action, num))
  5628. FlGui::instance()->options->view.value[44]->value(opt->raise[1]);
  5629. #endif
  5630. return opt->raise[1];
  5631. #else
  5632. return 0.;
  5633. #endif
  5634. }
  5635. double opt_view_raise2(OPT_ARGS_NUM)
  5636. {
  5637. #if defined(HAVE_POST)
  5638. GET_VIEWo(0.);
  5639. if(action & GMSH_SET) {
  5640. opt->raise[2] = val;
  5641. if(view) view->setChanged(true);
  5642. }
  5643. #if defined(HAVE_FLTK)
  5644. if(_gui_action_valid(action, num))
  5645. FlGui::instance()->options->view.value[45]->value(opt->raise[2]);
  5646. #endif
  5647. return opt->raise[2];
  5648. #else
  5649. return 0.;
  5650. #endif
  5651. }
  5652. double opt_view_normal_raise(OPT_ARGS_NUM)
  5653. {
  5654. #if defined(HAVE_POST)
  5655. GET_VIEWo(0.);
  5656. if(action & GMSH_SET) {
  5657. opt->normalRaise = val;
  5658. if(view) view->setChanged(true);
  5659. }
  5660. #if defined(HAVE_FLTK)
  5661. if(_gui_action_valid(action, num))
  5662. FlGui::instance()->options->view.value[46]->value(opt->normalRaise);
  5663. #endif
  5664. return opt->normalRaise;
  5665. #else
  5666. return 0.;
  5667. #endif
  5668. }
  5669. double opt_view_transform00(OPT_ARGS_NUM)
  5670. {
  5671. #if defined(HAVE_POST)
  5672. GET_VIEWo(0.);
  5673. if(action & GMSH_SET) {
  5674. opt->transform[0][0] = val;
  5675. if(view) view->setChanged(true);
  5676. }
  5677. #if defined(HAVE_FLTK)
  5678. if(_gui_action_valid(action, num))
  5679. FlGui::instance()->options->view.value[51]->value(opt->transform[0][0]);
  5680. #endif
  5681. return opt->transform[0][0];
  5682. #else
  5683. return 0.;
  5684. #endif
  5685. }
  5686. double opt_view_transform01(OPT_ARGS_NUM)
  5687. {
  5688. #if defined(HAVE_POST)
  5689. GET_VIEWo(0.);
  5690. if(action & GMSH_SET) {
  5691. opt->transform[0][1] = val;
  5692. if(view) view->setChanged(true);
  5693. }
  5694. #if defined(HAVE_FLTK)
  5695. if(_gui_action_valid(action, num))
  5696. FlGui::instance()->options->view.value[52]->value(opt->transform[0][1]);
  5697. #endif
  5698. return opt->transform[0][1];
  5699. #else
  5700. return 0.;
  5701. #endif
  5702. }
  5703. double opt_view_transform02(OPT_ARGS_NUM)
  5704. {
  5705. #if defined(HAVE_POST)
  5706. GET_VIEWo(0.);
  5707. if(action & GMSH_SET) {
  5708. opt->transform[0][2] = val;
  5709. if(view) view->setChanged(true);
  5710. }
  5711. #if defined(HAVE_FLTK)
  5712. if(_gui_action_valid(action, num))
  5713. FlGui::instance()->options->view.value[53]->value(opt->transform[0][2]);
  5714. #endif
  5715. return opt->transform[0][2];
  5716. #else
  5717. return 0.;
  5718. #endif
  5719. }
  5720. double opt_view_transform10(OPT_ARGS_NUM)
  5721. {
  5722. #if defined(HAVE_POST)
  5723. GET_VIEWo(0.);
  5724. if(action & GMSH_SET) {
  5725. opt->transform[1][0] = val;
  5726. if(view) view->setChanged(true);
  5727. }
  5728. #if defined(HAVE_FLTK)
  5729. if(_gui_action_valid(action, num))
  5730. FlGui::instance()->options->view.value[54]->value(opt->transform[1][0]);
  5731. #endif
  5732. return opt->transform[1][0];
  5733. #else
  5734. return 0.;
  5735. #endif
  5736. }
  5737. double opt_view_transform11(OPT_ARGS_NUM)
  5738. {
  5739. #if defined(HAVE_POST)
  5740. GET_VIEWo(0.);
  5741. if(action & GMSH_SET) {
  5742. opt->transform[1][1] = val;
  5743. if(view) view->setChanged(true);
  5744. }
  5745. #if defined(HAVE_FLTK)
  5746. if(_gui_action_valid(action, num))
  5747. FlGui::instance()->options->view.value[55]->value(opt->transform[1][1]);
  5748. #endif
  5749. return opt->transform[1][1];
  5750. #else
  5751. return 0.;
  5752. #endif
  5753. }
  5754. double opt_view_transform12(OPT_ARGS_NUM)
  5755. {
  5756. #if defined(HAVE_POST)
  5757. GET_VIEWo(0.);
  5758. if(action & GMSH_SET) {
  5759. opt->transform[1][2] = val;
  5760. if(view) view->setChanged(true);
  5761. }
  5762. #if defined(HAVE_FLTK)
  5763. if(_gui_action_valid(action, num))
  5764. FlGui::instance()->options->view.value[56]->value(opt->transform[1][2]);
  5765. #endif
  5766. return opt->transform[1][2];
  5767. #else
  5768. return 0.;
  5769. #endif
  5770. }
  5771. double opt_view_transform20(OPT_ARGS_NUM)
  5772. {
  5773. #if defined(HAVE_POST)
  5774. GET_VIEWo(0.);
  5775. if(action & GMSH_SET) {
  5776. opt->transform[2][0] = val;
  5777. if(view) view->setChanged(true);
  5778. }
  5779. #if defined(HAVE_FLTK)
  5780. if(_gui_action_valid(action, num))
  5781. FlGui::instance()->options->view.value[57]->value(opt->transform[2][0]);
  5782. #endif
  5783. return opt->transform[2][0];
  5784. #else
  5785. return 0.;
  5786. #endif
  5787. }
  5788. double opt_view_transform21(OPT_ARGS_NUM)
  5789. {
  5790. #if defined(HAVE_POST)
  5791. GET_VIEWo(0.);
  5792. if(action & GMSH_SET) {
  5793. opt->transform[2][1] = val;
  5794. if(view) view->setChanged(true);
  5795. }
  5796. #if defined(HAVE_FLTK)
  5797. if(_gui_action_valid(action, num))
  5798. FlGui::instance()->options->view.value[58]->value(opt->transform[2][1]);
  5799. #endif
  5800. return opt->transform[2][1];
  5801. #else
  5802. return 0.;
  5803. #endif
  5804. }
  5805. double opt_view_transform22(OPT_ARGS_NUM)
  5806. {
  5807. #if defined(HAVE_POST)
  5808. GET_VIEWo(0.);
  5809. if(action & GMSH_SET) {
  5810. opt->transform[2][2] = val;
  5811. if(view) view->setChanged(true);
  5812. }
  5813. #if defined(HAVE_FLTK)
  5814. if(_gui_action_valid(action, num))
  5815. FlGui::instance()->options->view.value[59]->value(opt->transform[2][2]);
  5816. #endif
  5817. return opt->transform[2][2];
  5818. #else
  5819. return 0.;
  5820. #endif
  5821. }
  5822. double opt_view_arrow_size_min(OPT_ARGS_NUM)
  5823. {
  5824. #if defined(HAVE_POST)
  5825. GET_VIEWo(0.);
  5826. if(action & GMSH_SET) {
  5827. opt->arrowSizeMin = val;
  5828. }
  5829. #if defined(HAVE_FLTK)
  5830. if(_gui_action_valid(action, num))
  5831. FlGui::instance()->options->view.value[64]->value(opt->arrowSizeMin);
  5832. #endif
  5833. return opt->arrowSizeMin;
  5834. #else
  5835. return 0.;
  5836. #endif
  5837. }
  5838. double opt_view_arrow_size_max(OPT_ARGS_NUM)
  5839. {
  5840. #if defined(HAVE_POST)
  5841. GET_VIEWo(0.);
  5842. if(action & GMSH_SET) {
  5843. opt->arrowSizeMax = val;
  5844. }
  5845. #if defined(HAVE_FLTK)
  5846. if(_gui_action_valid(action, num))
  5847. FlGui::instance()->options->view.value[60]->value(opt->arrowSizeMax);
  5848. #endif
  5849. return opt->arrowSizeMax;
  5850. #else
  5851. return 0.;
  5852. #endif
  5853. }
  5854. double opt_view_normals(OPT_ARGS_NUM)
  5855. {
  5856. #if defined(HAVE_POST)
  5857. GET_VIEWo(0.);
  5858. if(action & GMSH_SET) {
  5859. opt->normals = val;
  5860. }
  5861. #if defined(HAVE_FLTK)
  5862. if(_gui_action_valid(action, num))
  5863. FlGui::instance()->options->view.value[0]->value(opt->normals);
  5864. #endif
  5865. return opt->normals;
  5866. #else
  5867. return 0.;
  5868. #endif
  5869. }
  5870. double opt_view_tangents(OPT_ARGS_NUM)
  5871. {
  5872. #if defined(HAVE_POST)
  5873. GET_VIEWo(0.);
  5874. if(action & GMSH_SET) {
  5875. opt->tangents = val;
  5876. }
  5877. #if defined(HAVE_FLTK)
  5878. if(_gui_action_valid(action, num))
  5879. FlGui::instance()->options->view.value[1]->value(opt->tangents);
  5880. #endif
  5881. return opt->tangents;
  5882. #else
  5883. return 0.;
  5884. #endif
  5885. }
  5886. double opt_view_displacement_factor(OPT_ARGS_NUM)
  5887. {
  5888. #if defined(HAVE_POST)
  5889. GET_VIEWo(0.);
  5890. if(action & GMSH_SET) {
  5891. opt->displacementFactor = val;
  5892. if(view) view->setChanged(true);
  5893. }
  5894. #if defined(HAVE_FLTK)
  5895. if(_gui_action_valid(action, num))
  5896. FlGui::instance()->options->view.value[63]->value(opt->displacementFactor);
  5897. #endif
  5898. return opt->displacementFactor;
  5899. #else
  5900. return 0.;
  5901. #endif
  5902. }
  5903. double opt_view_fake_transparency(OPT_ARGS_NUM)
  5904. {
  5905. #if defined(HAVE_POST)
  5906. GET_VIEWo(0.);
  5907. if(action & GMSH_SET) {
  5908. opt->fakeTransparency = (int)val;
  5909. if(view) view->setChanged(true);
  5910. }
  5911. #if defined(HAVE_FLTK)
  5912. if(_gui_action_valid(action, num))
  5913. FlGui::instance()->options->view.butt[24]->value(opt->fakeTransparency);
  5914. #endif
  5915. return opt->fakeTransparency;
  5916. #else
  5917. return 0.;
  5918. #endif
  5919. }
  5920. double opt_view_explode(OPT_ARGS_NUM)
  5921. {
  5922. #if defined(HAVE_POST)
  5923. GET_VIEWo(0.);
  5924. if(action & GMSH_SET) {
  5925. opt->explode = val;
  5926. if(view) view->setChanged(true);
  5927. }
  5928. #if defined(HAVE_FLTK)
  5929. if(_gui_action_valid(action, num))
  5930. FlGui::instance()->options->view.value[12]->value(opt->explode);
  5931. #endif
  5932. return opt->explode;
  5933. #else
  5934. return 0.;
  5935. #endif
  5936. }
  5937. double opt_view_visible(OPT_ARGS_NUM)
  5938. {
  5939. #if defined(HAVE_POST)
  5940. GET_VIEWo(0.);
  5941. if(action & GMSH_SET) {
  5942. opt->visible = (int)val;
  5943. }
  5944. #if defined(HAVE_FLTK)
  5945. if(FlGui::available() && (action & GMSH_GUI) && num >= 0 &&
  5946. FlGui::instance()->onelab->getViewButton(num))
  5947. FlGui::instance()->onelab->getViewButton(num)->value(opt->visible);
  5948. #endif
  5949. return opt->visible;
  5950. #else
  5951. return 0.;
  5952. #endif
  5953. }
  5954. double opt_view_intervals_type(OPT_ARGS_NUM)
  5955. {
  5956. #if defined(HAVE_POST)
  5957. GET_VIEWo(0.);
  5958. if(action & GMSH_SET) {
  5959. opt->intervalsType = (int)val;
  5960. if(opt->intervalsType < 1 || opt->intervalsType > 4)
  5961. opt->intervalsType = 1;
  5962. if(view) view->setChanged(true);
  5963. }
  5964. #if defined(HAVE_FLTK)
  5965. if(_gui_action_valid(action, num)) {
  5966. FlGui::instance()->options->view.choice[0]->value(opt->intervalsType - 1);
  5967. }
  5968. #endif
  5969. return opt->intervalsType;
  5970. #else
  5971. return 0.;
  5972. #endif
  5973. }
  5974. double opt_view_saturate_values(OPT_ARGS_NUM)
  5975. {
  5976. #if defined(HAVE_POST)
  5977. GET_VIEWo(0.);
  5978. if(action & GMSH_SET) {
  5979. opt->saturateValues = (int)val;
  5980. if(view) view->setChanged(true);
  5981. }
  5982. #if defined(HAVE_FLTK)
  5983. if(_gui_action_valid(action, num)) {
  5984. FlGui::instance()->options->view.butt[38]->value(opt->saturateValues);
  5985. }
  5986. #endif
  5987. return opt->saturateValues;
  5988. #else
  5989. return 0.;
  5990. #endif
  5991. }
  5992. double opt_view_adapt_visualization_grid(OPT_ARGS_NUM)
  5993. {
  5994. #if defined(HAVE_POST)
  5995. GET_VIEW(0.);
  5996. if(action & GMSH_SET) {
  5997. opt->adaptVisualizationGrid = (int)val;
  5998. if(data){
  5999. if(opt->adaptVisualizationGrid)
  6000. data->initAdaptiveData
  6001. (opt->timeStep, opt->maxRecursionLevel, opt->targetError);
  6002. else
  6003. data->destroyAdaptiveData();
  6004. view->setChanged(true);
  6005. }
  6006. }
  6007. #if defined(HAVE_FLTK)
  6008. if(_gui_action_valid(action, num)) {
  6009. FlGui::instance()->options->view.butt[0]->value(opt->adaptVisualizationGrid);
  6010. FlGui::instance()->options->activate("view_adaptive");
  6011. }
  6012. #endif
  6013. return opt->adaptVisualizationGrid;
  6014. #else
  6015. return 0.;
  6016. #endif
  6017. }
  6018. double opt_view_max_recursion_level(OPT_ARGS_NUM)
  6019. {
  6020. #if defined(HAVE_POST)
  6021. GET_VIEW(0.);
  6022. if(action & GMSH_SET) {
  6023. opt->maxRecursionLevel = (int)val;
  6024. if(data && data->getAdaptiveData()){
  6025. data->getAdaptiveData()->changeResolution
  6026. (opt->timeStep, opt->maxRecursionLevel, opt->targetError);
  6027. view->setChanged(true);
  6028. }
  6029. }
  6030. #if defined(HAVE_FLTK)
  6031. if(_gui_action_valid(action, num)) {
  6032. FlGui::instance()->options->view.value[33]->value(opt->maxRecursionLevel);
  6033. }
  6034. #endif
  6035. return opt->maxRecursionLevel;
  6036. #else
  6037. return 0.;
  6038. #endif
  6039. }
  6040. double opt_view_target_error(OPT_ARGS_NUM)
  6041. {
  6042. #if defined(HAVE_POST)
  6043. GET_VIEW(0.);
  6044. if(action & GMSH_SET) {
  6045. opt->targetError = val;
  6046. if(data && data->getAdaptiveData()){
  6047. data->getAdaptiveData()->changeResolution
  6048. (opt->timeStep, opt->maxRecursionLevel, opt->targetError);
  6049. view->setChanged(true);
  6050. }
  6051. }
  6052. #if defined(HAVE_FLTK)
  6053. if(_gui_action_valid(action, num)) {
  6054. FlGui::instance()->options->view.value[34]->value(opt->targetError);
  6055. }
  6056. #endif
  6057. return opt->targetError;
  6058. #else
  6059. return 0.;
  6060. #endif
  6061. }
  6062. double opt_view_type(OPT_ARGS_NUM)
  6063. {
  6064. #if defined(HAVE_POST)
  6065. GET_VIEWo(0.);
  6066. if(action & GMSH_SET) {
  6067. opt->type = (int)val;
  6068. if(opt->type < 1 || opt->type > 4)
  6069. opt->type = 1;
  6070. if(view) view->setChanged(true);
  6071. }
  6072. #if defined(HAVE_FLTK)
  6073. if(_gui_action_valid(action, num)) {
  6074. FlGui::instance()->options->view.choice[13]->value(opt->type - 1);
  6075. }
  6076. #endif
  6077. return opt->type;
  6078. #else
  6079. return 0.;
  6080. #endif
  6081. }
  6082. double opt_view_auto_position(OPT_ARGS_NUM)
  6083. {
  6084. #if defined(HAVE_POST)
  6085. GET_VIEWo(0.);
  6086. if(action & GMSH_SET) {
  6087. opt->autoPosition = (int)val;
  6088. if(opt->autoPosition < 0 || opt->autoPosition > 10)
  6089. opt->autoPosition = 0;
  6090. }
  6091. #if defined(HAVE_FLTK)
  6092. if(_gui_action_valid(action, num)) {
  6093. FlGui::instance()->options->view.choice[16]->value(opt->autoPosition);
  6094. FlGui::instance()->options->activate("view_axes_auto_2d");
  6095. }
  6096. #endif
  6097. return opt->autoPosition;
  6098. #else
  6099. return 0.;
  6100. #endif
  6101. }
  6102. double opt_view_position0(OPT_ARGS_NUM)
  6103. {
  6104. #if defined(HAVE_POST)
  6105. GET_VIEWo(0.);
  6106. if(action & GMSH_SET) {
  6107. opt->position[0] = (int)val;
  6108. }
  6109. #if defined(HAVE_FLTK)
  6110. if(_gui_action_valid(action, num))
  6111. FlGui::instance()->options->view.value[20]->value(opt->position[0]);
  6112. #endif
  6113. return opt->position[0];
  6114. #else
  6115. return 0.;
  6116. #endif
  6117. }
  6118. double opt_view_position1(OPT_ARGS_NUM)
  6119. {
  6120. #if defined(HAVE_POST)
  6121. GET_VIEWo(0.);
  6122. if(action & GMSH_SET) {
  6123. opt->position[1] = (int)val;
  6124. }
  6125. #if defined(HAVE_FLTK)
  6126. if(_gui_action_valid(action, num))
  6127. FlGui::instance()->options->view.value[21]->value(opt->position[1]);
  6128. #endif
  6129. return opt->position[1];
  6130. #else
  6131. return 0.;
  6132. #endif
  6133. }
  6134. double opt_view_sampling(OPT_ARGS_NUM)
  6135. {
  6136. #if defined(HAVE_POST)
  6137. GET_VIEWo(0.);
  6138. if(action & GMSH_SET) {
  6139. opt->sampling = (int)val;
  6140. if(view) view->setChanged(true);
  6141. }
  6142. #if defined(HAVE_FLTK)
  6143. if(_gui_action_valid(action, num))
  6144. FlGui::instance()->options->view.value[6]->value(opt->sampling);
  6145. #endif
  6146. return opt->sampling;
  6147. #else
  6148. return 1.;
  6149. #endif
  6150. }
  6151. double opt_view_size0(OPT_ARGS_NUM)
  6152. {
  6153. #if defined(HAVE_POST)
  6154. GET_VIEWo(0.);
  6155. if(action & GMSH_SET) {
  6156. opt->size[0] = (int)val;
  6157. }
  6158. #if defined(HAVE_FLTK)
  6159. if(_gui_action_valid(action, num))
  6160. FlGui::instance()->options->view.value[22]->value(opt->size[0]);
  6161. #endif
  6162. return opt->size[0];
  6163. #else
  6164. return 0.;
  6165. #endif
  6166. }
  6167. double opt_view_size1(OPT_ARGS_NUM)
  6168. {
  6169. #if defined(HAVE_POST)
  6170. GET_VIEWo(0.);
  6171. if(action & GMSH_SET) {
  6172. opt->size[1] = (int)val;
  6173. }
  6174. #if defined(HAVE_FLTK)
  6175. if(_gui_action_valid(action, num))
  6176. FlGui::instance()->options->view.value[23]->value(opt->size[1]);
  6177. #endif
  6178. return opt->size[1];
  6179. #else
  6180. return 0.;
  6181. #endif
  6182. }
  6183. double opt_view_axes(OPT_ARGS_NUM)
  6184. {
  6185. #if defined(HAVE_POST)
  6186. GET_VIEWo(0.);
  6187. if(action & GMSH_SET) {
  6188. opt->axes = (int)val;
  6189. if(opt->axes < 0 || opt->axes > 5)
  6190. opt->axes = 0;
  6191. }
  6192. #if defined(HAVE_FLTK)
  6193. if(_gui_action_valid(action, num)) {
  6194. FlGui::instance()->options->view.choice[8]->value(opt->axes);
  6195. FlGui::instance()->options->activate("view_axes");
  6196. }
  6197. #endif
  6198. return opt->axes;
  6199. #else
  6200. return 0.;
  6201. #endif
  6202. }
  6203. double opt_view_axes_mikado(OPT_ARGS_NUM)
  6204. {
  6205. #if defined(HAVE_POST)
  6206. GET_VIEWo(0.);
  6207. if(action & GMSH_SET) {
  6208. opt->axesMikado = (int)val;
  6209. }
  6210. #if defined(HAVE_FLTK)
  6211. if(_gui_action_valid(action, num)) {
  6212. FlGui::instance()->options->view.butt[3]->value(opt->axesMikado);
  6213. }
  6214. #endif
  6215. return opt->axesMikado;
  6216. #else
  6217. return 0.;
  6218. #endif
  6219. }
  6220. double opt_view_axes_auto_position(OPT_ARGS_NUM)
  6221. {
  6222. #if defined(HAVE_POST)
  6223. GET_VIEWo(0.);
  6224. if(action & GMSH_SET) {
  6225. opt->axesAutoPosition = (int)val;
  6226. }
  6227. #if defined(HAVE_FLTK)
  6228. if(_gui_action_valid(action, num)) {
  6229. FlGui::instance()->options->view.butt[25]->value(opt->axesAutoPosition);
  6230. FlGui::instance()->options->activate("view_axes_auto_3d");
  6231. }
  6232. #endif
  6233. return opt->axesAutoPosition;
  6234. #else
  6235. return 0.;
  6236. #endif
  6237. }
  6238. double opt_view_axes_xmin(OPT_ARGS_NUM)
  6239. {
  6240. #if defined(HAVE_POST)
  6241. GET_VIEWo(0.);
  6242. if(action & GMSH_SET) {
  6243. opt->axesPosition[0] = val;
  6244. }
  6245. #if defined(HAVE_FLTK)
  6246. if(_gui_action_valid(action, num)) {
  6247. FlGui::instance()->options->view.value[13]->value(opt->axesPosition[0]);
  6248. }
  6249. #endif
  6250. return opt->axesPosition[0];
  6251. #else
  6252. return 0.;
  6253. #endif
  6254. }
  6255. double opt_view_axes_xmax(OPT_ARGS_NUM)
  6256. {
  6257. #if defined(HAVE_POST)
  6258. GET_VIEWo(0.);
  6259. if(action & GMSH_SET) {
  6260. opt->axesPosition[1] = val;
  6261. }
  6262. #if defined(HAVE_FLTK)
  6263. if(_gui_action_valid(action, num)) {
  6264. FlGui::instance()->options->view.value[16]->value(opt->axesPosition[1]);
  6265. }
  6266. #endif
  6267. return opt->axesPosition[1];
  6268. #else
  6269. return 0.;
  6270. #endif
  6271. }
  6272. double opt_view_axes_ymin(OPT_ARGS_NUM)
  6273. {
  6274. #if defined(HAVE_POST)
  6275. GET_VIEWo(0.);
  6276. if(action & GMSH_SET) {
  6277. opt->axesPosition[2] = val;
  6278. }
  6279. #if defined(HAVE_FLTK)
  6280. if(_gui_action_valid(action, num)) {
  6281. FlGui::instance()->options->view.value[14]->value(opt->axesPosition[2]);
  6282. }
  6283. #endif
  6284. return opt->axesPosition[2];
  6285. #else
  6286. return 0.;
  6287. #endif
  6288. }
  6289. double opt_view_axes_ymax(OPT_ARGS_NUM)
  6290. {
  6291. #if defined(HAVE_POST)
  6292. GET_VIEWo(0.);
  6293. if(action & GMSH_SET) {
  6294. opt->axesPosition[3] = val;
  6295. }
  6296. #if defined(HAVE_FLTK)
  6297. if(_gui_action_valid(action, num)) {
  6298. FlGui::instance()->options->view.value[17]->value(opt->axesPosition[3]);
  6299. }
  6300. #endif
  6301. return opt->axesPosition[3];
  6302. #else
  6303. return 0.;
  6304. #endif
  6305. }
  6306. double opt_view_axes_zmin(OPT_ARGS_NUM)
  6307. {
  6308. #if defined(HAVE_POST)
  6309. GET_VIEWo(0.);
  6310. if(action & GMSH_SET) {
  6311. opt->axesPosition[4] = val;
  6312. }
  6313. #if defined(HAVE_FLTK)
  6314. if(_gui_action_valid(action, num)) {
  6315. FlGui::instance()->options->view.value[15]->value(opt->axesPosition[4]);
  6316. }
  6317. #endif
  6318. return opt->axesPosition[4];
  6319. #else
  6320. return 0.;
  6321. #endif
  6322. }
  6323. double opt_view_axes_zmax(OPT_ARGS_NUM)
  6324. {
  6325. #if defined(HAVE_POST)
  6326. GET_VIEWo(0.);
  6327. if(action & GMSH_SET) {
  6328. opt->axesPosition[5] = val;
  6329. }
  6330. #if defined(HAVE_FLTK)
  6331. if(_gui_action_valid(action, num)) {
  6332. FlGui::instance()->options->view.value[18]->value(opt->axesPosition[5]);
  6333. }
  6334. #endif
  6335. return opt->axesPosition[5];
  6336. #else
  6337. return 0.;
  6338. #endif
  6339. }
  6340. double opt_view_axes_tics0(OPT_ARGS_NUM)
  6341. {
  6342. #if defined(HAVE_POST)
  6343. GET_VIEWo(0.);
  6344. if(action & GMSH_SET) {
  6345. opt->axesTics[0] = val;
  6346. }
  6347. #if defined(HAVE_FLTK)
  6348. if(_gui_action_valid(action, num)) {
  6349. FlGui::instance()->options->view.value[3]->value(opt->axesTics[0]);
  6350. }
  6351. #endif
  6352. return opt->axesTics[0];
  6353. #else
  6354. return 0.;
  6355. #endif
  6356. }
  6357. double opt_view_axes_tics1(OPT_ARGS_NUM)
  6358. {
  6359. #if defined(HAVE_POST)
  6360. GET_VIEWo(0.);
  6361. if(action & GMSH_SET) {
  6362. opt->axesTics[1] = val;
  6363. }
  6364. #if defined(HAVE_FLTK)
  6365. if(_gui_action_valid(action, num)) {
  6366. FlGui::instance()->options->view.value[4]->value(opt->axesTics[1]);
  6367. }
  6368. #endif
  6369. return opt->axesTics[1];
  6370. #else
  6371. return 0.;
  6372. #endif
  6373. }
  6374. double opt_view_axes_tics2(OPT_ARGS_NUM)
  6375. {
  6376. #if defined(HAVE_POST)
  6377. GET_VIEWo(0.);
  6378. if(action & GMSH_SET) {
  6379. opt->axesTics[2] = val;
  6380. }
  6381. #if defined(HAVE_FLTK)
  6382. if(_gui_action_valid(action, num)) {
  6383. FlGui::instance()->options->view.value[5]->value(opt->axesTics[2]);
  6384. }
  6385. #endif
  6386. return opt->axesTics[2];
  6387. #else
  6388. return 0.;
  6389. #endif
  6390. }
  6391. double opt_view_nb_iso(OPT_ARGS_NUM)
  6392. {
  6393. #if defined(HAVE_POST)
  6394. GET_VIEWo(0.);
  6395. if(action & GMSH_SET) {
  6396. opt->nbIso = (int)val;
  6397. if(view) view->setChanged(true);
  6398. }
  6399. #if defined(HAVE_FLTK)
  6400. if(_gui_action_valid(action, num))
  6401. FlGui::instance()->options->view.value[30]->value(opt->nbIso);
  6402. #endif
  6403. return opt->nbIso;
  6404. #else
  6405. return 0.;
  6406. #endif
  6407. }
  6408. double opt_view_boundary(OPT_ARGS_NUM)
  6409. {
  6410. #if defined(HAVE_POST)
  6411. GET_VIEWo(0.);
  6412. if(action & GMSH_SET) {
  6413. opt->boundary = (int)val;
  6414. if(opt->boundary < 0 || opt->boundary > 3)
  6415. opt->boundary = 0;
  6416. if(view) view->setChanged(true);
  6417. }
  6418. #if defined(HAVE_FLTK)
  6419. if(_gui_action_valid(action, num)) {
  6420. FlGui::instance()->options->view.choice[9]->value(opt->boundary);
  6421. }
  6422. #endif
  6423. return opt->boundary;
  6424. #else
  6425. return 0.;
  6426. #endif
  6427. }
  6428. double opt_view_light(OPT_ARGS_NUM)
  6429. {
  6430. #if defined(HAVE_POST)
  6431. GET_VIEWo(0.);
  6432. if(action & GMSH_SET) {
  6433. opt->light = (int)val;
  6434. if(view) view->setChanged(true);
  6435. }
  6436. #if defined(HAVE_FLTK)
  6437. if(_gui_action_valid(action, num)){
  6438. FlGui::instance()->options->view.butt[11]->value(opt->light);
  6439. FlGui::instance()->options->activate("view_light");
  6440. }
  6441. #endif
  6442. return opt->light;
  6443. #else
  6444. return 0.;
  6445. #endif
  6446. }
  6447. double opt_view_light_two_side(OPT_ARGS_NUM)
  6448. {
  6449. #if defined(HAVE_POST)
  6450. GET_VIEWo(0.);
  6451. if(action & GMSH_SET) {
  6452. opt->lightTwoSide = (int)val;
  6453. }
  6454. #if defined(HAVE_FLTK)
  6455. if(_gui_action_valid(action, num))
  6456. FlGui::instance()->options->view.butt[9]->value(opt->lightTwoSide);
  6457. #endif
  6458. return opt->lightTwoSide;
  6459. #else
  6460. return 0.;
  6461. #endif
  6462. }
  6463. double opt_view_light_lines(OPT_ARGS_NUM)
  6464. {
  6465. #if defined(HAVE_POST)
  6466. GET_VIEWo(0.);
  6467. if(action & GMSH_SET) {
  6468. opt->lightLines = (int)val;
  6469. }
  6470. #if defined(HAVE_FLTK)
  6471. if(_gui_action_valid(action, num))
  6472. FlGui::instance()->options->view.butt[8]->value(opt->lightLines);
  6473. #endif
  6474. return opt->lightLines;
  6475. #else
  6476. return 0.;
  6477. #endif
  6478. }
  6479. double opt_view_smooth_normals(OPT_ARGS_NUM)
  6480. {
  6481. #if defined(HAVE_POST)
  6482. GET_VIEWo(0.);
  6483. if(action & GMSH_SET) {
  6484. opt->smoothNormals = (int)val;
  6485. if(view) view->setChanged(true);
  6486. }
  6487. #if defined(HAVE_FLTK)
  6488. if(_gui_action_valid(action, num))
  6489. FlGui::instance()->options->view.butt[12]->value(opt->smoothNormals);
  6490. #endif
  6491. return opt->smoothNormals;
  6492. #else
  6493. return 0.;
  6494. #endif
  6495. }
  6496. double opt_view_angle_smooth_normals(OPT_ARGS_NUM)
  6497. {
  6498. #if defined(HAVE_POST)
  6499. GET_VIEWo(0.);
  6500. if(action & GMSH_SET) {
  6501. opt->angleSmoothNormals = val;
  6502. if(view) view->setChanged(true);
  6503. }
  6504. #if defined(HAVE_FLTK)
  6505. if(_gui_action_valid(action, num))
  6506. FlGui::instance()->options->view.value[10]->value(opt->angleSmoothNormals);
  6507. #endif
  6508. return opt->angleSmoothNormals;
  6509. #else
  6510. return 0.;
  6511. #endif
  6512. }
  6513. double opt_view_show_element(OPT_ARGS_NUM)
  6514. {
  6515. #if defined(HAVE_POST)
  6516. GET_VIEWo(0.);
  6517. if(action & GMSH_SET) {
  6518. opt->showElement = (int)val;
  6519. if(view) view->setChanged(true);
  6520. }
  6521. #if defined(HAVE_FLTK)
  6522. if(_gui_action_valid(action, num))
  6523. FlGui::instance()->options->view.butt[10]->value(opt->showElement);
  6524. #endif
  6525. return opt->showElement;
  6526. #else
  6527. return 0.;
  6528. #endif
  6529. }
  6530. double opt_view_show_time(OPT_ARGS_NUM)
  6531. {
  6532. #if defined(HAVE_POST)
  6533. GET_VIEWo(0.);
  6534. if(action & GMSH_SET) {
  6535. opt->showTime = (int)val;
  6536. if(opt->showTime < 0 || opt->showTime > 4)
  6537. opt->showTime = 0;
  6538. }
  6539. #if defined(HAVE_FLTK)
  6540. if(_gui_action_valid(action, num))
  6541. FlGui::instance()->options->view.choice[12]->value(opt->showTime);
  6542. #endif
  6543. return opt->showTime;
  6544. #else
  6545. return 0.;
  6546. #endif
  6547. }
  6548. double opt_view_show_scale(OPT_ARGS_NUM)
  6549. {
  6550. #if defined(HAVE_POST)
  6551. GET_VIEWo(0.);
  6552. if(action & GMSH_SET) {
  6553. opt->showScale = (int)val;
  6554. }
  6555. #if defined(HAVE_FLTK)
  6556. if(_gui_action_valid(action, num))
  6557. FlGui::instance()->options->view.butt[4]->value(opt->showScale);
  6558. #endif
  6559. return opt->showScale;
  6560. #else
  6561. return 0.;
  6562. #endif
  6563. }
  6564. double opt_view_draw_strings(OPT_ARGS_NUM)
  6565. {
  6566. #if defined(HAVE_POST)
  6567. GET_VIEWo(0.);
  6568. if(action & GMSH_SET) {
  6569. opt->drawStrings = (int)val;
  6570. }
  6571. #if defined(HAVE_FLTK)
  6572. if(_gui_action_valid(action, num))
  6573. FlGui::instance()->options->view.butt[5]->value(opt->drawStrings);
  6574. #endif
  6575. return opt->drawStrings;
  6576. #else
  6577. return 0.;
  6578. #endif
  6579. }
  6580. double opt_view_draw_points(OPT_ARGS_NUM)
  6581. {
  6582. #if defined(HAVE_POST)
  6583. GET_VIEWo(0.);
  6584. if(action & GMSH_SET) {
  6585. opt->drawPoints = (int)val;
  6586. if(view) view->setChanged(true);
  6587. }
  6588. #if defined(HAVE_FLTK)
  6589. if(_gui_action_valid(action, num)){
  6590. if(opt->drawPoints)
  6591. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[1]->menu())[0].set();
  6592. else
  6593. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[1]->menu())[0].clear();
  6594. }
  6595. #endif
  6596. return opt->drawPoints;
  6597. #else
  6598. return 0.;
  6599. #endif
  6600. }
  6601. double opt_view_draw_lines(OPT_ARGS_NUM)
  6602. {
  6603. #if defined(HAVE_POST)
  6604. GET_VIEWo(0.);
  6605. if(action & GMSH_SET) {
  6606. opt->drawLines = (int)val;
  6607. if(view) view->setChanged(true);
  6608. }
  6609. #if defined(HAVE_FLTK)
  6610. if(_gui_action_valid(action, num)){
  6611. if(opt->drawLines)
  6612. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[1]->menu())[1].set();
  6613. else
  6614. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[1]->menu())[1].clear();
  6615. }
  6616. #endif
  6617. return opt->drawLines;
  6618. #else
  6619. return 0.;
  6620. #endif
  6621. }
  6622. double opt_view_draw_triangles(OPT_ARGS_NUM)
  6623. {
  6624. #if defined(HAVE_POST)
  6625. GET_VIEWo(0.);
  6626. if(action & GMSH_SET) {
  6627. opt->drawTriangles = (int)val;
  6628. if(view) view->setChanged(true);
  6629. }
  6630. #if defined(HAVE_FLTK)
  6631. if(_gui_action_valid(action, num)){
  6632. if(opt->drawTriangles)
  6633. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[1]->menu())[2].set();
  6634. else
  6635. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[1]->menu())[2].clear();
  6636. }
  6637. #endif
  6638. return opt->drawTriangles;
  6639. #else
  6640. return 0.;
  6641. #endif
  6642. }
  6643. double opt_view_draw_quadrangles(OPT_ARGS_NUM)
  6644. {
  6645. #if defined(HAVE_POST)
  6646. GET_VIEWo(0.);
  6647. if(action & GMSH_SET) {
  6648. opt->drawQuadrangles = (int)val;
  6649. if(view) view->setChanged(true);
  6650. }
  6651. #if defined(HAVE_FLTK)
  6652. if(_gui_action_valid(action, num)){
  6653. if(opt->drawQuadrangles)
  6654. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[1]->menu())[3].set();
  6655. else
  6656. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[1]->menu())[3].clear();
  6657. }
  6658. #endif
  6659. return opt->drawQuadrangles;
  6660. #else
  6661. return 0.;
  6662. #endif
  6663. }
  6664. double opt_view_draw_tetrahedra(OPT_ARGS_NUM)
  6665. {
  6666. #if defined(HAVE_POST)
  6667. GET_VIEWo(0.);
  6668. if(action & GMSH_SET) {
  6669. opt->drawTetrahedra = (int)val;
  6670. if(view) view->setChanged(true);
  6671. }
  6672. #if defined(HAVE_FLTK)
  6673. if(_gui_action_valid(action, num)){
  6674. if(opt->drawTetrahedra)
  6675. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[1]->menu())[4].set();
  6676. else
  6677. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[1]->menu())[4].clear();
  6678. }
  6679. #endif
  6680. return opt->drawTetrahedra;
  6681. #else
  6682. return 0.;
  6683. #endif
  6684. }
  6685. double opt_view_draw_hexahedra(OPT_ARGS_NUM)
  6686. {
  6687. #if defined(HAVE_POST)
  6688. GET_VIEWo(0.);
  6689. if(action & GMSH_SET) {
  6690. opt->drawHexahedra = (int)val;
  6691. if(view) view->setChanged(true);
  6692. }
  6693. #if defined(HAVE_FLTK)
  6694. if(_gui_action_valid(action, num)){
  6695. if(opt->drawHexahedra)
  6696. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[1]->menu())[5].set();
  6697. else
  6698. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[1]->menu())[5].clear();
  6699. }
  6700. #endif
  6701. return opt->drawHexahedra;
  6702. #else
  6703. return 0.;
  6704. #endif
  6705. }
  6706. double opt_view_draw_prisms(OPT_ARGS_NUM)
  6707. {
  6708. #if defined(HAVE_POST)
  6709. GET_VIEWo(0.);
  6710. if(action & GMSH_SET) {
  6711. opt->drawPrisms = (int)val;
  6712. if(view) view->setChanged(true);
  6713. }
  6714. #if defined(HAVE_FLTK)
  6715. if(_gui_action_valid(action, num)){
  6716. if(opt->drawPrisms)
  6717. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[1]->menu())[6].set();
  6718. else
  6719. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[1]->menu())[6].clear();
  6720. }
  6721. #endif
  6722. return opt->drawPrisms;
  6723. #else
  6724. return 0.;
  6725. #endif
  6726. }
  6727. double opt_view_draw_pyramids(OPT_ARGS_NUM)
  6728. {
  6729. #if defined(HAVE_POST)
  6730. GET_VIEWo(0.);
  6731. if(action & GMSH_SET) {
  6732. opt->drawPyramids = (int)val;
  6733. if(view) view->setChanged(true);
  6734. }
  6735. #if defined(HAVE_FLTK)
  6736. if(_gui_action_valid(action, num)){
  6737. if(opt->drawPyramids)
  6738. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[1]->menu())[7].set();
  6739. else
  6740. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[1]->menu())[7].clear();
  6741. }
  6742. #endif
  6743. return opt->drawPyramids;
  6744. #else
  6745. return 0.;
  6746. #endif
  6747. }
  6748. double opt_view_draw_scalars(OPT_ARGS_NUM)
  6749. {
  6750. #if defined(HAVE_POST)
  6751. GET_VIEWo(0.);
  6752. if(action & GMSH_SET) {
  6753. opt->drawScalars = (int)val;
  6754. if(view) view->setChanged(true);
  6755. }
  6756. #if defined(HAVE_FLTK)
  6757. if(_gui_action_valid(action, num)){
  6758. if(opt->drawScalars)
  6759. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[0]->menu())[0].set();
  6760. else
  6761. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[0]->menu())[0].clear();
  6762. }
  6763. #endif
  6764. return opt->drawScalars;
  6765. #else
  6766. return 0.;
  6767. #endif
  6768. }
  6769. double opt_view_draw_vectors(OPT_ARGS_NUM)
  6770. {
  6771. #if defined(HAVE_POST)
  6772. GET_VIEWo(0.);
  6773. if(action & GMSH_SET) {
  6774. opt->drawVectors = (int)val;
  6775. if(view) view->setChanged(true);
  6776. }
  6777. #if defined(HAVE_FLTK)
  6778. if(_gui_action_valid(action, num)){
  6779. if(opt->drawVectors)
  6780. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[0]->menu())[1].set();
  6781. else
  6782. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[0]->menu())[1].clear();
  6783. }
  6784. #endif
  6785. return opt->drawVectors;
  6786. #else
  6787. return 0.;
  6788. #endif
  6789. }
  6790. double opt_view_draw_tensors(OPT_ARGS_NUM)
  6791. {
  6792. #if defined(HAVE_POST)
  6793. GET_VIEWo(0.);
  6794. if(action & GMSH_SET) {
  6795. opt->drawTensors = (int)val;
  6796. if(view) view->setChanged(true);
  6797. }
  6798. #if defined(HAVE_FLTK)
  6799. if(_gui_action_valid(action, num)){
  6800. if(opt->drawTensors)
  6801. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[0]->menu())[2].set();
  6802. else
  6803. ((Fl_Menu_Item*)FlGui::instance()->options->view.menu[0]->menu())[2].clear();
  6804. }
  6805. #endif
  6806. return opt->drawTensors;
  6807. #else
  6808. return 0.;
  6809. #endif
  6810. }
  6811. double opt_view_draw_skin_only(OPT_ARGS_NUM)
  6812. {
  6813. #if defined(HAVE_POST)
  6814. GET_VIEWo(0.);
  6815. if(action & GMSH_SET) {
  6816. opt->drawSkinOnly = (int)val;
  6817. if(view) view->setChanged(true);
  6818. }
  6819. #if defined(HAVE_FLTK)
  6820. if(_gui_action_valid(action, num))
  6821. FlGui::instance()->options->view.butt[2]->value(opt->drawSkinOnly);
  6822. #endif
  6823. return opt->drawSkinOnly;
  6824. #else
  6825. return 0.;
  6826. #endif
  6827. }
  6828. double opt_view_scale_type(OPT_ARGS_NUM)
  6829. {
  6830. #if defined(HAVE_POST)
  6831. GET_VIEWo(0.);
  6832. if(action & GMSH_SET) {
  6833. opt->scaleType = (int)val;
  6834. if(opt->scaleType < 1 || opt->scaleType > 3)
  6835. opt->scaleType = 1;
  6836. if(view) view->setChanged(true);
  6837. }
  6838. #if defined(HAVE_FLTK)
  6839. if(_gui_action_valid(action, num)) {
  6840. FlGui::instance()->options->view.choice[1]->value(opt->scaleType - 1);
  6841. }
  6842. #endif
  6843. return opt->scaleType;
  6844. #else
  6845. return 0.;
  6846. #endif
  6847. }
  6848. double opt_view_range_type(OPT_ARGS_NUM)
  6849. {
  6850. #if defined(HAVE_POST)
  6851. GET_VIEWo(0.);
  6852. if(action & GMSH_SET) {
  6853. opt->rangeType = (int)val;
  6854. if(opt->rangeType < 1 || opt->rangeType > 3)
  6855. opt->rangeType = 1;
  6856. if(view) view->setChanged(true);
  6857. }
  6858. #if defined(HAVE_FLTK)
  6859. if(_gui_action_valid(action, num)){
  6860. FlGui::instance()->options->view.choice[7]->value(opt->rangeType - 1);
  6861. FlGui::instance()->options->activate("custom_range");
  6862. }
  6863. #endif
  6864. return opt->rangeType;
  6865. #else
  6866. return 0.;
  6867. #endif
  6868. }
  6869. double opt_view_abscissa_range_type(OPT_ARGS_NUM)
  6870. {
  6871. #if defined(HAVE_POST)
  6872. GET_VIEWo(0.);
  6873. if(action & GMSH_SET) {
  6874. opt->abscissaRangeType = (int)val;
  6875. if(opt->abscissaRangeType < 1 || opt->abscissaRangeType > 3)
  6876. opt->abscissaRangeType = 1;
  6877. if(view) view->setChanged(true);
  6878. }
  6879. return opt->abscissaRangeType;
  6880. #else
  6881. return 0.;
  6882. #endif
  6883. }
  6884. double opt_view_tensor_type(OPT_ARGS_NUM)
  6885. {
  6886. #if defined(HAVE_POST)
  6887. GET_VIEWo(0.);
  6888. if(action & GMSH_SET) {
  6889. opt->tensorType = (int)val;
  6890. if(opt->tensorType > 6 || opt->tensorType < 1)
  6891. opt->tensorType = 1;
  6892. if(view) view->setChanged(true);
  6893. }
  6894. #if defined(HAVE_FLTK)
  6895. if(_gui_action_valid(action, num)) {
  6896. FlGui::instance()->options->view.choice[4]->value(opt->tensorType - 1);
  6897. }
  6898. #endif
  6899. return opt->tensorType;
  6900. #else
  6901. return 0.;
  6902. #endif
  6903. }
  6904. double opt_view_vector_type(OPT_ARGS_NUM)
  6905. {
  6906. #if defined(HAVE_POST)
  6907. GET_VIEWo(0.);
  6908. if(action & GMSH_SET) {
  6909. opt->vectorType = (int)val;
  6910. if(opt->vectorType < 1 || opt->vectorType > 6)
  6911. opt->vectorType = 1;
  6912. if(view) view->setChanged(true);
  6913. }
  6914. #if defined(HAVE_FLTK)
  6915. if(_gui_action_valid(action, num)) {
  6916. FlGui::instance()->options->view.choice[2]->value(opt->vectorType - 1);
  6917. }
  6918. #endif
  6919. return opt->vectorType;
  6920. #else
  6921. return 0.;
  6922. #endif
  6923. }
  6924. double opt_view_glyph_location(OPT_ARGS_NUM)
  6925. {
  6926. #if defined(HAVE_POST)
  6927. GET_VIEWo(0.);
  6928. if(action & GMSH_SET) {
  6929. opt->glyphLocation = (int)val;
  6930. if(opt->glyphLocation < 1 || opt->glyphLocation > 2)
  6931. opt->glyphLocation = 1;
  6932. if(view) view->setChanged(true);
  6933. }
  6934. #if defined(HAVE_FLTK)
  6935. if(_gui_action_valid(action, num)) {
  6936. FlGui::instance()->options->view.choice[3]->value(opt->glyphLocation - 1);
  6937. }
  6938. #endif
  6939. return opt->glyphLocation;
  6940. #else
  6941. return 0.;
  6942. #endif
  6943. }
  6944. double opt_view_center_glyphs(OPT_ARGS_NUM)
  6945. {
  6946. #if defined(HAVE_POST)
  6947. GET_VIEWo(0.);
  6948. if(action & GMSH_SET) {
  6949. opt->centerGlyphs = (int)val;
  6950. if(opt->centerGlyphs < 0 || opt->centerGlyphs > 2)
  6951. opt->glyphLocation = 0;
  6952. if(view) view->setChanged(true);
  6953. }
  6954. #if defined(HAVE_FLTK)
  6955. if(_gui_action_valid(action, num)) {
  6956. FlGui::instance()->options->view.choice[15]->value(opt->centerGlyphs);
  6957. }
  6958. #endif
  6959. return opt->centerGlyphs;
  6960. #else
  6961. return 0.;
  6962. #endif
  6963. }
  6964. double opt_view_point_size(OPT_ARGS_NUM)
  6965. {
  6966. #if defined(HAVE_POST)
  6967. GET_VIEWo(0.);
  6968. if(action & GMSH_SET) {
  6969. opt->pointSize = val;
  6970. }
  6971. #if defined(HAVE_FLTK)
  6972. if(_gui_action_valid(action, num))
  6973. FlGui::instance()->options->view.value[61]->value(opt->pointSize);
  6974. #endif
  6975. return opt->pointSize;
  6976. #else
  6977. return 0.;
  6978. #endif
  6979. }
  6980. double opt_view_line_width(OPT_ARGS_NUM)
  6981. {
  6982. #if defined(HAVE_POST)
  6983. GET_VIEWo(0.);
  6984. if(action & GMSH_SET) {
  6985. opt->lineWidth = val;
  6986. }
  6987. #if defined(HAVE_FLTK)
  6988. if(_gui_action_valid(action, num))
  6989. FlGui::instance()->options->view.value[62]->value(opt->lineWidth);
  6990. #endif
  6991. return opt->lineWidth;
  6992. #else
  6993. return 0.;
  6994. #endif
  6995. }
  6996. double opt_view_point_type(OPT_ARGS_NUM)
  6997. {
  6998. #if defined(HAVE_POST)
  6999. GET_VIEWo(0.);
  7000. if(action & GMSH_SET) {
  7001. opt->pointType = (int)val;
  7002. if(opt->pointType < 0 || opt->pointType > 3)
  7003. opt->pointType = 0;
  7004. if(view) view->setChanged(true);
  7005. }
  7006. #if defined(HAVE_FLTK)
  7007. if(_gui_action_valid(action, num)) {
  7008. FlGui::instance()->options->view.choice[5]->value(opt->pointType);
  7009. }
  7010. #endif
  7011. return opt->pointType;
  7012. #else
  7013. return 0.;
  7014. #endif
  7015. }
  7016. double opt_view_line_type(OPT_ARGS_NUM)
  7017. {
  7018. #if defined(HAVE_POST)
  7019. GET_VIEWo(0.);
  7020. if(action & GMSH_SET) {
  7021. opt->lineType = (int)val;
  7022. if(opt->lineType < 0 || opt->lineType > 2)
  7023. opt->lineType = 0;
  7024. if(view) view->setChanged(true);
  7025. }
  7026. #if defined(HAVE_FLTK)
  7027. if(_gui_action_valid(action, num)) {
  7028. FlGui::instance()->options->view.choice[6]->value(opt->lineType);
  7029. }
  7030. #endif
  7031. return opt->lineType;
  7032. #else
  7033. return 0.;
  7034. #endif
  7035. }
  7036. double opt_view_colormap_alpha(OPT_ARGS_NUM)
  7037. {
  7038. #if defined(HAVE_POST)
  7039. GET_VIEWo(0.);
  7040. if(action & GMSH_SET) {
  7041. opt->colorTable.dpar[COLORTABLE_ALPHA] = val;
  7042. ColorTable_Recompute(&opt->colorTable);
  7043. if(view) view->setChanged(true);
  7044. }
  7045. #if defined(HAVE_FLTK)
  7046. if(_gui_action_valid(action, num)) {
  7047. FlGui::instance()->options->view.colorbar->redraw();
  7048. }
  7049. #endif
  7050. return opt->colorTable.dpar[COLORTABLE_ALPHA];
  7051. #else
  7052. return 0.;
  7053. #endif
  7054. }
  7055. double opt_view_colormap_alpha_power(OPT_ARGS_NUM)
  7056. {
  7057. #if defined(HAVE_POST)
  7058. GET_VIEWo(0.);
  7059. if(action & GMSH_SET) {
  7060. opt->colorTable.dpar[COLORTABLE_ALPHAPOW] = val;
  7061. ColorTable_Recompute(&opt->colorTable);
  7062. if(view) view->setChanged(true);
  7063. }
  7064. #if defined(HAVE_FLTK)
  7065. if(_gui_action_valid(action, num)) {
  7066. FlGui::instance()->options->view.colorbar->redraw();
  7067. }
  7068. #endif
  7069. return opt->colorTable.dpar[COLORTABLE_ALPHAPOW];
  7070. #else
  7071. return 0.;
  7072. #endif
  7073. }
  7074. double opt_view_colormap_beta(OPT_ARGS_NUM)
  7075. {
  7076. #if defined(HAVE_POST)
  7077. GET_VIEWo(0.);
  7078. if(action & GMSH_SET) {
  7079. opt->colorTable.dpar[COLORTABLE_BETA] = val;
  7080. ColorTable_Recompute(&opt->colorTable);
  7081. if(view) view->setChanged(true);
  7082. }
  7083. #if defined(HAVE_FLTK)
  7084. if(_gui_action_valid(action, num)) {
  7085. FlGui::instance()->options->view.colorbar->redraw();
  7086. }
  7087. #endif
  7088. return opt->colorTable.dpar[COLORTABLE_BETA];
  7089. #else
  7090. return 0.;
  7091. #endif
  7092. }
  7093. double opt_view_colormap_bias(OPT_ARGS_NUM)
  7094. {
  7095. #if defined(HAVE_POST)
  7096. GET_VIEWo(0.);
  7097. if(action & GMSH_SET) {
  7098. opt->colorTable.dpar[COLORTABLE_BIAS] = val;
  7099. ColorTable_Recompute(&opt->colorTable);
  7100. if(view) view->setChanged(true);
  7101. }
  7102. #if defined(HAVE_FLTK)
  7103. if(_gui_action_valid(action, num)) {
  7104. FlGui::instance()->options->view.colorbar->redraw();
  7105. }
  7106. #endif
  7107. return opt->colorTable.dpar[COLORTABLE_BIAS];
  7108. #else
  7109. return 0.;
  7110. #endif
  7111. }
  7112. double opt_view_colormap_curvature(OPT_ARGS_NUM)
  7113. {
  7114. #if defined(HAVE_POST)
  7115. GET_VIEWo(0.);
  7116. if(action & GMSH_SET) {
  7117. opt->colorTable.dpar[COLORTABLE_CURVATURE] = val;
  7118. ColorTable_Recompute(&opt->colorTable);
  7119. if(view) view->setChanged(true);
  7120. }
  7121. #if defined(HAVE_FLTK)
  7122. if(_gui_action_valid(action, num)) {
  7123. FlGui::instance()->options->view.colorbar->redraw();
  7124. }
  7125. #endif
  7126. return opt->colorTable.dpar[COLORTABLE_CURVATURE];
  7127. #else
  7128. return 0.;
  7129. #endif
  7130. }
  7131. double opt_view_colormap_invert(OPT_ARGS_NUM)
  7132. {
  7133. #if defined(HAVE_POST)
  7134. GET_VIEWo(0.);
  7135. if(action & GMSH_SET) {
  7136. opt->colorTable.ipar[COLORTABLE_INVERT] = (int)val;
  7137. ColorTable_Recompute(&opt->colorTable);
  7138. if(view) view->setChanged(true);
  7139. }
  7140. #if defined(HAVE_FLTK)
  7141. if(_gui_action_valid(action, num)) {
  7142. FlGui::instance()->options->view.colorbar->redraw();
  7143. }
  7144. #endif
  7145. return opt->colorTable.ipar[COLORTABLE_INVERT];
  7146. #else
  7147. return 0.;
  7148. #endif
  7149. }
  7150. double opt_view_colormap_number(OPT_ARGS_NUM)
  7151. {
  7152. #if defined(HAVE_POST)
  7153. GET_VIEWo(0.);
  7154. if(action & GMSH_SET) {
  7155. opt->colorTable.ipar[COLORTABLE_NUMBER] = (int)val;
  7156. ColorTable_Recompute(&opt->colorTable);
  7157. if(view) view->setChanged(true);
  7158. }
  7159. #if defined(HAVE_FLTK)
  7160. if(_gui_action_valid(action, num)) {
  7161. FlGui::instance()->options->view.colorbar->redraw();
  7162. }
  7163. #endif
  7164. return opt->colorTable.ipar[COLORTABLE_NUMBER];
  7165. #else
  7166. return 0.;
  7167. #endif
  7168. }
  7169. double opt_view_colormap_rotation(OPT_ARGS_NUM)
  7170. {
  7171. #if defined(HAVE_POST)
  7172. GET_VIEWo(0.);
  7173. if(action & GMSH_SET) {
  7174. opt->colorTable.ipar[COLORTABLE_ROTATION] = (int)val;
  7175. ColorTable_Recompute(&opt->colorTable);
  7176. if(view) view->setChanged(true);
  7177. }
  7178. #if defined(HAVE_FLTK)
  7179. if(_gui_action_valid(action, num)) {
  7180. FlGui::instance()->options->view.colorbar->redraw();
  7181. }
  7182. #endif
  7183. return opt->colorTable.ipar[COLORTABLE_ROTATION];
  7184. #else
  7185. return 0.;
  7186. #endif
  7187. }
  7188. double opt_view_colormap_swap(OPT_ARGS_NUM)
  7189. {
  7190. #if defined(HAVE_POST)
  7191. GET_VIEWo(0.);
  7192. if(action & GMSH_SET) {
  7193. opt->colorTable.ipar[COLORTABLE_SWAP] = (int)val;
  7194. ColorTable_Recompute(&opt->colorTable);
  7195. if(view) view->setChanged(true);
  7196. }
  7197. #if defined(HAVE_FLTK)
  7198. if(_gui_action_valid(action, num)) {
  7199. FlGui::instance()->options->view.colorbar->redraw();
  7200. }
  7201. #endif
  7202. return opt->colorTable.ipar[COLORTABLE_SWAP];
  7203. #else
  7204. return 0.;
  7205. #endif
  7206. }
  7207. double opt_view_external_view(OPT_ARGS_NUM)
  7208. {
  7209. #if defined(HAVE_POST)
  7210. GET_VIEWo(0.);
  7211. if(action & GMSH_SET) {
  7212. opt->externalViewIndex = (int)val;
  7213. if(view) view->setChanged(true);
  7214. }
  7215. #if defined(HAVE_FLTK)
  7216. if(_gui_action_valid(action, num)){
  7217. // warning: Fl_Choice::size() returns number of items+1
  7218. int item = opt->externalViewIndex + 1;
  7219. if(item > -1 && item < FlGui::instance()->options->view.choice[10]->size()-1)
  7220. FlGui::instance()->options->view.choice[10]->value(item);
  7221. else
  7222. FlGui::instance()->options->view.choice[10]->value(0);
  7223. }
  7224. #endif
  7225. return opt->externalViewIndex;
  7226. #else
  7227. return 0.;
  7228. #endif
  7229. }
  7230. double opt_view_gen_raise_view(OPT_ARGS_NUM)
  7231. {
  7232. #if defined(HAVE_POST)
  7233. GET_VIEWo(0.);
  7234. if(action & GMSH_SET) {
  7235. opt->viewIndexForGenRaise = (int)val;
  7236. if(view) view->setChanged(true);
  7237. }
  7238. #if defined(HAVE_FLTK)
  7239. if(_gui_action_valid(action, num)){
  7240. // warning: Fl_Choice::size() returns number of items+1
  7241. int item = opt->viewIndexForGenRaise + 1;
  7242. if(item > -1 && item < FlGui::instance()->options->view.choice[11]->size()-1)
  7243. FlGui::instance()->options->view.choice[11]->value(item);
  7244. else
  7245. FlGui::instance()->options->view.choice[11]->value(0);
  7246. }
  7247. #endif
  7248. return opt->viewIndexForGenRaise;
  7249. #else
  7250. return 0.;
  7251. #endif
  7252. }
  7253. double opt_view_gen_raise_factor(OPT_ARGS_NUM)
  7254. {
  7255. #if defined(HAVE_POST)
  7256. GET_VIEWo(0.);
  7257. if(action & GMSH_SET) {
  7258. opt->genRaiseFactor = val;
  7259. if(view) view->setChanged(true);
  7260. }
  7261. #if defined(HAVE_FLTK)
  7262. if(_gui_action_valid(action, num))
  7263. FlGui::instance()->options->view.value[2]->value(opt->genRaiseFactor);
  7264. #endif
  7265. return opt->genRaiseFactor;
  7266. #else
  7267. return 0.;
  7268. #endif
  7269. }
  7270. double opt_view_use_gen_raise(OPT_ARGS_NUM)
  7271. {
  7272. #if defined(HAVE_POST)
  7273. GET_VIEWo(0.);
  7274. if(action & GMSH_SET) {
  7275. opt->useGenRaise = (int)val;
  7276. if(view) view->setChanged(true);
  7277. }
  7278. #if defined(HAVE_FLTK)
  7279. if(_gui_action_valid(action, num)){
  7280. FlGui::instance()->options->view.butt[6]->value(opt->useGenRaise);
  7281. FlGui::instance()->options->activate("view_general_transform");
  7282. }
  7283. #endif
  7284. return opt->useGenRaise;
  7285. #else
  7286. return 0.;
  7287. #endif
  7288. }
  7289. double opt_view_use_stipple(OPT_ARGS_NUM)
  7290. {
  7291. #if defined(HAVE_POST)
  7292. GET_VIEWo(0.);
  7293. if(action & GMSH_SET) {
  7294. opt->useStipple = (int)val;
  7295. }
  7296. #if defined(HAVE_FLTK)
  7297. if(_gui_action_valid(action, num)){
  7298. FlGui::instance()->options->view.butt[26]->value(opt->useStipple);
  7299. }
  7300. #endif
  7301. return opt->useStipple;
  7302. #else
  7303. return 0.;
  7304. #endif
  7305. }
  7306. double opt_view_clip(OPT_ARGS_NUM)
  7307. {
  7308. #if defined(HAVE_POST)
  7309. GET_VIEWo(0.);
  7310. if(action & GMSH_SET) {
  7311. opt->clip = (int)val;
  7312. }
  7313. #if defined(HAVE_FLTK)
  7314. if(_gui_action_valid(action, num)){
  7315. FlGui::instance()->clipping->resetBrowser();
  7316. }
  7317. #endif
  7318. return opt->clip;
  7319. #else
  7320. return 0.;
  7321. #endif
  7322. }
  7323. double opt_view_force_num_components(OPT_ARGS_NUM)
  7324. {
  7325. #if defined(HAVE_POST)
  7326. GET_VIEWo(0.);
  7327. if(action & GMSH_SET) {
  7328. opt->forceNumComponents = (int)val;
  7329. if(view) view->setChanged(true);
  7330. }
  7331. #if defined(HAVE_FLTK)
  7332. if(_gui_action_valid(action, num)){
  7333. if(opt->forceNumComponents == 1)
  7334. FlGui::instance()->options->view.choice[14]->value(1);
  7335. else if(opt->forceNumComponents == 3)
  7336. FlGui::instance()->options->view.choice[14]->value(2);
  7337. else if(opt->forceNumComponents == 9)
  7338. FlGui::instance()->options->view.choice[14]->value(3);
  7339. else
  7340. FlGui::instance()->options->view.choice[14]->value(0);
  7341. }
  7342. #endif
  7343. return opt->forceNumComponents;
  7344. #else
  7345. return 0.;
  7346. #endif
  7347. }
  7348. static double ovcm(OPT_ARGS_NUM, int nn)
  7349. {
  7350. #if defined(HAVE_POST)
  7351. GET_VIEWo(0.);
  7352. if(action & GMSH_SET) {
  7353. opt->componentMap[nn] = (int)val;
  7354. if(view) view->setChanged(true);
  7355. }
  7356. #if defined(HAVE_FLTK)
  7357. if(_gui_action_valid(action, num)){
  7358. FlGui::instance()->options->view.value[70 + nn]->value
  7359. (opt->componentMap[nn]);
  7360. }
  7361. #endif
  7362. return opt->componentMap[nn];
  7363. #else
  7364. return 0.;
  7365. #endif
  7366. }
  7367. double opt_view_component_map0(OPT_ARGS_NUM){ return ovcm(num, action, val, 0); }
  7368. double opt_view_component_map1(OPT_ARGS_NUM){ return ovcm(num, action, val, 1); }
  7369. double opt_view_component_map2(OPT_ARGS_NUM){ return ovcm(num, action, val, 2); }
  7370. double opt_view_component_map3(OPT_ARGS_NUM){ return ovcm(num, action, val, 3); }
  7371. double opt_view_component_map4(OPT_ARGS_NUM){ return ovcm(num, action, val, 4); }
  7372. double opt_view_component_map5(OPT_ARGS_NUM){ return ovcm(num, action, val, 5); }
  7373. double opt_view_component_map6(OPT_ARGS_NUM){ return ovcm(num, action, val, 6); }
  7374. double opt_view_component_map7(OPT_ARGS_NUM){ return ovcm(num, action, val, 7); }
  7375. double opt_view_component_map8(OPT_ARGS_NUM){ return ovcm(num, action, val, 8); }
  7376. double opt_print_file_format(OPT_ARGS_NUM)
  7377. {
  7378. if(action & GMSH_SET)
  7379. CTX::instance()->print.fileFormat = (int)val;
  7380. return CTX::instance()->print.fileFormat;
  7381. }
  7382. double opt_print_eps_compress(OPT_ARGS_NUM)
  7383. {
  7384. if(action & GMSH_SET)
  7385. CTX::instance()->print.epsCompress = (int)val;
  7386. return CTX::instance()->print.epsCompress;
  7387. }
  7388. double opt_print_eps_ps3shading(OPT_ARGS_NUM)
  7389. {
  7390. if(action & GMSH_SET)
  7391. CTX::instance()->print.epsPS3Shading = (int)val;
  7392. return CTX::instance()->print.epsPS3Shading;
  7393. }
  7394. double opt_print_eps_quality(OPT_ARGS_NUM)
  7395. {
  7396. if(action & GMSH_SET)
  7397. CTX::instance()->print.epsQuality = (int)val;
  7398. return CTX::instance()->print.epsQuality;
  7399. }
  7400. double opt_print_eps_occlusion_culling(OPT_ARGS_NUM)
  7401. {
  7402. if(action & GMSH_SET)
  7403. CTX::instance()->print.epsOcclusionCulling = (int)val;
  7404. return CTX::instance()->print.epsOcclusionCulling;
  7405. }
  7406. double opt_print_eps_best_root(OPT_ARGS_NUM)
  7407. {
  7408. if(action & GMSH_SET)
  7409. CTX::instance()->print.epsBestRoot = (int)val;
  7410. return CTX::instance()->print.epsBestRoot;
  7411. }
  7412. double opt_print_eps_line_width_factor(OPT_ARGS_NUM)
  7413. {
  7414. if(action & GMSH_SET)
  7415. CTX::instance()->print.epsLineWidthFactor = val;
  7416. return CTX::instance()->print.epsLineWidthFactor;
  7417. }
  7418. double opt_print_eps_point_size_factor(OPT_ARGS_NUM)
  7419. {
  7420. if(action & GMSH_SET)
  7421. CTX::instance()->print.epsPointSizeFactor = val;
  7422. return CTX::instance()->print.epsPointSizeFactor;
  7423. }
  7424. double opt_print_jpeg_quality(OPT_ARGS_NUM)
  7425. {
  7426. if(action & GMSH_SET)
  7427. CTX::instance()->print.jpegQuality = (int)val;
  7428. return CTX::instance()->print.jpegQuality;
  7429. }
  7430. double opt_print_jpeg_smoothing(OPT_ARGS_NUM)
  7431. {
  7432. if(action & GMSH_SET)
  7433. CTX::instance()->print.jpegSmoothing = (int)val;
  7434. return CTX::instance()->print.jpegSmoothing;
  7435. }
  7436. double opt_print_geo_labels(OPT_ARGS_NUM)
  7437. {
  7438. if(action & GMSH_SET)
  7439. CTX::instance()->print.geoLabels = (int)val;
  7440. return CTX::instance()->print.geoLabels;
  7441. }
  7442. double opt_print_geo_only_physicals(OPT_ARGS_NUM)
  7443. {
  7444. if(action & GMSH_SET)
  7445. CTX::instance()->print.geoOnlyPhysicals = (int)val;
  7446. return CTX::instance()->print.geoOnlyPhysicals;
  7447. }
  7448. double opt_print_pos_elementary(OPT_ARGS_NUM)
  7449. {
  7450. if(action & GMSH_SET)
  7451. CTX::instance()->print.posElementary = (int)val;
  7452. return CTX::instance()->print.posElementary;
  7453. }
  7454. double opt_print_pos_element(OPT_ARGS_NUM)
  7455. {
  7456. if(action & GMSH_SET)
  7457. CTX::instance()->print.posElement = (int)val;
  7458. return CTX::instance()->print.posElement;
  7459. }
  7460. double opt_print_pos_gamma(OPT_ARGS_NUM)
  7461. {
  7462. if(action & GMSH_SET)
  7463. CTX::instance()->print.posGamma = (int)val;
  7464. return CTX::instance()->print.posGamma;
  7465. }
  7466. double opt_print_pos_eta(OPT_ARGS_NUM)
  7467. {
  7468. if(action & GMSH_SET)
  7469. CTX::instance()->print.posEta = (int)val;
  7470. return CTX::instance()->print.posEta;
  7471. }
  7472. double opt_print_pos_rho(OPT_ARGS_NUM)
  7473. {
  7474. if(action & GMSH_SET)
  7475. CTX::instance()->print.posRho = (int)val;
  7476. return CTX::instance()->print.posRho;
  7477. }
  7478. double opt_print_pos_disto(OPT_ARGS_NUM)
  7479. {
  7480. if(action & GMSH_SET)
  7481. CTX::instance()->print.posDisto = (int)val;
  7482. return CTX::instance()->print.posDisto;
  7483. }
  7484. double opt_print_gif_dither(OPT_ARGS_NUM)
  7485. {
  7486. if(action & GMSH_SET)
  7487. CTX::instance()->print.gifDither = (int)val;
  7488. return CTX::instance()->print.gifDither;
  7489. }
  7490. double opt_print_gif_sort(OPT_ARGS_NUM)
  7491. {
  7492. if(action & GMSH_SET)
  7493. CTX::instance()->print.gifSort = (int)val;
  7494. return CTX::instance()->print.gifSort;
  7495. }
  7496. double opt_print_gif_interlace(OPT_ARGS_NUM)
  7497. {
  7498. if(action & GMSH_SET)
  7499. CTX::instance()->print.gifInterlace = (int)val;
  7500. return CTX::instance()->print.gifInterlace;
  7501. }
  7502. double opt_print_gif_transparent(OPT_ARGS_NUM)
  7503. {
  7504. if(action & GMSH_SET)
  7505. CTX::instance()->print.gifTransparent = (int)val;
  7506. return CTX::instance()->print.gifTransparent;
  7507. }
  7508. double opt_print_background(OPT_ARGS_NUM)
  7509. {
  7510. if(action & GMSH_SET)
  7511. CTX::instance()->print.background = (int)val;
  7512. return CTX::instance()->print.background;
  7513. }
  7514. double opt_print_text(OPT_ARGS_NUM)
  7515. {
  7516. if(action & GMSH_SET)
  7517. CTX::instance()->print.text = (int)val;
  7518. return CTX::instance()->print.text;
  7519. }
  7520. double opt_print_tex_as_equation(OPT_ARGS_NUM)
  7521. {
  7522. if(action & GMSH_SET)
  7523. CTX::instance()->print.texAsEquation = (int)val;
  7524. return CTX::instance()->print.texAsEquation;
  7525. }
  7526. double opt_print_composite_windows(OPT_ARGS_NUM)
  7527. {
  7528. if(action & GMSH_SET)
  7529. CTX::instance()->print.compositeWindows = (int)val;
  7530. return CTX::instance()->print.compositeWindows;
  7531. }
  7532. double opt_print_delete_tmp_files(OPT_ARGS_NUM)
  7533. {
  7534. if(action & GMSH_SET)
  7535. CTX::instance()->print.deleteTmpFiles = (int)val;
  7536. return CTX::instance()->print.deleteTmpFiles;
  7537. }
  7538. // Color option routines
  7539. #if defined(HAVE_FLTK)
  7540. #define CCC(col,but) \
  7541. if(FlGui::available() && (action & GMSH_GUI)){ \
  7542. Fl_Color c = fl_color_cube(CTX::instance()->unpackRed(col)*FL_NUM_RED/256, \
  7543. CTX::instance()->unpackGreen(col)*FL_NUM_GREEN/256, \
  7544. CTX::instance()->unpackBlue(col)*FL_NUM_BLUE/256); \
  7545. (but)->color(c); \
  7546. (but)->labelcolor(fl_contrast(FL_BLACK,c)); \
  7547. (but)->redraw(); \
  7548. }
  7549. #endif
  7550. unsigned int opt_general_color_background(OPT_ARGS_COL)
  7551. {
  7552. if(action & GMSH_SET) {
  7553. CTX::instance()->color.bg = val;
  7554. #if defined(HAVE_FLTK)
  7555. if(FlGui::available())
  7556. FlGui::instance()->options->view.colorbar->redraw();
  7557. #endif
  7558. }
  7559. #if defined(HAVE_FLTK)
  7560. CCC(CTX::instance()->color.bg, FlGui::instance()->options->general.color[0]);
  7561. #endif
  7562. return CTX::instance()->color.bg;
  7563. }
  7564. unsigned int opt_general_color_background_gradient(OPT_ARGS_COL)
  7565. {
  7566. if(action & GMSH_SET)
  7567. CTX::instance()->color.bgGrad = val;
  7568. #if defined(HAVE_FLTK)
  7569. CCC(CTX::instance()->color.bgGrad, FlGui::instance()->options->general.color[1]);
  7570. #endif
  7571. return CTX::instance()->color.bgGrad;
  7572. }
  7573. unsigned int opt_general_color_foreground(OPT_ARGS_COL)
  7574. {
  7575. if(action & GMSH_SET)
  7576. CTX::instance()->color.fg = val;
  7577. #if defined(HAVE_FLTK)
  7578. CCC(CTX::instance()->color.fg, FlGui::instance()->options->general.color[2]);
  7579. #endif
  7580. return CTX::instance()->color.fg;
  7581. }
  7582. unsigned int opt_general_color_text(OPT_ARGS_COL)
  7583. {
  7584. if(action & GMSH_SET)
  7585. CTX::instance()->color.text = val;
  7586. #if defined(HAVE_FLTK)
  7587. CCC(CTX::instance()->color.text, FlGui::instance()->options->general.color[3]);
  7588. drawContext::global()->resetFontTextures();
  7589. #endif
  7590. return CTX::instance()->color.text;
  7591. }
  7592. unsigned int opt_general_color_axes(OPT_ARGS_COL)
  7593. {
  7594. if(action & GMSH_SET)
  7595. CTX::instance()->color.axes = val;
  7596. #if defined(HAVE_FLTK)
  7597. CCC(CTX::instance()->color.axes, FlGui::instance()->options->general.color[4]);
  7598. drawContext::global()->resetFontTextures();
  7599. #endif
  7600. return CTX::instance()->color.axes;
  7601. }
  7602. unsigned int opt_general_color_small_axes(OPT_ARGS_COL)
  7603. {
  7604. if(action & GMSH_SET)
  7605. CTX::instance()->color.smallAxes = val;
  7606. #if defined(HAVE_FLTK)
  7607. CCC(CTX::instance()->color.smallAxes, FlGui::instance()->options->general.color[5]);
  7608. drawContext::global()->resetFontTextures();
  7609. #endif
  7610. return CTX::instance()->color.smallAxes;
  7611. }
  7612. unsigned int opt_general_color_ambient_light(OPT_ARGS_COL)
  7613. {
  7614. if(action & GMSH_SET)
  7615. for(int i = 0; i < 6; i++)
  7616. CTX::instance()->color.ambientLight[i] = val;
  7617. #if defined(HAVE_FLTK)
  7618. CCC(CTX::instance()->color.ambientLight[0], FlGui::instance()->options->general.color[6]);
  7619. #endif
  7620. return CTX::instance()->color.ambientLight[0];
  7621. }
  7622. unsigned int opt_general_color_diffuse_light(OPT_ARGS_COL)
  7623. {
  7624. if(action & GMSH_SET)
  7625. for(int i = 0; i < 6; i++)
  7626. CTX::instance()->color.diffuseLight[i] = val;
  7627. #if defined(HAVE_FLTK)
  7628. CCC(CTX::instance()->color.diffuseLight[0], FlGui::instance()->options->general.color[7]);
  7629. #endif
  7630. return CTX::instance()->color.diffuseLight[0];
  7631. }
  7632. unsigned int opt_general_color_specular_light(OPT_ARGS_COL)
  7633. {
  7634. if(action & GMSH_SET)
  7635. for(int i = 0; i < 6; i++)
  7636. CTX::instance()->color.specularLight[i] = val;
  7637. #if defined(HAVE_FLTK)
  7638. CCC(CTX::instance()->color.specularLight[0], FlGui::instance()->options->general.color[8]);
  7639. #endif
  7640. return CTX::instance()->color.specularLight[0];
  7641. }
  7642. unsigned int opt_geometry_color_points(OPT_ARGS_COL)
  7643. {
  7644. if(action & GMSH_SET)
  7645. CTX::instance()->color.geom.point = val;
  7646. #if defined(HAVE_FLTK)
  7647. CCC(CTX::instance()->color.geom.point, FlGui::instance()->options->geo.color[0]);
  7648. #endif
  7649. return CTX::instance()->color.geom.point;
  7650. }
  7651. unsigned int opt_geometry_color_lines(OPT_ARGS_COL)
  7652. {
  7653. if(action & GMSH_SET)
  7654. CTX::instance()->color.geom.line = val;
  7655. #if defined(HAVE_FLTK)
  7656. CCC(CTX::instance()->color.geom.line, FlGui::instance()->options->geo.color[1]);
  7657. #endif
  7658. return CTX::instance()->color.geom.line;
  7659. }
  7660. unsigned int opt_geometry_color_surfaces(OPT_ARGS_COL)
  7661. {
  7662. if(action & GMSH_SET)
  7663. CTX::instance()->color.geom.surface = val;
  7664. #if defined(HAVE_FLTK)
  7665. CCC(CTX::instance()->color.geom.surface, FlGui::instance()->options->geo.color[2]);
  7666. #endif
  7667. return CTX::instance()->color.geom.surface;
  7668. }
  7669. unsigned int opt_geometry_color_volumes(OPT_ARGS_COL)
  7670. {
  7671. if(action & GMSH_SET)
  7672. CTX::instance()->color.geom.volume = val;
  7673. #if defined(HAVE_FLTK)
  7674. CCC(CTX::instance()->color.geom.volume, FlGui::instance()->options->geo.color[3]);
  7675. #endif
  7676. return CTX::instance()->color.geom.volume;
  7677. }
  7678. unsigned int opt_geometry_color_selection(OPT_ARGS_COL)
  7679. {
  7680. if(action & GMSH_SET)
  7681. CTX::instance()->color.geom.selection = val;
  7682. #if defined(HAVE_FLTK)
  7683. CCC(CTX::instance()->color.geom.selection, FlGui::instance()->options->geo.color[4]);
  7684. #endif
  7685. return CTX::instance()->color.geom.selection;
  7686. }
  7687. unsigned int opt_geometry_color_highlight0(OPT_ARGS_COL)
  7688. {
  7689. if(action & GMSH_SET){
  7690. CTX::instance()->color.geom.highlight[0] = val;
  7691. }
  7692. #if defined(HAVE_FLTK)
  7693. CCC(CTX::instance()->color.geom.highlight[0], FlGui::instance()->options->geo.color[5]);
  7694. #endif
  7695. return CTX::instance()->color.geom.highlight[0];
  7696. }
  7697. unsigned int opt_geometry_color_highlight1(OPT_ARGS_COL)
  7698. {
  7699. if(action & GMSH_SET){
  7700. CTX::instance()->color.geom.highlight[1] = val;
  7701. }
  7702. #if defined(HAVE_FLTK)
  7703. CCC(CTX::instance()->color.geom.highlight[1], FlGui::instance()->options->geo.color[6]);
  7704. #endif
  7705. return CTX::instance()->color.geom.highlight[1];
  7706. }
  7707. unsigned int opt_geometry_color_highlight2(OPT_ARGS_COL)
  7708. {
  7709. if(action & GMSH_SET)
  7710. CTX::instance()->color.geom.highlight[2] = val;
  7711. #if defined(HAVE_FLTK)
  7712. CCC(CTX::instance()->color.geom.highlight[2], FlGui::instance()->options->geo.color[7]);
  7713. #endif
  7714. return CTX::instance()->color.geom.highlight[2];
  7715. }
  7716. unsigned int opt_geometry_color_tangents(OPT_ARGS_COL)
  7717. {
  7718. if(action & GMSH_SET)
  7719. CTX::instance()->color.geom.tangents = val;
  7720. #if defined(HAVE_FLTK)
  7721. CCC(CTX::instance()->color.geom.tangents, FlGui::instance()->options->geo.color[8]);
  7722. #endif
  7723. return CTX::instance()->color.geom.tangents;
  7724. }
  7725. unsigned int opt_geometry_color_normals(OPT_ARGS_COL)
  7726. {
  7727. if(action & GMSH_SET)
  7728. CTX::instance()->color.geom.normals = val;
  7729. #if defined(HAVE_FLTK)
  7730. CCC(CTX::instance()->color.geom.normals, FlGui::instance()->options->geo.color[9]);
  7731. #endif
  7732. return CTX::instance()->color.geom.normals;
  7733. }
  7734. unsigned int opt_geometry_color_projection(OPT_ARGS_COL)
  7735. {
  7736. if(action & GMSH_SET){
  7737. CTX::instance()->color.geom.projection = val;
  7738. }
  7739. #if defined(HAVE_FLTK)
  7740. CCC(CTX::instance()->color.geom.projection, FlGui::instance()->options->geo.color[10]);
  7741. #endif
  7742. return CTX::instance()->color.geom.projection;
  7743. }
  7744. unsigned int opt_mesh_color_points(OPT_ARGS_COL)
  7745. {
  7746. if(action & GMSH_SET) {
  7747. CTX::instance()->color.mesh.vertex = val;
  7748. }
  7749. #if defined(HAVE_FLTK)
  7750. CCC(CTX::instance()->color.mesh.vertex, FlGui::instance()->options->mesh.color[0]);
  7751. #endif
  7752. return CTX::instance()->color.mesh.vertex;
  7753. }
  7754. unsigned int opt_mesh_color_points_sup(OPT_ARGS_COL)
  7755. {
  7756. if(action & GMSH_SET) {
  7757. CTX::instance()->color.mesh.vertexSup = val;
  7758. }
  7759. #if defined(HAVE_FLTK)
  7760. CCC(CTX::instance()->color.mesh.vertexSup, FlGui::instance()->options->mesh.color[1]);
  7761. #endif
  7762. return CTX::instance()->color.mesh.vertexSup;
  7763. }
  7764. unsigned int opt_mesh_color_lines(OPT_ARGS_COL)
  7765. {
  7766. if(action & GMSH_SET) {
  7767. // vertex arrays need to be regenerated only when we color by
  7768. // element type
  7769. if(CTX::instance()->color.mesh.line != val &&
  7770. CTX::instance()->mesh.colorCarousel == 0)
  7771. CTX::instance()->mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
  7772. CTX::instance()->color.mesh.line = val;
  7773. }
  7774. #if defined(HAVE_FLTK)
  7775. CCC(CTX::instance()->color.mesh.line, FlGui::instance()->options->mesh.color[2]);
  7776. #endif
  7777. return CTX::instance()->color.mesh.line;
  7778. }
  7779. unsigned int opt_mesh_color_triangles(OPT_ARGS_COL)
  7780. {
  7781. if(action & GMSH_SET) {
  7782. // vertex arrays need to be regenerated only when we color by
  7783. // element type
  7784. if(CTX::instance()->color.mesh.triangle != val &&
  7785. CTX::instance()->mesh.colorCarousel == 0)
  7786. CTX::instance()->mesh.changed |= ENT_SURFACE;
  7787. CTX::instance()->color.mesh.triangle = val;
  7788. }
  7789. #if defined(HAVE_FLTK)
  7790. CCC(CTX::instance()->color.mesh.triangle, FlGui::instance()->options->mesh.color[3]);
  7791. #endif
  7792. return CTX::instance()->color.mesh.triangle;
  7793. }
  7794. unsigned int opt_mesh_color_quadrangles(OPT_ARGS_COL)
  7795. {
  7796. if(action & GMSH_SET) {
  7797. // vertex arrays need to be regenerated only when we color by
  7798. // element type
  7799. if(CTX::instance()->color.mesh.quadrangle != val &&
  7800. CTX::instance()->mesh.colorCarousel == 0)
  7801. CTX::instance()->mesh.changed |= ENT_SURFACE;
  7802. CTX::instance()->color.mesh.quadrangle = val;
  7803. }
  7804. #if defined(HAVE_FLTK)
  7805. CCC(CTX::instance()->color.mesh.quadrangle, FlGui::instance()->options->mesh.color[4]);
  7806. #endif
  7807. return CTX::instance()->color.mesh.quadrangle;
  7808. }
  7809. unsigned int opt_mesh_color_tetrahedra(OPT_ARGS_COL)
  7810. {
  7811. if(action & GMSH_SET) {
  7812. // vertex arrays need to be regenerated only when we color by
  7813. // element type
  7814. if(CTX::instance()->color.mesh.tetrahedron != val &&
  7815. CTX::instance()->mesh.colorCarousel == 0)
  7816. CTX::instance()->mesh.changed |= ENT_VOLUME;
  7817. CTX::instance()->color.mesh.tetrahedron = val;
  7818. }
  7819. #if defined(HAVE_FLTK)
  7820. CCC(CTX::instance()->color.mesh.tetrahedron, FlGui::instance()->options->mesh.color[5]);
  7821. #endif
  7822. return CTX::instance()->color.mesh.tetrahedron;
  7823. }
  7824. unsigned int opt_mesh_color_hexahedra(OPT_ARGS_COL)
  7825. {
  7826. if(action & GMSH_SET) {
  7827. // vertex arrays need to be regenerated only when we color by
  7828. // element type
  7829. if(CTX::instance()->color.mesh.hexahedron != val &&
  7830. CTX::instance()->mesh.colorCarousel == 0)
  7831. CTX::instance()->mesh.changed |= ENT_VOLUME;
  7832. CTX::instance()->color.mesh.hexahedron = val;
  7833. }
  7834. #if defined(HAVE_FLTK)
  7835. CCC(CTX::instance()->color.mesh.hexahedron,
  7836. FlGui::instance()->options->mesh.color[6]);
  7837. #endif
  7838. return CTX::instance()->color.mesh.hexahedron;
  7839. }
  7840. unsigned int opt_mesh_color_prisms(OPT_ARGS_COL)
  7841. {
  7842. if(action & GMSH_SET) {
  7843. // vertex arrays need to be regenerated only when we color by
  7844. // element type
  7845. if(CTX::instance()->color.mesh.prism != val &&
  7846. CTX::instance()->mesh.colorCarousel == 0)
  7847. CTX::instance()->mesh.changed |= ENT_VOLUME;
  7848. CTX::instance()->color.mesh.prism = val;
  7849. }
  7850. #if defined(HAVE_FLTK)
  7851. CCC(CTX::instance()->color.mesh.prism, FlGui::instance()->options->mesh.color[7]);
  7852. #endif
  7853. return CTX::instance()->color.mesh.prism;
  7854. }
  7855. unsigned int opt_mesh_color_pyramid(OPT_ARGS_COL)
  7856. {
  7857. if(action & GMSH_SET) {
  7858. // vertex arrays need to be regenerated only when we color by
  7859. // element type
  7860. if(CTX::instance()->color.mesh.pyramid != val &&
  7861. CTX::instance()->mesh.colorCarousel == 0)
  7862. CTX::instance()->mesh.changed |= ENT_VOLUME;
  7863. CTX::instance()->color.mesh.pyramid = val;
  7864. }
  7865. #if defined(HAVE_FLTK)
  7866. CCC(CTX::instance()->color.mesh.pyramid, FlGui::instance()->options->mesh.color[8]);
  7867. #endif
  7868. return CTX::instance()->color.mesh.pyramid;
  7869. }
  7870. unsigned int opt_mesh_color_tangents(OPT_ARGS_COL)
  7871. {
  7872. if(action & GMSH_SET) {
  7873. CTX::instance()->color.mesh.tangents = val;
  7874. }
  7875. #if defined(HAVE_FLTK)
  7876. CCC(CTX::instance()->color.mesh.tangents, FlGui::instance()->options->mesh.color[9]);
  7877. #endif
  7878. return CTX::instance()->color.mesh.tangents;
  7879. }
  7880. unsigned int opt_mesh_color_normals(OPT_ARGS_COL)
  7881. {
  7882. if(action & GMSH_SET) {
  7883. CTX::instance()->color.mesh.normals = val;
  7884. }
  7885. #if defined(HAVE_FLTK)
  7886. CCC(CTX::instance()->color.mesh.normals, FlGui::instance()->options->mesh.color[10]);
  7887. #endif
  7888. return CTX::instance()->color.mesh.normals;
  7889. }
  7890. unsigned int opt_mesh_color_(int i, OPT_ARGS_COL)
  7891. {
  7892. if(action & GMSH_SET) {
  7893. // vertex arrays need to be regenerated only when we color by
  7894. // partition
  7895. if(CTX::instance()->color.mesh.carousel[i] != val &&
  7896. CTX::instance()->mesh.colorCarousel == 3)
  7897. CTX::instance()->mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
  7898. CTX::instance()->color.mesh.carousel[i] = val;
  7899. }
  7900. #if defined(HAVE_FLTK)
  7901. CCC(CTX::instance()->color.mesh.carousel[i], FlGui::instance()->options->mesh.color[11+i]);
  7902. #endif
  7903. return CTX::instance()->color.mesh.carousel[i];
  7904. }
  7905. unsigned int opt_mesh_color_0(OPT_ARGS_COL){ return opt_mesh_color_(0, num, action, val); }
  7906. unsigned int opt_mesh_color_1(OPT_ARGS_COL){ return opt_mesh_color_(1, num, action, val); }
  7907. unsigned int opt_mesh_color_2(OPT_ARGS_COL){ return opt_mesh_color_(2, num, action, val); }
  7908. unsigned int opt_mesh_color_3(OPT_ARGS_COL){ return opt_mesh_color_(3, num, action, val); }
  7909. unsigned int opt_mesh_color_4(OPT_ARGS_COL){ return opt_mesh_color_(4, num, action, val); }
  7910. unsigned int opt_mesh_color_5(OPT_ARGS_COL){ return opt_mesh_color_(5, num, action, val); }
  7911. unsigned int opt_mesh_color_6(OPT_ARGS_COL){ return opt_mesh_color_(6, num, action, val); }
  7912. unsigned int opt_mesh_color_7(OPT_ARGS_COL){ return opt_mesh_color_(7, num, action, val); }
  7913. unsigned int opt_mesh_color_8(OPT_ARGS_COL){ return opt_mesh_color_(8, num, action, val); }
  7914. unsigned int opt_mesh_color_9(OPT_ARGS_COL){ return opt_mesh_color_(9, num, action, val); }
  7915. unsigned int opt_mesh_color_10(OPT_ARGS_COL){ return opt_mesh_color_(10, num, action, val); }
  7916. unsigned int opt_mesh_color_11(OPT_ARGS_COL){ return opt_mesh_color_(11, num, action, val); }
  7917. unsigned int opt_mesh_color_12(OPT_ARGS_COL){ return opt_mesh_color_(12, num, action, val); }
  7918. unsigned int opt_mesh_color_13(OPT_ARGS_COL){ return opt_mesh_color_(13, num, action, val); }
  7919. unsigned int opt_mesh_color_14(OPT_ARGS_COL){ return opt_mesh_color_(14, num, action, val); }
  7920. unsigned int opt_mesh_color_15(OPT_ARGS_COL){ return opt_mesh_color_(15, num, action, val); }
  7921. unsigned int opt_mesh_color_16(OPT_ARGS_COL){ return opt_mesh_color_(16, num, action, val); }
  7922. unsigned int opt_mesh_color_17(OPT_ARGS_COL){ return opt_mesh_color_(17, num, action, val); }
  7923. unsigned int opt_mesh_color_18(OPT_ARGS_COL){ return opt_mesh_color_(18, num, action, val); }
  7924. unsigned int opt_mesh_color_19(OPT_ARGS_COL){ return opt_mesh_color_(19, num, action, val); }
  7925. unsigned int opt_view_color_points(OPT_ARGS_COL)
  7926. {
  7927. #if defined(HAVE_POST)
  7928. GET_VIEWo(0);
  7929. if(action & GMSH_SET) {
  7930. opt->color.point = val;
  7931. if(view) view->setChanged(true);
  7932. }
  7933. #if defined(HAVE_FLTK)
  7934. if(_gui_action_valid(action, num)){
  7935. CCC(opt->color.point, FlGui::instance()->options->view.color[0]);
  7936. }
  7937. #endif
  7938. return opt->color.point;
  7939. #else
  7940. return 0;
  7941. #endif
  7942. }
  7943. unsigned int opt_view_color_lines(OPT_ARGS_COL)
  7944. {
  7945. #if defined(HAVE_POST)
  7946. GET_VIEWo(0);
  7947. if(action & GMSH_SET) {
  7948. opt->color.line = val;
  7949. if(view) view->setChanged(true);
  7950. }
  7951. #if defined(HAVE_FLTK)
  7952. if(_gui_action_valid(action, num)){
  7953. CCC(opt->color.line, FlGui::instance()->options->view.color[1]);
  7954. }
  7955. #endif
  7956. return opt->color.line;
  7957. #else
  7958. return 0;
  7959. #endif
  7960. }
  7961. unsigned int opt_view_color_triangles(OPT_ARGS_COL)
  7962. {
  7963. #if defined(HAVE_POST)
  7964. GET_VIEWo(0);
  7965. if(action & GMSH_SET) {
  7966. opt->color.triangle = val;
  7967. if(view) view->setChanged(true);
  7968. }
  7969. #if defined(HAVE_FLTK)
  7970. if(_gui_action_valid(action, num)){
  7971. CCC(opt->color.triangle, FlGui::instance()->options->view.color[2]);
  7972. }
  7973. #endif
  7974. return opt->color.triangle;
  7975. #else
  7976. return 0;
  7977. #endif
  7978. }
  7979. unsigned int opt_view_color_quadrangles(OPT_ARGS_COL)
  7980. {
  7981. #if defined(HAVE_POST)
  7982. GET_VIEWo(0);
  7983. if(action & GMSH_SET) {
  7984. opt->color.quadrangle = val;
  7985. if(view) view->setChanged(true);
  7986. }
  7987. #if defined(HAVE_FLTK)
  7988. if(_gui_action_valid(action, num)){
  7989. CCC(opt->color.quadrangle, FlGui::instance()->options->view.color[3]);
  7990. }
  7991. #endif
  7992. return opt->color.quadrangle;
  7993. #else
  7994. return 0;
  7995. #endif
  7996. }
  7997. unsigned int opt_view_color_tetrahedra(OPT_ARGS_COL)
  7998. {
  7999. #if defined(HAVE_POST)
  8000. GET_VIEWo(0);
  8001. if(action & GMSH_SET) {
  8002. opt->color.tetrahedron = val;
  8003. if(view) view->setChanged(true);
  8004. }
  8005. #if defined(HAVE_FLTK)
  8006. if(_gui_action_valid(action, num)){
  8007. CCC(opt->color.tetrahedron, FlGui::instance()->options->view.color[4]);
  8008. }
  8009. #endif
  8010. return opt->color.tetrahedron;
  8011. #else
  8012. return 0;
  8013. #endif
  8014. }
  8015. unsigned int opt_view_color_hexahedra(OPT_ARGS_COL)
  8016. {
  8017. #if defined(HAVE_POST)
  8018. GET_VIEWo(0);
  8019. if(action & GMSH_SET) {
  8020. opt->color.hexahedron = val;
  8021. if(view) view->setChanged(true);
  8022. }
  8023. #if defined(HAVE_FLTK)
  8024. if(_gui_action_valid(action, num)){
  8025. CCC(opt->color.hexahedron, FlGui::instance()->options->view.color[5]);
  8026. }
  8027. #endif
  8028. return opt->color.hexahedron;
  8029. #else
  8030. return 0;
  8031. #endif
  8032. }
  8033. unsigned int opt_view_color_prisms(OPT_ARGS_COL)
  8034. {
  8035. #if defined(HAVE_POST)
  8036. GET_VIEWo(0);
  8037. if(action & GMSH_SET) {
  8038. opt->color.prism = val;
  8039. if(view) view->setChanged(true);
  8040. }
  8041. #if defined(HAVE_FLTK)
  8042. if(_gui_action_valid(action, num)){
  8043. CCC(opt->color.prism, FlGui::instance()->options->view.color[6]);
  8044. }
  8045. #endif
  8046. return opt->color.prism;
  8047. #else
  8048. return 0;
  8049. #endif
  8050. }
  8051. unsigned int opt_view_color_pyramids(OPT_ARGS_COL)
  8052. {
  8053. #if defined(HAVE_POST)
  8054. GET_VIEWo(0);
  8055. if(action & GMSH_SET) {
  8056. opt->color.pyramid = val;
  8057. if(view) view->setChanged(true);
  8058. }
  8059. #if defined(HAVE_FLTK)
  8060. if(_gui_action_valid(action, num)){
  8061. CCC(opt->color.pyramid, FlGui::instance()->options->view.color[7]);
  8062. }
  8063. #endif
  8064. return opt->color.pyramid;
  8065. #else
  8066. return 0;
  8067. #endif
  8068. }
  8069. unsigned int opt_view_color_tangents(OPT_ARGS_COL)
  8070. {
  8071. #if defined(HAVE_POST)
  8072. GET_VIEWo(0);
  8073. if(action & GMSH_SET) {
  8074. opt->color.tangents = val;
  8075. if(view) view->setChanged(true);
  8076. }
  8077. #if defined(HAVE_FLTK)
  8078. if(_gui_action_valid(action, num)){
  8079. CCC(opt->color.tangents, FlGui::instance()->options->view.color[8]);
  8080. }
  8081. #endif
  8082. return opt->color.tangents;
  8083. #else
  8084. return 0;
  8085. #endif
  8086. }
  8087. unsigned int opt_view_color_normals(OPT_ARGS_COL)
  8088. {
  8089. #if defined(HAVE_POST)
  8090. GET_VIEWo(0);
  8091. if(action & GMSH_SET) {
  8092. opt->color.normals = val;
  8093. if(view) view->setChanged(true);
  8094. }
  8095. #if defined(HAVE_FLTK)
  8096. if(_gui_action_valid(action, num)){
  8097. CCC(opt->color.normals, FlGui::instance()->options->view.color[9]);
  8098. }
  8099. #endif
  8100. return opt->color.normals;
  8101. #else
  8102. return 0;
  8103. #endif
  8104. }
  8105. unsigned int opt_view_color_text2d(OPT_ARGS_COL)
  8106. {
  8107. #if defined(HAVE_POST)
  8108. GET_VIEWo(0);
  8109. if(action & GMSH_SET) {
  8110. opt->color.text2d = val;
  8111. }
  8112. #if defined(HAVE_FLTK)
  8113. if(_gui_action_valid(action, num)){
  8114. CCC(opt->color.text2d, FlGui::instance()->options->view.color[10]);
  8115. drawContext::global()->resetFontTextures();
  8116. }
  8117. #endif
  8118. return opt->color.text2d;
  8119. #else
  8120. return 0;
  8121. #endif
  8122. }
  8123. unsigned int opt_view_color_text3d(OPT_ARGS_COL)
  8124. {
  8125. #if defined(HAVE_POST)
  8126. GET_VIEWo(0);
  8127. if(action & GMSH_SET) {
  8128. opt->color.text3d = val;
  8129. }
  8130. #if defined(HAVE_FLTK)
  8131. if(_gui_action_valid(action, num)){
  8132. CCC(opt->color.text3d, FlGui::instance()->options->view.color[11]);
  8133. drawContext::global()->resetFontTextures();
  8134. }
  8135. #endif
  8136. return opt->color.text3d;
  8137. #else
  8138. return 0;
  8139. #endif
  8140. }
  8141. unsigned int opt_view_color_axes(OPT_ARGS_COL)
  8142. {
  8143. #if defined(HAVE_POST)
  8144. GET_VIEWo(0);
  8145. if(action & GMSH_SET) {
  8146. opt->color.axes = val;
  8147. }
  8148. #if defined(HAVE_FLTK)
  8149. if(_gui_action_valid(action, num)){
  8150. CCC(opt->color.axes, FlGui::instance()->options->view.color[12]);
  8151. drawContext::global()->resetFontTextures();
  8152. }
  8153. #endif
  8154. return opt->color.axes;
  8155. #else
  8156. return 0;
  8157. #endif
  8158. }
  8159. unsigned int opt_view_color_background2d(OPT_ARGS_COL)
  8160. {
  8161. #if defined(HAVE_POST)
  8162. GET_VIEWo(0);
  8163. if(action & GMSH_SET) {
  8164. opt->color.background2d = val;
  8165. }
  8166. #if defined(HAVE_FLTK)
  8167. if(_gui_action_valid(action, num)){
  8168. CCC(opt->color.background2d, FlGui::instance()->options->view.color[13]);
  8169. drawContext::global()->resetFontTextures();
  8170. }
  8171. #endif
  8172. return opt->color.background2d;
  8173. #else
  8174. return 0;
  8175. #endif
  8176. }