gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
CreateFile.cpp
Go to the documentation of this file.
1 // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 
6 #include "GmshConfig.h"
7 #include "GmshMessage.h"
8 #include "GModel.h"
9 #include "GmshDefines.h"
10 #include "StringUtils.h"
11 #include "Context.h"
12 #include "Options.h"
13 #include "OpenFile.h"
14 #include "CreateFile.h"
15 #include "OS.h"
16 
17 #if defined(HAVE_OPENGL)
18 #include "drawContext.h"
19 #endif
20 
21 #if defined(HAVE_FLTK)
22 #include "FlGui.h"
23 #include "graphicWindow.h"
24 #include "openglWindow.h"
25 #include "gl2ps.h"
26 #include "gl2gif.h"
27 #include "gl2jpeg.h"
28 #include "gl2png.h"
29 #include "gl2ppm.h"
30 #include "gl2yuv.h"
31 #include "gl2pgf.h"
32 #endif
33 
34 int GetFileFormatFromExtension(const std::string &ext, double *version)
35 {
36  if(ext == ".geo_unrolled") return FORMAT_GEO;
37  else if(ext == ".py_unrolled") return FORMAT_PY;
38  else if(ext == ".auto") return FORMAT_AUTO;
39  else if(ext == ".msh") return FORMAT_MSH;
40  else if(ext == ".msh1") { if(version) *version = 1.0; return FORMAT_MSH; }
41  else if(ext == ".msh2") { if(version) *version = 2.2; return FORMAT_MSH; }
42  else if(ext == ".msh22") { if(version) *version = 2.2; return FORMAT_MSH; }
43  else if(ext == ".msh3") { if(version) *version = 3.0; return FORMAT_MSH; }
44  else if(ext == ".msh4") { if(version) *version = 4.1; return FORMAT_MSH; }
45  else if(ext == ".msh40") { if(version) *version = 4.0; return FORMAT_MSH; }
46  else if(ext == ".msh41") { if(version) *version = 4.1; return FORMAT_MSH; }
47  else if(ext == ".x3d") return FORMAT_X3D;
48  else if(ext == ".pos") return FORMAT_POS;
49  else if(ext == ".pvtu") return FORMAT_PVTU;
50  else if(ext == ".opt") return FORMAT_OPT;
51  else if(ext == ".unv") return FORMAT_UNV;
52  else if(ext == ".vtk") return FORMAT_VTK;
53  else if(ext == ".m") return FORMAT_MATLAB;
54  else if(ext == ".dat") return FORMAT_TOCHNOG;
55  else if(ext == ".txt") return FORMAT_TXT;
56  else if(ext == ".stl") return FORMAT_STL;
57  else if(ext == ".cgns") return FORMAT_CGNS;
58  else if(ext == ".med") return FORMAT_MED;
59  else if(ext == ".rmed") return FORMAT_RMED;
60  else if(ext == ".ir3") return FORMAT_IR3;
61  else if(ext == ".mesh") return FORMAT_MESH;
62  else if(ext == ".off") return FORMAT_OFF;
63  else if(ext == ".mail") return FORMAT_MAIL;
64  else if(ext == ".bdf") return FORMAT_BDF;
65  else if(ext == ".diff") return FORMAT_DIFF;
66  else if(ext == ".inp") return FORMAT_INP;
67  else if(ext == ".key") return FORMAT_KEY;
68  else if(ext == ".rad") return FORMAT_RAD;
69  else if(ext == ".celum") return FORMAT_CELUM;
70  else if(ext == ".su2") return FORMAT_SU2;
71  else if(ext == ".nas") return FORMAT_BDF;
72  else if(ext == ".p3d") return FORMAT_P3D;
73  else if(ext == ".wrl") return FORMAT_VRML;
74  else if(ext == ".vrml") return FORMAT_VRML;
75  else if(ext == ".ply2") return FORMAT_PLY2;
76  else if(ext == ".gif") return FORMAT_GIF;
77  else if(ext == ".jpg") return FORMAT_JPEG;
78  else if(ext == ".jpeg") return FORMAT_JPEG;
79  else if(ext == ".mpg") return FORMAT_MPEG;
80  else if(ext == ".mpeg") return FORMAT_MPEG;
81  else if(ext == ".png") return FORMAT_PNG;
82  else if(ext == ".pgf") return FORMAT_PGF;
83  else if(ext == ".ps") return FORMAT_PS;
84  else if(ext == ".eps") return FORMAT_EPS;
85  else if(ext == ".pdf") return FORMAT_PDF;
86  else if(ext == ".tex") return FORMAT_TEX;
87  else if(ext == ".svg") return FORMAT_SVG;
88  else if(ext == ".tikz") return FORMAT_TIKZ;
89  else if(ext == ".ppm") return FORMAT_PPM;
90  else if(ext == ".yuv") return FORMAT_YUV;
91  else if(ext == ".brep") return FORMAT_BREP;
92  else if(ext == ".step") return FORMAT_STEP;
93  else if(ext == ".stp") return FORMAT_STEP;
94  else if(ext == ".iges") return FORMAT_IGES;
95  else if(ext == ".igs") return FORMAT_IGES;
96  else if(ext == ".neu") return FORMAT_NEU;
97  else if(ext == ".xmt_txt") return FORMAT_XMT;
98  else return -1;
99 }
100 
101 int GuessFileFormatFromFileName(const std::string &fileName, double *version)
102 {
103  std::string ext = SplitFileName(fileName)[2];
104  return GetFileFormatFromExtension(ext, version);
105 }
106 
107 std::string GetDefaultFileExtension(int format, bool onlyMeshFormats)
108 {
109  std::string name;
110  bool mesh = false;
111  switch(format){
112  case FORMAT_GEO: name = ".geo_unrolled"; break;
113  case FORMAT_PY: name = ".py_unrolled"; break;
114  case FORMAT_MSH: name = ".msh"; mesh = true; break;
115  case FORMAT_POS: name = ".pos"; break;
116  case FORMAT_X3D: name = ".x3d"; mesh = true; break;
117  case FORMAT_PVTU: name = ".pvtu"; break;
118  case FORMAT_OPT: name = ".opt"; break;
119  case FORMAT_UNV: name = ".unv"; mesh = true; break;
120  case FORMAT_VTK: name = ".vtk"; mesh = true; break;
121  case FORMAT_MATLAB: name = ".m"; mesh = true; break;
122  case FORMAT_TOCHNOG: name = ".dat"; mesh = true; break;
123  case FORMAT_STL: name = ".stl"; mesh = true; break;
124  case FORMAT_CGNS: name = ".cgns"; mesh = true; break;
125  case FORMAT_MED: name = ".med"; mesh = true; break;
126  case FORMAT_RMED: name = ".rmed"; break;
127  case FORMAT_IR3: name = ".ir3"; mesh = true; break;
128  case FORMAT_MESH: name = ".mesh"; mesh = true; break;
129  case FORMAT_OFF: name = ".off"; mesh = true; break;
130  case FORMAT_MAIL: name = ".mail"; mesh = true; break;
131  case FORMAT_BDF: name = ".bdf"; mesh = true; break;
132  case FORMAT_DIFF: name = ".diff"; mesh = true; break;
133  case FORMAT_INP: name = ".inp"; mesh = true; break;
134  case FORMAT_KEY: name = ".key"; mesh = true; break;
135  case FORMAT_RAD: name = ".rad"; mesh = true; break;
136  case FORMAT_CELUM: name = ".celum"; mesh = true; break;
137  case FORMAT_SU2: name = ".su2"; mesh = true; break;
138  case FORMAT_P3D: name = ".p3d"; mesh = true; break;
139  case FORMAT_VRML: name = ".wrl"; mesh = true; break;
140  case FORMAT_PLY2: name = ".ply2"; mesh = true; break;
141  case FORMAT_GIF: name = ".gif"; break;
142  case FORMAT_JPEG: name = ".jpg"; break;
143  case FORMAT_MPEG: name = ".mpg"; break;
144  case FORMAT_PNG: name = ".png"; break;
145  case FORMAT_PGF: name = ".pgf"; break;
146  case FORMAT_PS: name = ".ps"; break;
147  case FORMAT_EPS: name = ".eps"; break;
148  case FORMAT_PDF: name = ".pdf"; break;
149  case FORMAT_TEX: name = ".tex"; break;
150  case FORMAT_SVG: name = ".svg"; break;
151  case FORMAT_TIKZ: name = ".tikz"; break;
152  case FORMAT_PPM: name = ".ppm"; break;
153  case FORMAT_YUV: name = ".yuv"; break;
154  case FORMAT_BREP: name = ".brep"; break;
155  case FORMAT_IGES: name = ".iges"; break;
156  case FORMAT_STEP: name = ".step"; break;
157  case FORMAT_NEU: name = ".neu"; mesh = true; break;
158  case FORMAT_XMT: name = ".xmt_txt"; break;
159  default: name = ""; break;
160  }
161  if(onlyMeshFormats && !mesh) return "";
162  return name;
163 }
164 
165 std::string GetDefaultFileName(int format)
166 {
167  std::vector<std::string> split = SplitFileName(GModel::current()->getFileName());
168  std::string name = split[0] + split[1];
169  std::string ext = GetDefaultFileExtension(format);
170  return name + ext;
171 }
172 
173 std::string GetKnownFileFormats(bool onlyMeshFormats)
174 {
175  std::string all = "auto, msh1, msh2, msh22, msh3, msh4, msh40, msh41";
176  for(int i = 1; i < 1000; i++){
177  std::string ext = GetDefaultFileExtension(i, onlyMeshFormats);
178  if(ext.size() > 1){
179  all += ", " + ext.substr(1);
180  }
181  }
182  return all;
183 }
184 
185 #if defined(HAVE_FLTK)
186 static PixelBuffer *GetCompositePixelBuffer(GLenum format, GLenum type)
187 {
188  openglWindow *newg = nullptr;
189 
190  if(CTX::instance()->print.width > 0 || CTX::instance()->print.height > 0){
191  GLint width = FlGui::instance()->getCurrentOpenglWindow()->pixel_w();
192  GLint height = FlGui::instance()->getCurrentOpenglWindow()->pixel_h();
193  if(CTX::instance()->print.width <= 0){
194  double w = width * CTX::instance()->print.height / (double)height;
195  width = (int)w;
196  height = CTX::instance()->print.height;
197  }
198  else if(CTX::instance()->print.height <= 0){
199  double h = height * CTX::instance()->print.width / (double)width;
200  height = (int)h;
201  width = CTX::instance()->print.width;
202  }
203  else{
204  width = CTX::instance()->print.width;
205  height = CTX::instance()->print.height;
206  }
207  newg = new openglWindow(100, 100, width, height);
208  int mode = FL_RGB | FL_DEPTH | (CTX::instance()->db ? FL_DOUBLE : FL_SINGLE);
209  if(CTX::instance()->antialiasing) mode |= FL_MULTISAMPLE;
210  newg->mode(mode);
211  newg->end();
212  newg->getDrawContext()->copyViewAttributes
213  (FlGui::instance()->getCurrentOpenglWindow()->getDrawContext());
214  newg->show();
215  openglWindow::setLastHandled(newg);
216  // waiting for the OS to really make the window visible and to call the
217  // draw() function on (some ?) linux; if we do not wait here, the window is
218  // not ready and the picture cannot be generated
219  while(!newg->valid()) Fl::wait();
220  }
221 
222  PixelBuffer *buffer;
223  if(newg || !CTX::instance()->print.compositeWindows){
224  GLint width = FlGui::instance()->getCurrentOpenglWindow()->pixel_w();
225  GLint height = FlGui::instance()->getCurrentOpenglWindow()->pixel_h();
226  buffer = new PixelBuffer(width, height, format, type);
227  buffer->fill(CTX::instance()->batch);
228  }
229  else{
230  graphicWindow *g = FlGui::instance()->graph[0];
231  for(std::size_t i = 1; i < FlGui::instance()->graph.size(); i++){
232  for(std::size_t j = 0; j < FlGui::instance()->graph[i]->gl.size(); j++){
233  if(FlGui::instance()->graph[i]->gl[j] ==
234  FlGui::instance()->getCurrentOpenglWindow()){
235  g = FlGui::instance()->graph[i];
236  break;
237  }
238  }
239  }
240  int xmin = 10000000, ymin = 10000000;
241  for(std::size_t i = 0; i < g->gl.size(); i++){
242  xmin = std::min(xmin, g->gl[i]->x());
243  ymin = std::min(ymin, g->gl[i]->y());
244  }
245  int ww = 0, hh = 0;
246  std::vector<PixelBuffer*> buffers;
247  for(std::size_t i = 0; i < g->gl.size(); i++){
248  openglWindow::setLastHandled(g->gl[i]);
249  buffer = new PixelBuffer(g->gl[i]->pixel_w(), g->gl[i]->pixel_h(),
250  format, type);
251  buffer->fill(CTX::instance()->batch);
252  buffers.push_back(buffer);
253  double fact = g->gl[i]->getDrawContext()->highResolutionPixelFactor();
254  ww = std::max(ww, (int)(fact * (g->gl[i]->x() - xmin)) + g->gl[i]->pixel_w());
255  hh = std::max(hh, (int)(fact * (g->gl[i]->y() - ymin)) + g->gl[i]->pixel_h());
256  }
257  buffer = new PixelBuffer(ww, hh, format, type);
258  for(std::size_t i = 0; i < g->gl.size(); i++){
259  double fact = g->gl[i]->getDrawContext()->highResolutionPixelFactor();
260  buffer->copyPixels(fact * (g->gl[i]->x() - xmin),
261  hh - g->gl[i]->pixel_h() - fact * (g->gl[i]->y() - ymin),
262  buffers[i]);
263  delete buffers[i];
264  }
265  }
266 
267  if(newg){
268  openglWindow::setLastHandled(nullptr);
269  newg->hide();
270  delete newg;
271  }
272 
273  return buffer;
274 }
275 #endif
276 
277 static void ChangePrintParameter(int frame)
278 {
279  double first = CTX::instance()->print.parameterFirst;
280  double last = CTX::instance()->print.parameterLast;
281  double steps = CTX::instance()->print.parameterSteps - 1;
282  if(steps <= 0) steps = 1;
283  double step = (last - first) / steps;
284  double v = first + frame * step * CTX::instance()->post.animStep;
285  Msg::Info("Setting Print.Parameter = %g", v);
288 }
289 
290 void CreateOutputFile(const std::string &fileName, int format,
291  bool status)
292 {
293  std::string name = fileName;
294  if(name.empty()) name = GetDefaultFileName(format);
295 
296  int oldFormat = CTX::instance()->print.fileFormat;
297  CTX::instance()->print.fileFormat = format;
298  CTX::instance()->printing = 1;
299  bool error = false;
300 
301  if(status)
302  Msg::StatusBar(true, "Writing '%s'...", name.c_str());
303 
304  switch (format) {
305 
306  case FORMAT_AUTO:
307  {
308  double version = 0.;
309  int format = GuessFileFormatFromFileName(name, &version);
310  if(format == FORMAT_MSH && version > 0.)
311  CTX::instance()->mesh.mshFileVersion = version;
312  CreateOutputFile(name, format, false);
313  }
314  break;
315 
316  case FORMAT_OPT:
317  PrintOptions(0, GMSH_FULLRC, 1, 1, name.c_str());
318  break;
319 
320  case FORMAT_MSH:
321  if(GModel::current()->getNumPartitions() &&
322  CTX::instance()->mesh.partitionSplitMeshFiles){
323  std::vector<std::string> splitName = SplitFileName(name);
324  splitName[0] += splitName[1];
326  (splitName[0], CTX::instance()->mesh.mshFileVersion,
329  }
330  else{
332  (name, CTX::instance()->mesh.mshFileVersion, CTX::instance()->mesh.binary,
335  }
336  if(GModel::current()->getNumPartitions() &&
337  CTX::instance()->mesh.partitionSaveTopologyFile){
338  std::vector<std::string> splitName = SplitFileName(name);
339  splitName[0] += splitName[1] + "_topology.pro";
340  GModel::current()->writePartitionedTopology(splitName[0]);
341  }
342  break;
343 
344  case FORMAT_STL:
346  (name, CTX::instance()->mesh.binary, CTX::instance()->mesh.saveAll,
349  break;
350 
351  case FORMAT_X3D:
353  (name, CTX::instance()->mesh.saveAll,
360  break;
361 
362  case FORMAT_VRML:
364  (name, CTX::instance()->mesh.saveAll, CTX::instance()->mesh.scalingFactor);
365  break;
366 
367  case FORMAT_PLY2:
368  GModel::current()->writePLY2(name);
369  break;
370 
371  case FORMAT_UNV:
373  (name, CTX::instance()->mesh.saveAll,
377  break;
378 
379  case FORMAT_TOCHNOG:
381  (name, CTX::instance()->mesh.saveAll, CTX::instance()->mesh.saveGroupsOfNodes,
383  break;
384 
385  case FORMAT_VTK:
387  (name, CTX::instance()->mesh.binary, CTX::instance()->mesh.saveAll,
390  break;
391 
392  case FORMAT_MATLAB:
394  (name, CTX::instance()->mesh.binary, CTX::instance()->mesh.saveAll,
396  break;
397 
398  case FORMAT_MESH:
400  (name, CTX::instance()->mesh.saveElementTagType,
402  break;
403 
404  case FORMAT_OFF:
406  (name, CTX::instance()->mesh.saveAll, CTX::instance()->mesh.scalingFactor);
407  break;
408 
409  case FORMAT_MAIL:
411  (name, CTX::instance()->mesh.saveAll, CTX::instance()->mesh.scalingFactor);
412  break;
413 
414  case FORMAT_IR3:
416  (name, CTX::instance()->mesh.saveElementTagType,
418  break;
419 
420  case FORMAT_BDF:
422  (name, CTX::instance()->mesh.bdfFieldFormat,
425  break;
426 
427  case FORMAT_DIFF:
429  (name, CTX::instance()->mesh.binary, CTX::instance()->mesh.saveAll,
431  break;
432 
433  case FORMAT_INP:
435  (name, CTX::instance()->mesh.saveAll,
439  break;
440 
441  case FORMAT_KEY:
443  (name, CTX::instance()->mesh.saveAll, CTX::instance()->mesh.saveGroupsOfNodes,
445  break;
446 
447  case FORMAT_RAD:
449  (name, CTX::instance()->mesh.saveAll, CTX::instance()->mesh.saveGroupsOfNodes,
451  break;
452 
453  case FORMAT_CELUM:
455  (name, CTX::instance()->mesh.saveAll, CTX::instance()->mesh.scalingFactor);
456  break;
457 
458  case FORMAT_SU2:
460  (name, CTX::instance()->mesh.saveAll, CTX::instance()->mesh.scalingFactor);
461  break;
462 
463  case FORMAT_P3D:
465  (name, CTX::instance()->mesh.saveAll, CTX::instance()->mesh.scalingFactor);
466  break;
467 
468  case FORMAT_CGNS:
470  (name, CTX::instance()->mesh.saveAll, CTX::instance()->mesh.scalingFactor,
472  break;
473 
474  case FORMAT_MED:
476  (name, CTX::instance()->mesh.saveAll, CTX::instance()->mesh.scalingFactor);
477  break;
478 
479  case FORMAT_POS:
481  (name, CTX::instance()->print.posElementary,
486  break;
487 
488  case FORMAT_GEO:
491  break;
492 
493  case FORMAT_PY:
496  break;
497 
498  case FORMAT_BREP:
499  if(GModel::current()->getOCCInternals())
500  GModel::current()->writeOCCBREP(name);
501  else
502  Msg::Error("No OpenCASCADE CAD data found for BREP export");
503  break;
504 
505  case FORMAT_STEP:
506  if(GModel::current()->getParasolidInternals())
508  else if(GModel::current()->getOCCInternals())
509  GModel::current()->writeOCCSTEP(name);
510  else
511  Msg::Error("No suitable CAD data found for STEP export");
512  break;
513 
514  case FORMAT_NEU:
516  (name, CTX::instance()->mesh.saveAll, CTX::instance()->mesh.scalingFactor);
517  break;
518 
519  case FORMAT_XMT:
520  if(GModel::current()->getParasolidInternals())
522  else
523  Msg::Error("No Parasolid CAD data found for XMT export");
524  break;
525 
526 #if defined(HAVE_FLTK)
527  case FORMAT_PPM:
528  case FORMAT_YUV:
529  case FORMAT_GIF:
530  case FORMAT_JPEG:
531  case FORMAT_PNG:
532  {
533  if(!FlGui::available()){
534  Msg::Error("Creating '%s' requires a graphical interface context", name.c_str());
535  break;
536  }
537 
538  FILE *fp = Fopen(name.c_str(), "wb");
539  if(!fp){
540  Msg::Error("Unable to open file '%s'", name.c_str());
541  error = true;
542  break;
543  }
544 
545  PixelBuffer *buffer = GetCompositePixelBuffer(GL_RGB, GL_UNSIGNED_BYTE);
546 
547  if(format == FORMAT_PPM)
548  create_ppm(fp, buffer);
549  else if(format == FORMAT_YUV)
550  create_yuv(fp, buffer);
551  else if(format == FORMAT_GIF)
552  create_gif(fp, buffer,
553  CTX::instance()->print.gifDither,
557  else if(format == FORMAT_JPEG)
558  create_jpeg(fp, buffer, CTX::instance()->print.jpegQuality,
560  else
561  create_png(fp, buffer, 100);
562 
563  delete buffer;
564  fclose(fp);
566  }
567  break;
568 
569  case FORMAT_PS:
570  case FORMAT_EPS:
571  case FORMAT_PDF:
572  case FORMAT_SVG:
573  case FORMAT_TIKZ:
574  {
575  if(!FlGui::available()){
576  Msg::Error("Creating '%s' requires a graphical interface context", name.c_str());
577  break;
578  }
579 
580  FILE *fp = Fopen(name.c_str(), "wb");
581  if(!fp){
582  Msg::Error("Unable to open file '%s'", name.c_str());
583  error = true;
584  break;
585  }
586  std::string base = SplitFileName(name)[1];
587  GLint width = FlGui::instance()->getCurrentOpenglWindow()->pixel_w();
588  GLint height = FlGui::instance()->getCurrentOpenglWindow()->pixel_h();
589  GLint pixel_viewport[4] = {0, 0, width, height};
590 
591  PixelBuffer buffer(width, height, GL_RGB, GL_FLOAT);
592 
593  if(CTX::instance()->print.epsQuality == 0)
594  buffer.fill(CTX::instance()->batch);
595 
596  int psformat =
597  (format == FORMAT_PDF) ? GL2PS_PDF :
598  (format == FORMAT_PS) ? GL2PS_PS :
599  (format == FORMAT_SVG) ? GL2PS_SVG :
600  (format == FORMAT_TIKZ) ? GL2PS_PGF :
601  GL2PS_EPS;
602  int pssort =
606  int psoptions =
613 
614  GLint buffsize = 0;
615  int res = GL2PS_OVERFLOW;
616  while(res == GL2PS_OVERFLOW) {
617  buffsize += 2048 * 2048;
618  gl2psBeginPage(base.c_str(), "Gmsh", pixel_viewport,
619  psformat, pssort, psoptions, GL_RGBA, 0, nullptr,
620  15, 20, 10, buffsize, fp, base.c_str());
621  if(CTX::instance()->print.epsQuality == 0){
622  double modelview[16], projection[16];
623  glGetDoublev(GL_PROJECTION_MATRIX, projection);
624  glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
625  glMatrixMode(GL_PROJECTION);
626  glLoadIdentity();
627  glOrtho((double)pixel_viewport[0], (double)pixel_viewport[2],
628  (double)pixel_viewport[1], (double)pixel_viewport[3], -1., 1.);
629  glMatrixMode(GL_MODELVIEW);
630  glLoadIdentity();
631  glRasterPos2d(0, 0);
632  gl2psDrawPixels(width, height, 0, 0, GL_RGB, GL_FLOAT, buffer.getPixels());
633  glMatrixMode(GL_PROJECTION);
634  glLoadMatrixd(projection);
635  glMatrixMode(GL_MODELVIEW);
636  glLoadMatrixd(modelview);
637  }
638  else{
640  }
641  res = gl2psEndPage();
642  }
643 
644  fclose(fp);
646  }
647  break;
648 
649  case FORMAT_TEX:
650  {
651  if(!FlGui::available()){
652  Msg::Error("Creating '%s' requires a graphical interface context", name.c_str());
653  break;
654  }
655 
656  FILE *fp = Fopen(name.c_str(), "w");
657  if(!fp){
658  Msg::Error("Unable to open file '%s'", name.c_str());
659  error = true;
660  break;
661  }
662  std::string base = SplitFileName(name)[1];
663  GLint width = FlGui::instance()->getCurrentOpenglWindow()->pixel_w();
664  GLint height = FlGui::instance()->getCurrentOpenglWindow()->pixel_h();
665  GLfloat width_desired_in_mm = CTX::instance()->print.texWidthInMm;
666  GLfloat scaling = 1.;
667  if(width_desired_in_mm > 0) {
668  GLfloat width_desired_in_pt = width_desired_in_mm * 72.27 / 25.4;
669  scaling = width_desired_in_pt / width;
670  }
671  GLint pixel_viewport[4] = {0, 0, width, height};
672  GLint buffsize = 0;
673  int res = GL2PS_OVERFLOW;
674  while(res == GL2PS_OVERFLOW) {
675  buffsize += 2048 * 2048;
676  gl2psBeginPage(base.c_str(), "Gmsh", pixel_viewport,
679  GL2PS_NO_TEX_FONTSIZE, GL_RGBA, 0, nullptr,
680  0, 0, 0, buffsize, fp, base.c_str());
681  gl2psSetTexScaling(scaling);
682  int oldtext = CTX::instance()->print.text;
683  CTX::instance()->print.text = 1;
685  CTX::instance()->print.text = oldtext;
686  res = gl2psEndPage();
687  }
688  fclose(fp);
689  }
690  break;
691 
692  case FORMAT_PGF:
693  {
694  if(!FlGui::available()){
695  Msg::Error("Creating '%s' requires a graphical interface context", name.c_str());
696  break;
697  }
698 
699  // fill pixel buffer without colorbar and axes
700  int restoreGeneralAxis = (int) opt_general_axes(0, GMSH_GET, 0);
701  int restoreSmallAxis = (int) opt_general_small_axes(0, GMSH_GET, 0);
702  opt_general_axes(0, GMSH_SET, 0);
704  int num = -1; // id of the post view
705  int cnt = 0; // no of scales/colorbars active
706  for(std::size_t i = 0; i < opt_post_nb_views(0,GMSH_GET,0); i++) {
707  if(opt_view_visible(i, GMSH_GET, 0)) {
708  if (opt_view_show_scale(i, GMSH_GET, 0)) {
710  num = i; cnt++;
711  }
712  }
713  }
714  PixelBuffer *buffer = GetCompositePixelBuffer(GL_RGB, GL_UNSIGNED_BYTE);
715  drawContext *ctx = FlGui::instance()->getCurrentOpenglWindow()->getDrawContext();
716  GLint width = FlGui::instance()->getCurrentOpenglWindow()->pixel_w();
717  GLint height = FlGui::instance()->getCurrentOpenglWindow()->pixel_h();
718  GLint pixel_viewport[4] = {0, 0, width, height};
719  print_pgf(name, num, cnt, buffer, ctx->r, pixel_viewport, ctx->proj, ctx->model);
720  delete buffer;
721  // restore view
722  if(restoreGeneralAxis) opt_general_axes(0, GMSH_SET| GMSH_GUI, 1);
723  if(restoreSmallAxis) opt_general_small_axes(0, GMSH_SET | GMSH_GUI, 1);
724  if(cnt > 0) opt_view_show_scale(num, GMSH_SET, 1);
726  }
727  break;
728 
729 #if defined(HAVE_MPEG_ENCODE)
730  case FORMAT_MPEG:
731  case FORMAT_MPEG_PREVIEW:
732  {
733  if(!FlGui::available()){
734  Msg::Error("Creating '%s' requires a graphical interface context", name.c_str());
735  break;
736  }
737 
738  std::string parFileName = CTX::instance()->homeDir + ".gmsh-mpeg_encode.par";
739  FILE *fp = nullptr;
740  if(format != FORMAT_MPEG_PREVIEW){
741  fp = Fopen(parFileName.c_str(), "w");
742  if(!fp){
743  Msg::Error("Unable to open file '%s'", parFileName.c_str());
744  error = true;
745  break;
746  }
747  }
748 
749  int numViews = (int)opt_post_nb_views(0, GMSH_GET, 0);
750  int numSteps = 0;
751  int cycle = CTX::instance()->post.animCycle;
752  if(cycle == 0){
753  for(int i = 0; i < numViews; i++){
754  if(opt_view_visible(i, GMSH_GET, 0))
755  numSteps = std::max(numSteps,
757  }
758  }
759  else if(cycle == 1){
760  numSteps = numViews;
761  }
762  else{
763  numSteps = CTX::instance()->print.parameterSteps;
764  }
765 
766  std::vector<std::string> frames;
767  for(int i = 0; i < numSteps; i += CTX::instance()->post.animStep){
768  char tmp[256];
769  sprintf(tmp, ".gmsh-%06d.ppm", (int)frames.size());
770  frames.push_back(tmp);
771  }
772  if(cycle != 2)
773  status_play_manual(!cycle, 0, false);
774  for(std::size_t i = 0; i < frames.size(); i++){
775  if(cycle == 2)
777  if(fp)
778  CreateOutputFile(CTX::instance()->homeDir + frames[i], FORMAT_PPM,
779  false);
780  else{
783  }
784  if(cycle != 2)
785  status_play_manual(!cycle, CTX::instance()->post.animStep, false);
786  }
787  if(fp){
788  int repeat = (int)(CTX::instance()->post.animDelay * 30);
789  if(repeat < 1) repeat = 1;
790  std::string pattern("I");
791  // including P frames would lead to smaller files, but the quality
792  // degradation is perceptible:
793  // for(int i = 1; i < repeat; i++) pattern += "P";
794  fprintf(fp, "PATTERN %s\nBASE_FILE_FORMAT PPM\nGOP_SIZE %d\n"
795  "SLICES_PER_FRAME 1\nPIXEL FULL\nRANGE 10\n"
796  "PSEARCH_ALG EXHAUSTIVE\nBSEARCH_ALG CROSS2\n"
797  "IQSCALE 1\nPQSCALE 1\nBQSCALE 25\nREFERENCE_FRAME DECODED\n"
798  "OUTPUT %s\nINPUT_CONVERT *\nINPUT_DIR %s\nINPUT\n",
799  pattern.c_str(), repeat, name.c_str(),
800  CTX::instance()->homeDir.c_str());
801  for(std::size_t i = 0; i < frames.size(); i++){
802  fprintf(fp, "%s", frames[i].c_str());
803  if(repeat > 1) fprintf(fp, " [1-%d]", repeat);
804  fprintf(fp, "\n");
805  }
806  fprintf(fp, "END_INPUT\n");
807  fclose(fp);
808  extern int mpeg_encode_main(int, char**);
809  char *args[] = {(char*)"gmsh", (char*)parFileName.c_str()};
810  try{
811  mpeg_encode_main(2, args);
812  }
813  catch (const char *msg){
814  Msg::Error("%s", msg);
815  error = true;
816  }
818  UnlinkFile(parFileName);
819  for(std::size_t i = 0; i < frames.size(); i++)
820  UnlinkFile(CTX::instance()->homeDir + frames[i]);
821  }
822  }
823  }
824  break;
825 #endif
826 
827 #endif
828 
829  default:
830  Msg::Error("Unknown output file format");
831  error = true;
832  break;
833  }
834 
835  CTX::instance()->print.fileFormat = oldFormat;
836  CTX::instance()->printing = 0;
837 
838  if(status && !error)
839  Msg::StatusBar(true, "Done writing '%s'", name.c_str());
840 }
gl2ps.h
GetKnownFileFormats
std::string GetKnownFileFormats(bool onlyMeshFormats)
Definition: CreateFile.cpp:173
CreateFile.h
GL2PS_NONE
#define GL2PS_NONE
Definition: gl2ps.h:127
GModel::writeCGNS
int writeCGNS(const std::string &name, bool saveAll=false, double scalingFactor=1.0, bool structured=false)
Definition: GModelIO_CGNS.cpp:252
SplitFileName
std::vector< std::string > SplitFileName(const std::string &fileName)
Definition: StringUtils.cpp:93
CTX::epsOcclusionCulling
int epsOcclusionCulling
Definition: Context.h:340
GModel::writeMAIL
int writeMAIL(const std::string &name, bool saveAll, double scalingFactor)
Definition: GModelIO_MAIL.cpp:10
CTX::db
int db
Definition: Context.h:236
opt_view_show_scale
double opt_view_show_scale(OPT_ARGS_NUM)
Definition: Options.cpp:8238
GModel::writePartitionedTopology
int writePartitionedTopology(std::string &name)
Definition: GModelIO_MSH4.cpp:2991
GL2PS_PGF
#define GL2PS_PGF
Definition: gl2ps.h:107
GMSH_GET
#define GMSH_GET
Definition: Options.h:13
GMSH_SET
#define GMSH_SET
Definition: Options.h:12
gl2psSetTexScaling
GL2PSDLL_API GLint gl2psSetTexScaling(GLfloat scaling)
Definition: gl2ps.cpp:6661
GuessFileFormatFromFileName
int GuessFileFormatFromFileName(const std::string &fileName, double *version)
Definition: CreateFile.cpp:101
FORMAT_PGF
#define FORMAT_PGF
Definition: GmshDefines.h:50
GModel::writeVRML
int writeVRML(const std::string &name, bool saveAll=false, double scalingFactor=1.0)
Definition: GModelIO_VRML.cpp:191
gl2png.h
FORMAT_VTK
#define FORMAT_VTK
Definition: GmshDefines.h:22
FORMAT_SU2
#define FORMAT_SU2
Definition: GmshDefines.h:48
CTX::epsQuality
int epsQuality
Definition: Context.h:339
CTX::x3dVertices
int x3dVertices
Definition: Context.h:354
GModel::writeNEU
int writeNEU(const std::string &name, bool saveAll, double scalingFactor)
Definition: GModelIO_NEU.cpp:121
GModel::writeKEY
int writeKEY(const std::string &name, int saveAll=0, int saveGroupsOfNodes=0, double scalingFactor=1.0)
Definition: GModelIO_KEY.cpp:53
CTX::gifDither
int gifDither
Definition: Context.h:345
CTX::homeDir
std::string homeDir
Definition: Context.h:147
GModel::writeGEO
int writeGEO(const std::string &name, bool printLabels=true, bool onlyPhysicals=false)
Definition: GModelIO_GEO.cpp:1802
GetDefaultFileExtension
std::string GetDefaultFileExtension(int format, bool onlyMeshFormats)
Definition: CreateFile.cpp:107
Msg::Info
static void Info(const char *fmt,...)
Definition: GmshMessage.cpp:587
GModel::writeOFF
int writeOFF(const std::string &name, bool saveAll=false, double scalingFactor=1.0)
Definition: GModelIO_OFF.cpp:83
CTX::fileFormat
int fileFormat
Definition: Context.h:319
OS.h
contextMeshOptions::stlOneSolidPerSurface
int stlOneSolidPerSurface
Definition: Context.h:63
gl2psDrawPixels
GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height, GLint xorig, GLint yorig, GLenum format, GLenum type, const void *pixels)
Definition: gl2ps.cpp:6337
FORMAT_PPM
#define FORMAT_PPM
Definition: GmshDefines.h:19
opt_general_small_axes
double opt_general_small_axes(OPT_ARGS_NUM)
Definition: Options.cpp:3268
CTX::epsBestRoot
int epsBestRoot
Definition: Context.h:340
GModel::writeP3D
int writeP3D(const std::string &name, bool saveAll=false, double scalingFactor=1.0)
Definition: GModelIO_P3D.cpp:123
contextMeshOptions::saveGroupsOfElements
int saveGroupsOfElements
Definition: Context.h:60
CreateOutputFile
void CreateOutputFile(const std::string &fileName, int format, bool status)
Definition: CreateFile.cpp:290
CTX::parameterLast
double parameterLast
Definition: Context.h:349
Msg::Error
static void Error(const char *fmt,...)
Definition: GmshMessage.cpp:482
CTX::post
struct CTX::@0 post
Msg::StatusBar
static void StatusBar(bool log, const char *fmt,...)
Definition: GmshMessage.cpp:686
FORMAT_OFF
#define FORMAT_OFF
Definition: GmshDefines.h:59
ChangePrintParameter
static void ChangePrintParameter(int frame)
Definition: CreateFile.cpp:277
CTX::jpegSmoothing
int jpegSmoothing
Definition: Context.h:342
GModel::writeRAD
int writeRAD(const std::string &name, int saveAll=0, int saveGroupsOfNodes=0, double scalingFactor=1.0)
Definition: GModelIO_RAD.cpp:54
projection
static double projection(SPoint3 &p1, SPoint3 &p2, SPoint3 &q, SPoint3 &result)
Definition: hausdorffDistance.cpp:29
FORMAT_VRML
#define FORMAT_VRML
Definition: GmshDefines.h:25
drawContextGlobal::drawCurrentOpenglWindow
virtual void drawCurrentOpenglWindow(bool make_current)
Definition: drawContext.h:98
GModel::writeCELUM
int writeCELUM(const std::string &name, bool saveAll=false, double scalingFactor=1.0)
Definition: GModelIO_CELUM.cpp:17
GL2PS_EPS
#define GL2PS_EPS
Definition: gl2ps.h:103
print_pgf
int print_pgf(const std::string &name, const int num, const int cnt, PixelBuffer *buffer, double *eulerAngles, int *viewport, double *proj, double *model)
Definition: gl2pgf.cpp:567
gl2jpeg.h
FORMAT_STL
#define FORMAT_STL
Definition: GmshDefines.h:33
CTX::text
int text
Definition: Context.h:343
GModel::writeX3D
int writeX3D(const std::string &name, bool saveAll=false, double scalingFactor=1.0, int x3dsurfaces=1, int x3dedges=0, int x3dvertices=0, int x3dvolumes=0, int x3dcolorize=0)
Definition: GModelIO_X3D.cpp:472
CTX::printing
int printing
Definition: Context.h:304
GmshMessage.h
drawContext::model
double model[16]
Definition: drawContext.h:142
UnlinkFile
int UnlinkFile(const std::string &fileName)
Definition: OS.cpp:479
CTX::x3dColorize
int x3dColorize
Definition: Context.h:354
GL2PS_NO_TEX_FONTSIZE
#define GL2PS_NO_TEX_FONTSIZE
Definition: gl2ps.h:142
FORMAT_MPEG_PREVIEW
#define FORMAT_MPEG_PREVIEW
Definition: GmshDefines.h:49
GL2PS_TEX
#define GL2PS_TEX
Definition: gl2ps.h:104
GModel::writePLY2
int writePLY2(const std::string &name)
Definition: GModelIO_PLY.cpp:282
FORMAT_PS
#define FORMAT_PS
Definition: GmshDefines.h:13
GL2PS_DRAW_BACKGROUND
#define GL2PS_DRAW_BACKGROUND
Definition: gl2ps.h:128
FORMAT_IGES
#define FORMAT_IGES
Definition: GmshDefines.h:43
gl2gif.h
drawContext::global
static drawContextGlobal * global()
Definition: drawContext.cpp:85
FORMAT_PNG
#define FORMAT_PNG
Definition: GmshDefines.h:28
CTX::x3dSurfaces
int x3dSurfaces
Definition: Context.h:354
CTX::posSIGE
int posSIGE
Definition: Context.h:346
Fopen
FILE * Fopen(const char *f, const char *mode)
Definition: OS.cpp:273
GetDefaultFileName
std::string GetDefaultFileName(int format)
Definition: CreateFile.cpp:165
contextMeshOptions::scalingFactor
double scalingFactor
Definition: Context.h:58
GModel::writeDIFF
int writeDIFF(const std::string &name, bool binary=false, bool saveAll=false, double scalingFactor=1.0)
Definition: GModelIO_DIFF.cpp:407
opt_post_nb_views
double opt_post_nb_views(OPT_ARGS_NUM)
Definition: Options.cpp:6902
CTX::animStep
int animStep
Definition: Context.h:317
drawContextGlobal::draw
virtual void draw(bool rateLimited=true)
Definition: drawContext.h:97
FORMAT_YUV
#define FORMAT_YUV
Definition: GmshDefines.h:20
FORMAT_X3D
#define FORMAT_X3D
Definition: GmshDefines.h:52
ParseString
void ParseString(const std::string &str, bool inCurrentModelDir)
Definition: OpenFile.cpp:259
GModel::writePY
int writePY(const std::string &name, bool printLabels=true, bool onlyPhysicals=false)
Definition: GModelIO_GEO.cpp:1863
FORMAT_PDF
#define FORMAT_PDF
Definition: GmshDefines.h:30
GModel::writeSTL
int writeSTL(const std::string &name, bool binary=false, bool saveAll=false, double scalingFactor=1.0, int oneSolidPerSurface=0)
Definition: GModelIO_STL.cpp:308
CTX::instance
static CTX * instance()
Definition: Context.cpp:122
CTX::posElementary
int posElementary
Definition: Context.h:346
PrintOptions
void PrintOptions(int num, int level, int diff, int help, const char *filename, std::vector< std::string > *vec)
Definition: Options.cpp:636
create_png
void create_png(FILE *file, PixelBuffer *buffer, int quality)
Definition: gl2png.cpp:11
contextMeshOptions::saveParametric
int saveParametric
Definition: Context.h:66
GL2PS_NO_SORT
#define GL2PS_NO_SORT
Definition: gl2ps.h:111
FORMAT_BDF
#define FORMAT_BDF
Definition: GmshDefines.h:37
opt_print_delete_tmp_files
double opt_print_delete_tmp_files(OPT_ARGS_NUM)
Definition: Options.cpp:9373
FORMAT_MATLAB
#define FORMAT_MATLAB
Definition: GmshDefines.h:56
contextMeshOptions::cgnsExportStructured
int cgnsExportStructured
Definition: Context.h:69
PixelBuffer::fill
void fill(int offscreen)
Definition: PixelBuffer.h:95
CTX::posDisto
int posDisto
Definition: Context.h:346
PixelBuffer::getPixels
void * getPixels()
Definition: PixelBuffer.h:76
FORMAT_DIFF
#define FORMAT_DIFF
Definition: GmshDefines.h:40
CTX::posGamma
int posGamma
Definition: Context.h:346
FORMAT_CELUM
#define FORMAT_CELUM
Definition: GmshDefines.h:47
FORMAT_SVG
#define FORMAT_SVG
Definition: GmshDefines.h:35
FORMAT_MSH
#define FORMAT_MSH
Definition: GmshDefines.h:10
gl2psBeginPage
GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer, GLint viewport[4], GLint format, GLint sort, GLint options, GLint colormode, GLint colorsize, GL2PSrgba *colormap, GLint nr, GLint ng, GLint nb, GLint buffersize, FILE *stream, const char *filename)
Definition: gl2ps.cpp:6027
CTX::posElement
int posElement
Definition: Context.h:346
FORMAT_STEP
#define FORMAT_STEP
Definition: GmshDefines.h:42
GL2PS_SVG
#define GL2PS_SVG
Definition: gl2ps.h:106
GModel::writeTOCHNOG
int writeTOCHNOG(const std::string &name, bool saveAll=false, int saveGroupsOfNodes=0, double scalingFactor=1.0)
Definition: GModelIO_TOCHNOG.cpp:54
GMSH_FULLRC
#define GMSH_FULLRC
Definition: Options.h:20
GL2PS_COMPRESS
#define GL2PS_COMPRESS
Definition: gl2ps.h:138
CTX::geoLabels
int geoLabels
Definition: Context.h:342
GL2PS_OVERFLOW
#define GL2PS_OVERFLOW
Definition: gl2ps.h:122
drawContext::r
double r[3]
Definition: drawContext.h:134
GL2PS_SILENT
#define GL2PS_SILENT
Definition: gl2ps.h:130
CTX::texForceFontSize
int texForceFontSize
Definition: Context.h:343
gl2psEndPage
GL2PSDLL_API GLint gl2psEndPage(void)
Definition: gl2ps.cpp:6221
GMSH_GUI
#define GMSH_GUI
Definition: Options.h:14
CTX::epsPS3Shading
int epsPS3Shading
Definition: Context.h:339
CTX::binary
int binary
Definition: Context.h:316
FORMAT_TXT
#define FORMAT_TXT
Definition: GmshDefines.h:29
GmshDefines.h
FORMAT_MED
#define FORMAT_MED
Definition: GmshDefines.h:39
create_yuv
void create_yuv(FILE *outfile, PixelBuffer *buffer)
Definition: gl2yuv.cpp:35
FORMAT_XMT
#define FORMAT_XMT
Definition: GmshDefines.h:58
FORMAT_MAIL
#define FORMAT_MAIL
Definition: GmshDefines.h:27
drawContext
Definition: drawContext.h:120
GModel::writeOCCBREP
int writeOCCBREP(const std::string &name)
Definition: GModelIO_OCC.cpp:5920
CTX::mesh
contextMeshOptions mesh
Definition: Context.h:313
CTX::gifInterlace
int gifInterlace
Definition: Context.h:345
FORMAT_TIKZ
#define FORMAT_TIKZ
Definition: GmshDefines.h:54
CTX::animDelay
double animDelay
Definition: Context.h:321
CTX::texWidthInMm
double texWidthInMm
Definition: Context.h:344
CTX::x3dEdges
int x3dEdges
Definition: Context.h:354
CTX::posSICN
int posSICN
Definition: Context.h:346
GModel::writeUNV
int writeUNV(const std::string &name, bool saveAll=false, int saveGroupsOfElements=0, int saveGroupsOfNodes=0, double scalingFactor=1.0)
Definition: GModelIO_UNV.cpp:398
FORMAT_PLY2
#define FORMAT_PLY2
Definition: GmshDefines.h:46
GL2PS_BEST_ROOT
#define GL2PS_BEST_ROOT
Definition: gl2ps.h:131
FORMAT_JPEG
#define FORMAT_JPEG
Definition: GmshDefines.h:17
CTX::gifTransparent
int gifTransparent
Definition: Context.h:345
FORMAT_INP
#define FORMAT_INP
Definition: GmshDefines.h:45
GModel::writePOS
int writePOS(const std::string &name, bool printElementary, bool printElementNumber, bool printSICN, bool printSIGE, bool printGamma, bool printDisto, bool saveAll=false, double scalingFactor=1.0)
Definition: GModelIO_POS.cpp:11
gl2ppm.h
FORMAT_MESH
#define FORMAT_MESH
Definition: GmshDefines.h:36
FORMAT_BREP
#define FORMAT_BREP
Definition: GmshDefines.h:41
FORMAT_RMED
#define FORMAT_RMED
Definition: GmshDefines.h:31
GModel::writeINP
int writeINP(const std::string &name, bool saveAll=false, int saveGroupsOfElements=0, int saveGroupsOfNodes=0, double scalingFactor=1.0)
Definition: GModelIO_INP.cpp:53
CTX::print
struct CTX::@2 print
FORMAT_CGNS
#define FORMAT_CGNS
Definition: GmshDefines.h:38
create_ppm
void create_ppm(FILE *outfile, PixelBuffer *buffer)
Definition: gl2ppm.cpp:8
StringUtils.h
GModel::writeMSH
int writeMSH(const std::string &name, double version=2.2, bool binary=false, bool saveAll=false, bool saveParametric=false, double scalingFactor=1.0, int elementStartNum=0, int saveSinglePartition=0, bool append=false)
Definition: GModelIO_MSH.cpp:76
GModel::writeParasolidXMT
int writeParasolidXMT(const std::string &name)
Definition: GModel.cpp:3630
FORMAT_EPS
#define FORMAT_EPS
Definition: GmshDefines.h:26
contextMeshOptions::mshFileVersion
double mshFileVersion
Definition: Context.h:58
CTX::width
int width
Definition: Context.h:348
GModel::writeSU2
int writeSU2(const std::string &name, bool saveAll, double scalingFactor)
Definition: GModelIO_SU2.cpp:29
opt_view_nb_non_empty_timestep
double opt_view_nb_non_empty_timestep(OPT_ARGS_NUM)
Definition: Options.cpp:6979
CTX::height
int height
Definition: Context.h:348
CTX::bigEndian
int bigEndian
Definition: Context.h:373
FORMAT_P3D
#define FORMAT_P3D
Definition: GmshDefines.h:34
Context.h
FORMAT_IR3
#define FORMAT_IR3
Definition: GmshDefines.h:44
CTX::gifSort
int gifSort
Definition: Context.h:345
CTX::x3dVolumes
int x3dVolumes
Definition: Context.h:354
FORMAT_MPEG
#define FORMAT_MPEG
Definition: GmshDefines.h:23
FORMAT_TEX
#define FORMAT_TEX
Definition: GmshDefines.h:24
drawContext::proj
double proj[16]
Definition: drawContext.h:143
GModel::writeParasolidSTEP
int writeParasolidSTEP(const std::string &name)
Definition: GModel.cpp:3644
CTX::parameterFirst
double parameterFirst
Definition: Context.h:349
GModel::writeMESH
int writeMESH(const std::string &name, int elementTagType=1, bool saveAll=false, double scalingFactor=1.0)
Definition: GModelIO_MESH.cpp:249
GetFileFormatFromExtension
int GetFileFormatFromExtension(const std::string &ext, double *version)
Definition: CreateFile.cpp:34
GModel::writeMATLAB
int writeMATLAB(const std::string &name, bool binary=false, bool saveAll=false, double scalingFactor=1.0, int filetype=1)
Definition: GModelIO_MATLAB.cpp:47
CTX::jpegQuality
int jpegQuality
Definition: Context.h:342
GL2PS_SIMPLE_SORT
#define GL2PS_SIMPLE_SORT
Definition: gl2ps.h:112
contextMeshOptions::binary
int binary
Definition: Context.h:62
FORMAT_AUTO
#define FORMAT_AUTO
Definition: GmshDefines.h:18
CTX::antialiasing
int antialiasing
Definition: Context.h:236
FORMAT_KEY
#define FORMAT_KEY
Definition: GmshDefines.h:57
create_gif
void create_gif(FILE *outfile, PixelBuffer *buffer, int dither, int sort, int interlace, int transparency)
Definition: gl2gif.cpp:1110
create_jpeg
void create_jpeg(FILE *outfile, PixelBuffer *buffer, int quality, int smoothing)
Definition: gl2jpeg.cpp:12
CTX::epsCompress
int epsCompress
Definition: Context.h:339
FORMAT_POS
#define FORMAT_POS
Definition: GmshDefines.h:32
contextMeshOptions::saveElementTagType
int saveElementTagType
Definition: Context.h:67
GL2PS_BSP_SORT
#define GL2PS_BSP_SORT
Definition: gl2ps.h:113
GModel::writeVTK
int writeVTK(const std::string &name, bool binary=false, bool saveAll=false, double scalingFactor=1.0, bool bigEndian=false)
Definition: GModelIO_VTK.cpp:19
GL2PS_PS
#define GL2PS_PS
Definition: gl2ps.h:102
PixelBuffer
Definition: PixelBuffer.h:32
Options.h
FORMAT_UNV
#define FORMAT_UNV
Definition: GmshDefines.h:11
gl2yuv.h
FORMAT_NEU
#define FORMAT_NEU
Definition: GmshDefines.h:55
GModel.h
FORMAT_OPT
#define FORMAT_OPT
Definition: GmshDefines.h:21
PixelBuffer::copyPixels
void copyPixels(int x, int y, PixelBuffer *buffer)
Definition: PixelBuffer.h:77
GL2PS_PDF
#define GL2PS_PDF
Definition: gl2ps.h:105
contextMeshOptions::saveGroupsOfNodes
int saveGroupsOfNodes
Definition: Context.h:60
SleepInSeconds
void SleepInSeconds(double s)
Definition: OS.cpp:315
FORMAT_GEO
#define FORMAT_GEO
Definition: GmshDefines.h:16
CTX::compositeWindows
int compositeWindows
Definition: Context.h:347
GModel::writeMED
int writeMED(const std::string &name, bool saveAll=false, double scalingFactor=1.0)
Definition: GModelIO_MED.cpp:893
CTX::parameterSteps
double parameterSteps
Definition: Context.h:349
GL2PS_NO_PS3_SHADING
#define GL2PS_NO_PS3_SHADING
Definition: gl2ps.h:135
CTX::parameterCommand
std::string parameterCommand
Definition: Context.h:351
opt_general_axes
double opt_general_axes(OPT_ARGS_NUM)
Definition: Options.cpp:3087
GModel::writeBDF
int writeBDF(const std::string &name, int format=0, int elementTagType=1, bool saveAll=false, double scalingFactor=1.0)
Definition: GModelIO_BDF.cpp:347
CTX::animCycle
int animCycle
Definition: Context.h:317
opt_view_visible
double opt_view_visible(OPT_ARGS_NUM)
Definition: Options.cpp:7634
FORMAT_GIF
#define FORMAT_GIF
Definition: GmshDefines.h:15
FORMAT_RAD
#define FORMAT_RAD
Definition: GmshDefines.h:61
GL2PS_OCCLUSION_CULL
#define GL2PS_OCCLUSION_CULL
Definition: gl2ps.h:132
opt_print_parameter
double opt_print_parameter(OPT_ARGS_NUM)
Definition: Options.cpp:9391
OpenFile.h
GL2PS_SIMPLE_LINE_OFFSET
#define GL2PS_SIMPLE_LINE_OFFSET
Definition: gl2ps.h:129
CTX::geoOnlyPhysicals
int geoOnlyPhysicals
Definition: Context.h:342
GModel::current
static GModel * current(int index=-1)
Definition: GModel.cpp:136
FORMAT_PY
#define FORMAT_PY
Definition: GmshDefines.h:60
CTX::background
int background
Definition: Context.h:347
FORMAT_PVTU
#define FORMAT_PVTU
Definition: GmshDefines.h:51
gl2pgf.h
GModel::writeOCCSTEP
int writeOCCSTEP(const std::string &name)
Definition: GModelIO_OCC.cpp:5931
contextMeshOptions::saveAll
int saveAll
Definition: Context.h:60
GModel::writeIR3
int writeIR3(const std::string &name, int elementTagType, bool saveAll, double scalingFactor)
Definition: GModelIO_IR3.cpp:10
GModel::writePartitionedMSH
int writePartitionedMSH(const std::string &baseName, double version=2.2, bool binary=false, bool saveAll=false, bool saveParametric=false, double scalingFactor=1.0)
Definition: GModelIO_MSH.cpp:104
FORMAT_TOCHNOG
#define FORMAT_TOCHNOG
Definition: GmshDefines.h:53
drawContext.h