gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
GModelIO_X3D.cpp
Go to the documentation of this file.
1 // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle and Jeremy Theler
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 // Contributed by Jeremy Theler
7 
8 #include <stdio.h>
9 #include <string>
10 #include <algorithm>
11 #include <sstream>
12 #include "GModel.h"
13 #include "OS.h"
14 #include "MLine.h"
15 #include "MTriangle.h"
16 #include "MQuadrangle.h"
17 #include "MVertexRTree.h"
18 #include "discreteFace.h"
19 #include "StringUtils.h"
20 #include "Context.h"
21 
22 static void writeX3dHeader(FILE *fp, std::vector<std::string> &metadata)
23 {
24  // X3D Header
25  fprintf(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
26  fprintf(fp, "<!DOCTYPE X3D PUBLIC \"ISO//Web3D//DTD X3D 3.3//EN\" "
27  "\"http://www.web3d.org/specifications/x3d-3.3.dtd\">\n");
28  fprintf(fp, "<X3D profile='Interchange' version='3.3' "
29  "xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' >\n");
30  fprintf(fp, " <head>\n");
31  fprintf(fp, " <meta name='creator' content='gmsh'/> \n");
32  for(auto it = metadata.begin(); it != metadata.end(); ++it) {
33  fprintf(fp, " <meta name='metadata_%s' content='%s'/> \n",
34  std::to_string(std::distance(metadata.begin(), it)).c_str(),
35  (*it).c_str());
36  }
37  fprintf(fp, " </head>\n");
38  fprintf(fp, " <Scene>\n");
39 }
40 
41 static void writeX3dTrailer(FILE *fp)
42 {
43  fprintf(fp, " </Scene>\n");
44  fprintf(fp, "</X3D>\n");
45 }
46 
47 static void writeHTMLHeader(FILE *fp)
48 {
49  fprintf(fp, "<!DOCTYPE HTML\n>");
50  fprintf(fp, "<html lang=\"en\"> \n");
51  fprintf(fp, "<head>\n");
52  fprintf(fp, " <title> gmsh x3d render</title>\n");
53  fprintf(fp, " <meta charset=\"utf-8\">\n");
54  fprintf(fp, " <link rel=\"stylesheet\" type=\"text/css\" "
55  "href=\"https://x3dom.org/release/x3dom.css\">\n");
56  fprintf(fp,
57  " <script src=\"https://x3dom.org/release/x3dom.js\"></script>\n");
58  fprintf(fp, " <style>\n");
59  fprintf(fp, " body {\n");
60  fprintf(fp, " background: #ced7de;\n");
61  fprintf(fp, " margin: 0px;\n");
62  fprintf(fp, " overflow: hidden;\n");
63  fprintf(fp, " }\n");
64  fprintf(fp, " a {\n");
65  fprintf(fp, " color: #f7941e;\n");
66  fprintf(fp, " text-decoration: none;\n");
67  fprintf(fp, " }\n");
68  fprintf(fp, " a:hover {\n");
69  fprintf(fp, " color: #ffffff;\n");
70  fprintf(fp, " }\n");
71  fprintf(fp, " </style>\n");
72  fprintf(fp, "</head>\n");
73 }
74 
75 static void writeHTMLBody(FILE *fp, std::vector<std::string> &x3dfiles)
76 {
77  fprintf(fp, "<body>\n");
78  fprintf(fp, " <x3d id=\"gmsh-scene\" style=\"width: 100%%; height: "
79  "100%%;border: none\" >\n");
80  fprintf(fp, " <Scene>\n");
81  fprintf(fp, " <transform scale=\"1,1,1\">\n");
82  fprintf(
83  fp,
84  " <transform id=\"plane_axis\" rotation=\"1 0 0 -1.57079632679\">\n");
85  fprintf(
86  fp,
87  " <inline "
88  "url=\"https://rawcdn.githack.com/x3dom/component-editor/master/static/x3d/"
89  "plane.x3d\" mapDEFToID=\"true\" namespaceName=\"plane\"></inline>\n");
90  fprintf(fp, " <inline "
91  "url=\"https://rawcdn.githack.com/x3dom/component-editor/master/"
92  "static/x3d/axesSmall.x3d\" mapDEFToID=\"true\" "
93  "namespaceName=\"axesSmall\"></inline>\n");
94  fprintf(fp, " </transform>\n");
95  fprintf(
96  fp,
97  " <inline "
98  "url=\"https://rawcdn.githack.com/x3dom/component-editor/master/static/x3d/"
99  "axes.x3d\" mapDEFToID=\"true\" namespaceName=\"axes\"></inline>\n");
100  fprintf(fp, " </transform>\n");
101  fprintf(
102  fp,
103  " <transform id=\"components\" rotation=\"1 0 0 -1.57079632679\">\n");
104  for(auto it = x3dfiles.begin(); it != x3dfiles.end(); ++it) {
105  // drop path on x3d since it will be in the same folder as html
106  std::vector<std::string> split = SplitFileName(*it);
107  std::string x3dname = split[1] + split[2];
108  fprintf(
109  fp,
110  " <inline onload=\"fit()\" mapDEFToID=\"true\" url=%s></inline>\n",
111  x3dname.c_str());
112  }
113  fprintf(fp, " </transform>\n");
114  fprintf(fp, " </Scene>\n");
115  fprintf(fp, " </x3d>\n");
116  fprintf(fp, " <script>\n");
117  fprintf(fp, " function fit()\n");
118  fprintf(fp, " {\n");
119  fprintf(fp, " var x3dElem = document.getElementById('gmsh-scene');\n");
120  fprintf(fp, " x3dElem.runtime.fitAll();\n");
121  fprintf(fp, " }\n");
122  fprintf(fp, " </script>\n");
123  fprintf(fp, "</body>\n");
124  fprintf(fp, "</html>\n");
125 }
126 
127 static void writeX3dFaces(FILE *fp, std::vector<GFace *> &faces,
128  bool useIndexedSet, double scalingFactor,
129  const std::string &name, bool useColor,
130  std::vector<unsigned int> &colors)
131 {
132  bool useGeoSTL = false;
133  unsigned int nfacets = 0;
134  for(auto it = faces.begin(); it != faces.end(); ++it) {
135  nfacets += (*it)->triangles.size() + 2 * (*it)->quadrangles.size();
136  }
137 
138  if(!nfacets) { // use CAD STL if there is no mesh
139  useGeoSTL = true;
140  for(auto it = faces.begin(); it != faces.end(); ++it) {
141  (*it)->buildSTLTriangulation();
142  nfacets += (*it)->stl_triangles.size() / 3;
143  }
144  }
145 
146  if(!useColor) {
147  fprintf(fp, " <Shape DEF=\"%s\">\n", name.c_str());
148  fprintf(
149  fp, " <Appearance><Material DEF=\"mat%s\"></Material></Appearance>\n",
150  name.c_str());
151  }
152  else {
153  if(colors.size() == 1) {
154  unsigned int cvalue = colors[0];
155  float r = static_cast<float>(CTX::instance()->unpackRed(cvalue)) / 255.0;
156  float g =
157  static_cast<float>(CTX::instance()->unpackGreen(cvalue)) / 255.0;
158  float b = static_cast<float>(CTX::instance()->unpackBlue(cvalue)) / 255.0;
159  fprintf(fp, " <Shape DEF=\"%s\">\n", name.c_str());
160  fprintf(fp,
161  " <Appearance><Material DEF=\"mat%s\" diffuseColor=\"%s %s "
162  "%s\" shininess=\"0.9\" specularColor=\"0.2 0.2 0.2\" "
163  "transparency=\"0\"></Material></Appearance>\n",
164  name.c_str(), std::to_string(r).c_str(),
165  std::to_string(g).c_str(), std::to_string(b).c_str());
166  }
167  else {
168  Msg::Error("Error in x3d coloring");
169  }
170  }
171 
172  if(useGeoSTL) {
173  if(useIndexedSet) {
174  // create faces with a list of nodes and a set of integers (no
175  // floating-point data will be duplicated)
176  fprintf(fp, " <IndexedTriangleSet DEF=\"set%s\" index=\"\n",
177  name.c_str());
178  for(auto it = faces.begin(); it != faces.end(); ++it) {
179  if((*it)->stl_triangles.size()) {
180  for(std::size_t i = 0; i < (*it)->stl_triangles.size(); i++) {
181  fprintf(fp, "%d ", (*it)->stl_triangles[i]);
182  }
183  fprintf(fp, "\n");
184  }
185  }
186  fprintf(fp, "\">\n");
187 
188  fprintf(fp, " <Coordinate point=\"\n");
189  for(auto it = faces.begin(); it != faces.end(); ++it) {
190  if((*it)->stl_vertices_uv.size()) {
191  for(std::size_t i = 0; i < (*it)->stl_vertices_uv.size(); i++) {
192  SPoint2 &p((*it)->stl_vertices_uv[i]);
193  GPoint gp = (*it)->point(p);
194 
195  fprintf(fp, "%g %g %g\n", gp.x() * scalingFactor,
196  gp.y() * scalingFactor, gp.z() * scalingFactor);
197  }
198  }
199  else {
200  Msg::Warning("X3D not implemented yet without STL");
201  }
202  }
203  fprintf(fp, "\"></Coordinate>\n");
204 
205  fprintf(fp, " <Normal vector=\"\n");
206  for(auto it = faces.begin(); it != faces.end(); ++it) {
207  if((*it)->stl_normals.size()) {
208  for(std::size_t i = 0; i < (*it)->stl_normals.size(); i++) {
209  SVector3 &n((*it)->stl_normals[i]);
210  fprintf(fp, "%g %g %g\n", n.x(), n.y(), n.z());
211  }
212  }
213  else {
214  Msg::Warning("X3D not implemented yet without STL");
215  }
216  }
217  fprintf(fp, "\"></Normal>\n");
218 
219  fprintf(fp, " </IndexedTriangleSet>\n");
220  }
221  else {
222  // create faces with a explicit list or vertices (will duplicate
223  // floating-point data)
224  fprintf(fp, " <TriangleSet DEF=\"set%s\">\n", name.c_str());
225 
226  fprintf(fp, " <Coordinate point=\"\n");
227  for(auto it = faces.begin(); it != faces.end(); ++it) {
228  if((*it)->stl_vertices_uv.size()) {
229  for(std::size_t i = 0; i < (*it)->stl_triangles.size(); i += 3) {
230  SPoint2 &p1((*it)->stl_vertices_uv[(*it)->stl_triangles[i]]);
231  SPoint2 &p2((*it)->stl_vertices_uv[(*it)->stl_triangles[i + 1]]);
232  SPoint2 &p3((*it)->stl_vertices_uv[(*it)->stl_triangles[i + 2]]);
233  GPoint gp1 = (*it)->point(p1);
234  GPoint gp2 = (*it)->point(p2);
235  GPoint gp3 = (*it)->point(p3);
236  double x[3] = {gp1.x(), gp2.x(), gp3.x()};
237  double y[3] = {gp1.y(), gp2.y(), gp3.y()};
238  double z[3] = {gp1.z(), gp2.z(), gp3.z()};
239 
240  for(int j = 0; j < 3; j++) {
241  fprintf(fp, "%g %g %g\n", x[j] * scalingFactor,
242  y[j] * scalingFactor, z[j] * scalingFactor);
243  }
244  }
245  }
246  else {
247  Msg::Warning("X3D not implemented yet without STL");
248  }
249  }
250  fprintf(fp, "\"></Coordinate>\n");
251 
252  fprintf(fp, " <Normal vector=\"\n");
253  for(auto it = faces.begin(); it != faces.end(); ++it) {
254  if((*it)->stl_normals.size()) {
255  for(std::size_t i = 0; i < (*it)->stl_triangles.size(); i++) {
256  SVector3 &n((*it)->stl_normals[(*it)->stl_triangles[i]]);
257  fprintf(fp, "%g %g %g\n", n.x(), n.y(), n.z());
258  }
259  }
260  else {
261  Msg::Warning("X3D not implemented yet without STL");
262  }
263  }
264  fprintf(fp, "\"></Normal>\n");
265 
266  fprintf(fp, " </TriangleSet>\n");
267  }
268  }
269  else {
270  fprintf(fp, " <TriangleSet DEF=\"set%s\">\n", name.c_str());
271  fprintf(fp, " <Coordinate point=\"\n");
272  for(auto it = faces.begin(); it != faces.end(); ++it) {
273  for(std::size_t i = 0; i < (*it)->triangles.size(); i++)
274  (*it)->triangles[i]->writeX3D(fp, scalingFactor);
275  for(std::size_t i = 0; i < (*it)->quadrangles.size(); i++)
276  (*it)->quadrangles[i]->writeX3D(fp, scalingFactor);
277  }
278  fprintf(fp, "\"></Coordinate>\n");
279  fprintf(fp, " </TriangleSet>\n");
280  }
281 
282  fprintf(fp, " </Shape>\n");
283 }
284 
285 static void writeX3dEdges(FILE *fp, std::vector<GEdge *> &edges,
286  double scalingFactor, const std::string &name)
287 {
288  for(auto it = edges.begin(); it != edges.end(); ++it) {
289  if((*it)->stl_vertices_xyz.size()) {
290  fprintf(fp, " <Shape DEF=\"%s\">\n", name.c_str());
291  fprintf(fp,
292  " <Appearance><Material "
293  "DEF=\"mat%s\"></Material><LineProperties "
294  "id=\"prop%s\"></LineProperties></Appearance>\n",
295  name.c_str(), name.c_str());
296  fprintf(fp, " <LineSet vertexCount=\"%ld\">\n",
297  (*it)->stl_vertices_xyz.size());
298  fprintf(fp, " <Coordinate point=\"\n");
299  for(std::size_t i = 0; i < (*it)->stl_vertices_xyz.size(); i++) {
300  SPoint3 &p((*it)->stl_vertices_xyz[i]);
301 
302  fprintf(fp, "%g %g %g\n", p.x() * scalingFactor, p.y() * scalingFactor,
303  p.z() * scalingFactor);
304  }
305  fprintf(fp, "\"/>\n");
306  fprintf(fp, " </LineSet>\n");
307  fprintf(fp, " </Shape>\n");
308  }
309  else {
310  Msg::Warning("X3D not implemented yet without STL");
311  }
312  }
313 }
314 
315 int GModel::_writeX3dFile(FILE *fp, bool saveAll, double scalingFactor,
316  int x3dsurfaces, int x3dedges, int x3dvertices,
317  int x3dcolorize, std::vector<GFace *> &customFaces)
318 {
319  if(noPhysicalGroups()) saveAll = true;
320 
321  std::vector<GFace *> modelFaces;
322  if(customFaces.size() > 0) {
323  for(auto it = customFaces.begin(); it != customFaces.end(); ++it) {
324  modelFaces.push_back(*it);
325  }
326  }
327  else {
328  for(auto it = firstFace(); it != lastFace(); ++it) {
329  modelFaces.push_back(*it);
330  }
331  }
332 
333  if(x3dsurfaces != 0) {
334  fprintf(fp, " <Group DEF=\"faces\">\n");
335  if(x3dsurfaces == 1) {
336  // all surfaces in a single x3d object
337  std::vector<GFace *> faces;
338  std::vector<unsigned int> colors;
339  // for(auto it = first_face; it != last_face; ++it) {
340  for(auto it = modelFaces.begin(); it != modelFaces.end(); ++it) {
341  if(saveAll || (*it)->physicals.size()) { faces.push_back(*it); }
342  }
343  std::string name = "face";
344  writeX3dFaces(fp, faces, false, scalingFactor, name, false, colors);
345  }
346  else if(x3dsurfaces == 2) {
347  // one x3d object for each geometrical surface
348  // for(auto it = first_face; it != last_face; ++it) {
349  for(auto it = modelFaces.begin(); it != modelFaces.end(); ++it) {
350  if(saveAll || (*it)->physicals.size()) {
351  std::vector<GFace *> faces(1, *it);
352  std::vector<unsigned int> colors;
353  std::string name = getElementaryName(2, (*it)->tag());
354  // get color info
355  unsigned int cvalue = (*it)->getColor();
356  colors.push_back(cvalue);
357  if(name.empty()) {
358  std::ostringstream s;
359  s << "face" << (*it)->tag();
360  name = s.str();
361  }
362  bool useColor = x3dcolorize == 1;
363  writeX3dFaces(fp, faces, true, scalingFactor, name, useColor, colors);
364  }
365  }
366  }
367  else if(x3dsurfaces == 3) {
368  // one x3d object per physical surface
369  std::map<int, std::vector<GEntity *> > phys;
370  std::vector<unsigned int> colors;
371  getPhysicalGroups(2, phys);
372  for(auto it = phys.begin(); it != phys.end(); it++) {
373  std::vector<GFace *> faces;
374  for(std::size_t i = 0; i < it->second.size(); i++) {
375  faces.push_back(static_cast<GFace *>(it->second[i]));
376  }
377  std::string name = getPhysicalName(2, it->first);
378  if(name.empty()) {
379  std::ostringstream s;
380  s << "physicalsurface" << it->first;
381  name = s.str();
382  }
383  writeX3dFaces(fp, faces, false, scalingFactor, name, false, colors);
384  }
385  }
386 
387  fprintf(fp, " </Group>\n");
388  }
389 
390  // edges
391  if(x3dedges != 0) {
392  fprintf(fp, " <Group DEF=\"edges\">\n");
393  if(x3dedges == 1) {
394  // all edges in a single x3d object
395  std::vector<GEdge *> edges;
396  for(auto it = firstEdge(); it != lastEdge(); ++it) {
397  if(saveAll || (*it)->physicals.size()) { edges.push_back(*it); }
398  }
399  std::string name = "edge";
400  writeX3dEdges(fp, edges, scalingFactor, name);
401  }
402  else if(x3dedges == 2) {
403  // one x3d object for each physical edge
404  for(auto it = firstEdge(); it != lastEdge(); ++it) {
405  if(saveAll || (*it)->physicals.size()) {
406  std::vector<GEdge *> edges(1, *it);
407  std::string name = getElementaryName(1, (*it)->tag());
408  if(name.empty()) {
409  std::ostringstream s;
410  s << "edge" << (*it)->tag();
411  name = s.str();
412  }
413  writeX3dEdges(fp, edges, scalingFactor, name);
414  }
415  }
416  }
417  else if(x3dedges == 3) {
418  // one x3d object per physical edge
419  std::map<int, std::vector<GEntity *> > phys;
420  getPhysicalGroups(1, phys);
421  for(auto it = phys.begin(); it != phys.end(); it++) {
422  std::vector<GEdge *> edges;
423  for(std::size_t i = 0; i < it->second.size(); i++) {
424  edges.push_back(static_cast<GEdge *>(it->second[i]));
425  }
426  std::string name = getPhysicalName(1, it->first);
427  if(name.empty()) {
428  std::ostringstream s;
429  s << "physicaledge" << it->first;
430  name = s.str();
431  }
432  writeX3dEdges(fp, edges, scalingFactor, name);
433  }
434  }
435  fprintf(fp, " </Group>\n");
436  }
437 
438  // vertices
439  if(x3dvertices != 0) {
440  fprintf(fp, " <Group DEF=\"vertices\" render=\"false\">\n");
441 
442  for(auto it = firstVertex(); it != lastVertex(); ++it) {
443  fprintf(fp, " <Transform DEF=\"vertex%d\" translation=\"%g %g %g\">\n",
444  (*it)->tag(), (*it)->x(), (*it)->y(), (*it)->z());
445  fprintf(fp, " <Shape>\n");
446  fprintf(fp,
447  " <Appearance><Material "
448  "DEF=\"matvertex%d\"></Material></Appearance>\n",
449  (*it)->tag());
450  fprintf(fp, " <Sphere></Sphere>\n");
451  fprintf(fp, " </Shape>\n");
452  fprintf(fp, " </Transform>\n");
453  }
454  fprintf(fp, " </Group>\n");
455  }
456  return 1;
457 }
458 
459 static std::string TagFileName(std::string const &name, int tag)
460 {
461  std::vector<std::string> split = SplitFileName(name); //<path>/<name>.<ext>
462  std::string new_name = split[1] + "_" + std::to_string(tag);
463  return split[0] + new_name + split[2];
464 }
465 
466 static std::string HtmlFileName(std::string const &name)
467 {
468  std::vector<std::string> split = SplitFileName(name); //<path>/<name>.<ext>
469  return split[0] + "index.html";
470 }
471 
472 int GModel::writeX3D(const std::string &name, bool saveAll,
473  double scalingFactor, int x3dsurfaces, int x3dedges,
474  int x3dvertices, int x3dvolumes, int x3dcolorize)
475 {
476  FILE *fp;
477  std::vector<std::string> metadata;
478  std::vector<std::string> x3dfiles;
479  if(x3dsurfaces == 0 && x3dedges == 0 && x3dvertices == 0) {
480  Msg::Info("no surfaces, edges or vertices to write into '%s'",
481  name.c_str());
482  return 0;
483  }
484 
485  std::vector<GFace *> faces;
486  if(x3dvolumes == 1) {
487  Msg::Info("separating volumes into separate files");
488  std::vector<GEntity *> volumes;
489  getEntities(volumes, 3);
490 
491  // if volumes present in model, else continue to single file mode
492  if(volumes.size() > 0) {
493  for(auto it = volumes.begin(); it != volumes.end(); ++it) {
494  faces = (*it)->bindingsGetFaces();
495  std::string _vol_name = getElementaryName((*it)->dim(), (*it)->tag());
496  metadata.push_back(_vol_name);
497  std::string _filename = TagFileName(name, (*it)->tag());
498  x3dfiles.push_back(_filename);
499  fp = Fopen(_filename.c_str(), "w");
500  if(!fp) {
501  Msg::Warning("Unable to open file '%s'", name.c_str());
502  return 0;
503  }
504  writeX3dHeader(fp, metadata);
505  _writeX3dFile(fp, saveAll, scalingFactor, x3dsurfaces, x3dedges,
506  x3dvertices, x3dcolorize, faces);
507  writeX3dTrailer(fp);
508  fclose(fp);
509  metadata.clear();
510  }
511  // collate x3d files to html
512  std::string _htmlname = HtmlFileName(name);
513  fp = Fopen(_htmlname.c_str(), "w");
514  writeHTMLHeader(fp);
515  writeHTMLBody(fp, x3dfiles);
516  fclose(fp);
517  return 1;
518  }
519  }
520 
521  Msg::Info("writing single file");
522  x3dfiles.push_back(name);
523  fp = Fopen(name.c_str(), "w");
524  if(!fp) {
525  Msg::Warning("Unable to open file '%s'", name.c_str());
526  return 0;
527  }
528  writeX3dHeader(fp, metadata);
529  // main write function
530  _writeX3dFile(fp, saveAll, scalingFactor, x3dsurfaces, x3dedges, x3dvertices,
531  x3dcolorize, faces);
532  writeX3dTrailer(fp);
533  fclose(fp);
534 
535  std::string _htmlname = HtmlFileName(name);
536  fp = Fopen(_htmlname.c_str(), "w");
537  writeHTMLHeader(fp);
538  writeHTMLBody(fp, x3dfiles);
539  fclose(fp);
540 
541  return 1;
542 }
MTriangle.h
SplitFileName
std::vector< std::string > SplitFileName(const std::string &fileName)
Definition: StringUtils.cpp:93
GModel::firstEdge
eiter firstEdge()
Definition: GModel.h:356
GPoint::y
double y() const
Definition: GPoint.h:22
distance
double distance(MVertex *v1, MVertex *v2)
Definition: MVertex.h:245
CTX::unpackBlue
int unpackBlue(unsigned int X)
Definition: Context.cpp:152
GFace
Definition: GFace.h:33
Msg::Info
static void Info(const char *fmt,...)
Definition: GmshMessage.cpp:587
SPoint2
Definition: SPoint2.h:12
OS.h
writeX3dFaces
static void writeX3dFaces(FILE *fp, std::vector< GFace * > &faces, bool useIndexedSet, double scalingFactor, const std::string &name, bool useColor, std::vector< unsigned int > &colors)
Definition: GModelIO_X3D.cpp:127
HtmlFileName
static std::string HtmlFileName(std::string const &name)
Definition: GModelIO_X3D.cpp:466
Msg::Warning
static void Warning(const char *fmt,...)
Definition: GmshMessage.cpp:543
Msg::Error
static void Error(const char *fmt,...)
Definition: GmshMessage.cpp:482
SPoint3
Definition: SPoint3.h:14
SVector3
Definition: SVector3.h:16
GModel::firstVertex
viter firstVertex()
Definition: GModel.h:357
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
MLine.h
edges
static int edges[6][2]
Definition: meshGRegionLocalMeshMod.cpp:23
GPoint
Definition: GPoint.h:13
Fopen
FILE * Fopen(const char *f, const char *mode)
Definition: OS.cpp:273
GPoint::z
double z() const
Definition: GPoint.h:23
CTX::instance
static CTX * instance()
Definition: Context.cpp:122
writeX3dEdges
static void writeX3dEdges(FILE *fp, std::vector< GEdge * > &edges, double scalingFactor, const std::string &name)
Definition: GModelIO_X3D.cpp:285
SPoint3::x
double x(void) const
Definition: SPoint3.h:125
GModel::getPhysicalGroups
void getPhysicalGroups(std::map< int, std::vector< GEntity * > > groups[4]) const
Definition: GModel.cpp:837
GModel::lastFace
fiter lastFace()
Definition: GModel.h:359
GModel::getPhysicalName
std::string getPhysicalName(int dim, int num) const
Definition: GModel.cpp:961
GModel::lastVertex
viter lastVertex()
Definition: GModel.h:361
CTX::unpackGreen
int unpackGreen(unsigned int X)
Definition: Context.cpp:144
GModel::firstFace
fiter firstFace()
Definition: GModel.h:355
SPoint3::y
double y(void) const
Definition: SPoint3.h:127
writeHTMLBody
static void writeHTMLBody(FILE *fp, std::vector< std::string > &x3dfiles)
Definition: GModelIO_X3D.cpp:75
TagFileName
static std::string TagFileName(std::string const &name, int tag)
Definition: GModelIO_X3D.cpp:459
GModel::getElementaryName
std::string getElementaryName(int dim, int tag)
Definition: GModel.cpp:1007
discreteFace.h
MVertexRTree.h
SVector3::x
double x(void) const
Definition: SVector3.h:30
GModel::getEntities
void getEntities(std::vector< GEntity * > &entities, int dim=-1) const
Definition: GModel.cpp:651
writeHTMLHeader
static void writeHTMLHeader(FILE *fp)
Definition: GModelIO_X3D.cpp:47
GModel::_writeX3dFile
int _writeX3dFile(FILE *fp, bool saveAll, double scalingFactor, int x3dsurfaces, int x3dedges, int x3dvertices, int x3dcolorize, std::vector< GFace * > &customFaces)
Definition: GModelIO_X3D.cpp:315
StringUtils.h
Context.h
SVector3::y
double y(void) const
Definition: SVector3.h:31
z
const double z
Definition: GaussQuadratureQuad.cpp:56
MQuadrangle.h
GModel::faces
std::set< GFace *, GEntityPtrLessThan > faces
Definition: GModel.h:144
GModel::noPhysicalGroups
bool noPhysicalGroups()
Definition: GModel.cpp:828
GEdge
Definition: GEdge.h:26
SVector3::z
double z(void) const
Definition: SVector3.h:32
writeX3dHeader
static void writeX3dHeader(FILE *fp, std::vector< std::string > &metadata)
Definition: GModelIO_X3D.cpp:22
SPoint3::z
double z(void) const
Definition: SPoint3.h:129
GModel::lastEdge
eiter lastEdge()
Definition: GModel.h:360
GModel.h
writeX3dTrailer
static void writeX3dTrailer(FILE *fp)
Definition: GModelIO_X3D.cpp:41
GPoint::x
double x() const
Definition: GPoint.h:21
CTX::unpackRed
int unpackRed(unsigned int X)
Definition: Context.cpp:136
GModel::edges
std::set< GEdge *, GEntityPtrLessThan > edges
Definition: GModel.h:145
faces
static int faces[4][3]
Definition: meshGRegionDelaunayInsertion.cpp:165