gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
MVertex.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 <string.h>
7 #include <cmath>
8 #include "MVertex.h"
9 #include "GModel.h"
10 #include "GVertex.h"
11 #include "GEdge.h"
12 #include "GFace.h"
13 #include "GmshMessage.h"
14 #include "StringUtils.h"
15 
16 double angle3Vertices(const MVertex *p1, const MVertex *p2, const MVertex *p3)
17 {
18  SVector3 a(p1->x() - p2->x(), p1->y() - p2->y(), p1->z() - p2->z());
19  SVector3 b(p3->x() - p2->x(), p3->y() - p2->y(), p3->z() - p2->z());
20  SVector3 c = crossprod(a, b);
21  double sinA = c.norm();
22  double cosA = dot(a, b);
23  return std::atan2(sinA, cosA);
24 }
25 
26 MVertex::MVertex(double x, double y, double z, GEntity *ge, std::size_t num)
27  : _visible(1), _order(1), _x(x), _y(y), _z(z), _ge(ge)
28 {
29  // we should make GModel a mandatory argument to the constructor
30  GModel *m = GModel::current();
31  if(num) {
32  _num = num;
34  }
35  else {
37  }
38  _index = (long int)num;
39 }
40 
42 {
43  GModel *m = GModel::current();
45  delete this;
46 }
47 
48 void MVertex::forceNum(std::size_t num)
49 {
50  GModel *m = GModel::current();
51  _num = num;
53 }
54 
55 void MVertex::writeMSH(FILE *fp, bool binary, bool saveParametric,
56  double scalingFactor)
57 {
58  if(_index < 0) return; // negative index vertices are never saved
59 
60  if(!binary) {
61  fprintf(fp, "%ld %.16g %.16g %.16g ", _index, x() * scalingFactor,
62  y() * scalingFactor, z() * scalingFactor);
63  }
64  else {
65  int i = (int)_index;
66  fwrite(&i, sizeof(int), 1, fp);
67  double data[3] = {x() * scalingFactor, y() * scalingFactor,
68  z() * scalingFactor};
69  fwrite(data, sizeof(double), 3, fp);
70  }
71 
72  int zero = 0;
73  if(!onWhat() || !saveParametric) {
74  if(!binary)
75  fprintf(fp, "0\n");
76  else
77  fwrite(&zero, sizeof(int), 1, fp);
78  }
79  else {
80  int entity = onWhat()->tag();
81  int dim = onWhat()->dim();
82  if(!binary)
83  fprintf(fp, "%d %d ", entity, dim);
84  else {
85  fwrite(&entity, sizeof(int), 1, fp);
86  fwrite(&dim, sizeof(int), 1, fp);
87  }
88  switch(dim) {
89  case 0:
90  if(!binary) fprintf(fp, "\n");
91  break;
92  case 1: {
93  double _u;
94  getParameter(0, _u);
95  if(!binary)
96  fprintf(fp, "%.16g\n", _u);
97  else
98  fwrite(&_u, sizeof(double), 1, fp);
99  } break;
100  case 2: {
101  double _u, _v;
102  getParameter(0, _u);
103  getParameter(1, _v);
104  if(!binary)
105  fprintf(fp, "%.16g %.16g\n", _u, _v);
106  else {
107  fwrite(&_u, sizeof(double), 1, fp);
108  fwrite(&_v, sizeof(double), 1, fp);
109  }
110  } break;
111  default:
112  if(!binary)
113  fprintf(fp, "0 0 0\n");
114  else {
115  fwrite(&zero, sizeof(int), 1, fp);
116  fwrite(&zero, sizeof(int), 1, fp);
117  fwrite(&zero, sizeof(int), 1, fp);
118  }
119  break;
120  }
121  }
122 }
123 
124 void MVertex::writeMSH2(FILE *fp, bool binary, bool saveParametric,
125  double scalingFactor)
126 {
127  if(_index < 0) return; // negative index vertices are never saved
128 
129  int myDim = 0, myTag = 0;
130  if(saveParametric) {
131  if(onWhat()) {
132  myDim = onWhat()->dim();
133  myTag = onWhat()->tag();
134  }
135  else
136  saveParametric = false;
137  }
138 
139  if(!binary) {
140  if(!saveParametric)
141  fprintf(fp, "%ld %.16g %.16g %.16g\n", _index, x() * scalingFactor,
142  y() * scalingFactor, z() * scalingFactor);
143  else
144  fprintf(fp, "%ld %.16g %.16g %.16g %d %d", _index, x() * scalingFactor,
145  y() * scalingFactor, z() * scalingFactor, myDim, myTag);
146  }
147  else {
148  int i = (int)_index;
149  fwrite(&i, sizeof(int), 1, fp);
150  double data[3] = {x() * scalingFactor, y() * scalingFactor,
151  z() * scalingFactor};
152  fwrite(data, sizeof(double), 3, fp);
153  if(saveParametric) {
154  fwrite(&myDim, sizeof(int), 1, fp);
155  fwrite(&myTag, sizeof(int), 1, fp);
156  }
157  }
158 
159  if(saveParametric) {
160  if(myDim == 1) {
161  double _u;
162  getParameter(0, _u);
163  if(!binary)
164  fprintf(fp, " %.16g\n", _u);
165  else
166  fwrite(&_u, sizeof(double), 1, fp);
167  }
168  else if(myDim == 2) {
169  double _u, _v;
170  getParameter(0, _u);
171  getParameter(1, _v);
172  if(!binary)
173  fprintf(fp, " %.16g %.16g\n", _u, _v);
174  else {
175  fwrite(&_u, sizeof(double), 1, fp);
176  fwrite(&_v, sizeof(double), 1, fp);
177  }
178  }
179  else if(!binary)
180  fprintf(fp, "\n");
181  }
182 }
183 
184 void MVertex::writePLY2(FILE *fp)
185 {
186  if(_index < 0) return; // negative index vertices are never saved
187 
188  fprintf(fp, "%.16g %.16g %.16g\n", x(), y(), z());
189 }
190 
191 void MVertex::writeVRML(FILE *fp, double scalingFactor)
192 {
193  if(_index < 0) return; // negative index vertices are never saved
194 
195  fprintf(fp, "%.16g %.16g %.16g,\n", x() * scalingFactor, y() * scalingFactor,
196  z() * scalingFactor);
197 }
198 
199 void MVertex::writeUNV(FILE *fp, bool officialExponentFormat,
200  double scalingFactor)
201 {
202  if(_index < 0) return; // negative index vertices are never saved
203 
204  int coord_sys = 1;
205  int displacement_coord_sys = 1;
206  int color = 11;
207  fprintf(fp, "%10ld%10d%10d%10d\n", _index, coord_sys, displacement_coord_sys,
208  color);
209 
210  if(officialExponentFormat) {
211  // hack to print the numbers with "D+XX" exponents
212  char tmp[128];
213  sprintf(tmp, "%25.16E%25.16E%25.16E\n", x() * scalingFactor,
214  y() * scalingFactor, z() * scalingFactor);
215  for(std::size_t i = 0; i < strlen(tmp); i++)
216  if(tmp[i] == 'E') tmp[i] = 'D';
217  fprintf(fp, "%s", tmp);
218  }
219  else {
220  fprintf(fp, "%25.16E%25.16E%25.16E\n", x() * scalingFactor,
221  y() * scalingFactor, z() * scalingFactor);
222  }
223 }
224 
225 void MVertex::writeVTK(FILE *fp, bool binary, double scalingFactor,
226  bool bigEndian)
227 {
228  if(_index < 0) return; // negative index vertices are never saved
229 
230  if(binary) {
231  double data[3] = {x() * scalingFactor, y() * scalingFactor,
232  z() * scalingFactor};
233  // VTK always expects big endian binary data
234  if(!bigEndian) SwapBytes((char *)data, sizeof(double), 3);
235  fwrite(data, sizeof(double), 3, fp);
236  }
237  else {
238  fprintf(fp, "%.16g %.16g %.16g\n", x() * scalingFactor, y() * scalingFactor,
239  z() * scalingFactor);
240  }
241 }
242 
243 void MVertex::writeMATLAB(FILE *fp, int filetype, bool binary,
244  double scalingFactor)
245 {
246  if(_index < 0) return; // negative index vertices are never saved
247  if(binary) {
248  Msg::Warning("Binary format not available for Matlab, saving in ASCII");
249  binary = false;
250  }
251  fprintf(fp, "%.16g %.16g %.16g;\n", x() * scalingFactor, y() * scalingFactor,
252  z() * scalingFactor);
253 }
254 
255 void MVertex::writeTOCHNOG(FILE *fp, int dim, double scalingFactor)
256 {
257  if(_index < 0) return; // negative index vertices are never saved
258  if(dim == 2) {
259  fprintf(fp, "node %ld %.16g %.16g\n", _index, x() * scalingFactor,
260  y() * scalingFactor);
261  }
262  else if(dim == 3) {
263  fprintf(fp, "node %ld %.16g %.16g %.16g\n", _index, x() * scalingFactor,
264  y() * scalingFactor, z() * scalingFactor);
265  }
266  else if(dim == 1) {
267  fprintf(fp, "node %ld %.16g\n", _index, x() * scalingFactor);
268  }
269  else {
270  fprintf(fp, "ERROR -- unsupported dimension: %d\n", dim);
271  }
272 }
273 
274 void MVertex::writeMESH(FILE *fp, double scalingFactor)
275 {
276  if(_index < 0) return; // negative index vertices are never saved
277 
278  fprintf(fp, " %20.14G %20.14G %20.14G %d\n",
279  x() * scalingFactor, y() * scalingFactor, z() * scalingFactor,
280  _ge ? _ge->tag() : 0);
281 }
282 
283 void MVertex::writeOFF(FILE *fp, double scalingFactor)
284 {
285  if(_index < 0) return; // negative index vertices are never saved
286 
287  fprintf(fp, "%g %g %g\n", x() * scalingFactor, y() * scalingFactor,
288  z() * scalingFactor);
289 }
290 
291 void MVertex::writeNEU(FILE *fp, int dim, double scalingFactor)
292 {
293  if(_index < 0) return; // negative index vertices are never saved
294 
295  switch(dim) {
296  case 3:
297  fprintf(fp, "%10ld%20.11e%20.11e%20.11e\n", _index, x() * scalingFactor,
298  y() * scalingFactor, z() * scalingFactor);
299  break;
300  case 2:
301  fprintf(fp, "%10ld%20.11e%20.11e\n", _index, x() * scalingFactor,
302  y() * scalingFactor);
303  break;
304  case 1: fprintf(fp, "%10ld%20.11e\n", _index, x() * scalingFactor); break;
305  }
306 }
307 
308 static void double_to_char8(double val, char *str)
309 {
310  if(val >= 1.e6)
311  sprintf(str, "%.2E", val);
312  else if(val >= 1.e-3)
313  sprintf(str, "%f", val);
314  else if(val >= 0)
315  sprintf(str, "%.2E", val);
316  else if(val >= -1.e-3)
317  sprintf(str, "%.1E", val);
318  else if(val >= -1.e6)
319  sprintf(str, "%f", val);
320  else
321  sprintf(str, "%.1E", val);
322 
323 #if defined(WIN32)
324  // Windows uses 3 digits in the exponent (which apparently does not
325  // conform with ANSI C): remove the extra 0
326  if(strlen(str) == 9 && (str[4] == 'E' || str[5] == 'E')) {
327  str[6] = str[7];
328  str[7] = str[8];
329  }
330 #endif
331 
332  str[8] = '\0';
333 }
334 
335 void MVertex::writeBDF(FILE *fp, int format, double scalingFactor)
336 {
337  if(_index < 0) return; // negative index vertices are never saved
338 
339  char xs[17], ys[17], zs[17];
340  double x1 = x() * scalingFactor;
341  double y1 = y() * scalingFactor;
342  double z1 = z() * scalingFactor;
343  if(format == 0) {
344  // free field format (max 8 char per field, comma separated, 10 per line)
345  double_to_char8(x1, xs);
346  double_to_char8(y1, ys);
347  double_to_char8(z1, zs);
348  fprintf(fp, "GRID,%ld,%d,%s,%s,%s\n", _index, 0, xs, ys, zs);
349  }
350  else if(format == 1) {
351  // small field format (8 char par field, 10 per line)
352  double_to_char8(x1, xs);
353  double_to_char8(y1, ys);
354  double_to_char8(z1, zs);
355  fprintf(fp, "GRID %-8ld%-8d%-8s%-8s%-8s\n", _index, 0, xs, ys, zs);
356  }
357  else {
358  // large field format (8 char first/last field, 16 char middle, 6 per line)
359  fprintf(fp, "GRID* %-16ld%-16d%-16.9G%-16.9G\n", _index, 0, x1, y1);
360  fprintf(fp, "* %-16.9G\n", z1);
361  }
362 }
363 
364 void MVertex::writeINP(FILE *fp, double scalingFactor)
365 {
366  if(_index < 0) return; // negative index vertices are never saved
367 
368  fprintf(fp, "%ld, %.14g, %.14g, %.14g\n", _index, x() * scalingFactor,
369  y() * scalingFactor, z() * scalingFactor);
370 }
371 
372 void MVertex::writeKEY(FILE *fp, double scalingFactor)
373 {
374  if(_index < 0) return; // negative index vertices are never saved
375 
376  fprintf(fp, "%ld, %.12g, %.12g, %.12g\n", _index, x() * scalingFactor,
377  y() * scalingFactor, z() * scalingFactor);
378 }
379 
380 void MVertex::writeRAD(FILE *fp, double scalingFactor)
381 {
382  if(_index < 0) return; // negative index vertices are never saved
383 
384  fprintf(fp, "%10ld%20g%20g%20g\n", _index, x() * scalingFactor,
385  y() * scalingFactor, z() * scalingFactor);
386 }
387 
388 void MVertex::writeDIFF(FILE *fp, bool binary, double scalingFactor)
389 {
390  if(_index < 0) return; // negative index vertices are never saved
391 
392  fprintf(fp, " %ld ( %25.16E , %25.16E , %25.16E )", _index,
393  x() * scalingFactor, y() * scalingFactor, z() * scalingFactor);
394 }
395 
396 void MVertex::writeSU2(FILE *fp, int dim, double scalingFactor)
397 {
398  if(_index < 0) return; // negative index vertices are never saved
399 
400  if(dim == 2)
401  fprintf(fp, "%.16g %.16g %ld\n", x() * scalingFactor, y() * scalingFactor,
402  _index - 1);
403  else
404  fprintf(fp, "%.16g %.16g %.16g %ld\n", x() * scalingFactor,
405  y() * scalingFactor, z() * scalingFactor, _index - 1);
406 }
407 
409 
411 
413  const MVertex *v2) const
414 {
415  // you should not use this unless you know what you are doing; to create
416  // unique vertices, use MVertexRTree
417  if(v1->x() - v2->x() > tolerance) return true;
418  if(v1->x() - v2->x() < -tolerance) return false;
419  if(v1->y() - v2->y() > tolerance) return true;
420  if(v1->y() - v2->y() < -tolerance) return false;
421  if(v1->z() - v2->z() > tolerance) return true;
422  return false;
423 }
424 
425 static void getAllParameters(MVertex *v, GFace *gf,
426  std::vector<SPoint2> &params)
427 {
428  params.clear();
429 
430  if(gf->geomType() == GEntity::DiscreteSurface) {
431  params.push_back(gf->parFromPoint(SPoint3(v->x(), v->y(), v->z())));
432  return;
433  }
434 
435  if(v->onWhat()->dim() == 0) {
436  GVertex *gv = (GVertex *)v->onWhat();
437  std::vector<GEdge *> const &ed = gv->edges();
438  bool seam = false;
439  for(auto it = ed.begin(); it != ed.end(); it++) {
440  if((*it)->isSeam(gf)) {
441  Range<double> range = (*it)->parBounds(0);
442  if(gv == (*it)->getBeginVertex()) {
443  params.push_back((*it)->reparamOnFace(gf, range.low(), -1));
444  params.push_back((*it)->reparamOnFace(gf, range.low(), 1));
445  }
446  if(gv == (*it)->getEndVertex()) {
447  params.push_back((*it)->reparamOnFace(gf, range.high(), -1));
448  params.push_back((*it)->reparamOnFace(gf, range.high(), 1));
449  }
450  if(gv != (*it)->getBeginVertex() && gv != (*it)->getEndVertex()) {
451  Msg::Warning("Strange!");
452  }
453  seam = true;
454  }
455  }
456  if(!seam) params.push_back(gv->reparamOnFace(gf, 1));
457  }
458  else if(v->onWhat()->dim() == 1) {
459  GEdge *ge = (GEdge *)v->onWhat();
460  if(!ge->haveParametrization()) return;
461  double UU;
462  v->getParameter(0, UU);
463  if(UU == 0.0) UU = ge->parFromPoint(v->point());
464  params.push_back(ge->reparamOnFace(gf, UU, 1));
465  if(ge->isSeam(gf)) params.push_back(ge->reparamOnFace(gf, UU, -1));
466  }
467  else {
468  double UU, VV;
469  if(v->onWhat() == gf && v->getParameter(0, UU) && v->getParameter(1, VV))
470  params.push_back(SPoint2(UU, VV));
471  }
472 }
473 
474 bool reparamMeshEdgeOnFace(MVertex *v1, MVertex *v2, GFace *gf, SPoint2 &param1,
475  SPoint2 &param2)
476 {
477  std::vector<SPoint2> p1, p2;
478  getAllParameters(v1, gf, p1);
479  getAllParameters(v2, gf, p2);
480  if(p1.size() == 1 && p2.size() == 1) {
481  param1 = p1[0];
482  param2 = p2[0];
483  }
484  else if(p1.size() >= 1 && p2.size() >= 1) {
485  int imin = 0;
486  int jmin = 0;
487  {
488  double d = (p2[0].x() - p1[0].x()) * (p2[0].x() - p1[0].x()) +
489  (p2[0].y() - p1[0].y()) * (p2[0].y() - p1[0].y());
490  for(std::size_t i = 0; i < p2.size(); i++) {
491  double d1 = (p2[i].x() - p1[0].x()) * (p2[i].x() - p1[0].x()) +
492  (p2[i].y() - p1[0].y()) * (p2[i].y() - p1[0].y());
493  if(d1 < d) {
494  imin = i;
495  d = d1;
496  }
497  }
498  }
499  {
500  double d = (p2[0].x() - p1[0].x()) * (p2[0].x() - p1[0].x()) +
501  (p2[0].y() - p1[0].y()) * (p2[0].y() - p1[0].y());
502  for(std::size_t i = 0; i < p1.size(); i++) {
503  double d1 = (p2[0].x() - p1[i].x()) * (p2[0].x() - p1[i].x()) +
504  (p2[0].y() - p1[i].y()) * (p2[0].y() - p1[i].y());
505  if(d1 < d) {
506  jmin = i;
507  d = d1;
508  }
509  }
510  }
511  param1 = p1[jmin];
512  param2 = p2[imin];
513  }
514  else {
515  // brute force!
516  param1 = gf->parFromPoint(SPoint3(v1->x(), v1->y(), v1->z()));
517  param2 = gf->parFromPoint(SPoint3(v2->x(), v2->y(), v2->z()));
518  }
519  return true;
520 }
521 
522 bool reparamMeshVertexOnFace(MVertex const *v, const GFace *gf, SPoint2 &param,
523  bool onSurface, bool failOnSeam, int dir)
524 {
525  if(!v->onWhat()) {
526  Msg::Error("Mesh node %d is not classified: cannot reparametrize",
527  v->getNum());
528  return false;
529  }
530 
531  if(v->onWhat()->geomType() == GEntity::DiscreteCurve ||
533  param = gf->parFromPoint(SPoint3(v->x(), v->y(), v->z()), onSurface);
534  return true;
535  }
536 
537  if(v->onWhat()->dim() == 0) {
538  if(gf->geomType() == GEntity::DiscreteSurface) {
539  param = gf->parFromPoint(SPoint3(v->x(), v->y(), v->z()));
540  return true;
541  }
542 
543  GVertex *gv = (GVertex *)v->onWhat();
544  // hack for bug in periodic curves
545  if(gv->getNativeType() == GEntity::GmshModel &&
546  gf->geomType() == GEntity::Plane)
547  param = gf->parFromPoint(SPoint3(v->x(), v->y(), v->z()), onSurface);
548  else
549  param = gv->reparamOnFace(gf, dir);
550  if(failOnSeam) {
551  // shout, we could be on a seam
552  std::vector<GEdge *> const &ed = gv->edges();
553  for(auto it = ed.begin(); it != ed.end(); it++)
554  if((*it)->isSeam(gf)) return false;
555  }
556  }
557  else if(v->onWhat()->dim() == 1) {
558  if(gf->geomType() == GEntity::DiscreteSurface) {
559  param = gf->parFromPoint(SPoint3(v->x(), v->y(), v->z()));
560  return true;
561  }
562 
563  GEdge *ge = (GEdge *)v->onWhat();
564  double t;
565  v->getParameter(0, t);
566  param = ge->reparamOnFace(gf, t, dir);
567  if(!v->getParameter(0, t)) {
568  Msg::Warning("No parametric coordinate on node %d classified on curve %d",
569  v->getNum(), ge->tag());
570  return false;
571  // param = gf->parFromPoint(SPoint3(v->x(), v->y(), v->z()), onSurface);
572  }
573 
574  if(failOnSeam) {
575  // shout, we are on a seam
576  if(ge->isSeam(gf)) return false;
577  }
578  }
579  else {
580  double uu, vv;
581  if(v->onWhat() == gf && v->getParameter(0, uu) && v->getParameter(1, vv)) {
582  param = SPoint2(uu, vv);
583  }
584  else {
585  // brute force!
586  param = gf->parFromPoint(SPoint3(v->x(), v->y(), v->z()), onSurface);
587  }
588  }
589  return true;
590 }
591 
592 bool reparamMeshVertexOnEdge(MVertex *v, const GEdge *ge, double &param)
593 {
594  param = 1.e6;
595  Range<double> bounds = ge->parBounds(0);
596  bool ok = true;
597  if(ge->getBeginVertex() && ge->getBeginVertex()->mesh_vertices[0] == v)
598  param = bounds.low();
599  else if(ge->getEndVertex() && ge->getEndVertex()->mesh_vertices[0] == v)
600  param = bounds.high();
601  else
602  ok = v->getParameter(0, param);
603 
604  if(!ok || param == 1.e6)
605  param = ge->parFromPoint(SPoint3(v->x(), v->y(), v->z()));
606 
607  if(param < 1.e6) return true;
608  return false;
609 }
crossprod
SVector3 crossprod(const SVector3 &a, const SVector3 &b)
Definition: SVector3.h:150
GModel::incrementAndGetMaxVertexNumber
std::size_t incrementAndGetMaxVertexNumber()
Definition: GModel.h:236
MVertex::writeRAD
void writeRAD(FILE *fp, double scalingFactor=1.0)
Definition: MVertex.cpp:380
GModel::decrementMaxVertexNumber
void decrementMaxVertexNumber()
Definition: GModel.h:258
GEdge::reparamOnFace
virtual SPoint2 reparamOnFace(const GFace *face, double epar, int dir) const
Definition: GEdge.cpp:482
dot
double dot(const SVector3 &a, const SMetric3 &m, const SVector3 &b)
Definition: STensor3.h:71
MVertex::writeVRML
void writeVRML(FILE *fp, double scalingFactor=1.0)
Definition: MVertex.cpp:191
GFace.h
MVertexPtrLessThanLexicographic::operator()
bool operator()(const MVertex *v1, const MVertex *v2) const
Definition: MVertex.cpp:412
GFace
Definition: GFace.h:33
MVertex::writeUNV
void writeUNV(FILE *fp, bool officialExponentFormat, double scalingFactor=1.0)
Definition: MVertex.cpp:199
SPoint2
Definition: SPoint2.h:12
MVertex::writeINP
void writeINP(FILE *fp, double scalingFactor=1.0)
Definition: MVertex.cpp:364
c
static double c(int i, int j, fullMatrix< double > &CA, const std::vector< SPoint3 > &P, const std::vector< SPoint3 > &Q)
Definition: discreteFrechetDistance.cpp:15
MVertex
Definition: MVertex.h:24
Msg::Warning
static void Warning(const char *fmt,...)
Definition: GmshMessage.cpp:543
Msg::Error
static void Error(const char *fmt,...)
Definition: GmshMessage.cpp:482
MVertex::z
double z() const
Definition: MVertex.h:62
reparamMeshVertexOnFace
bool reparamMeshVertexOnFace(MVertex const *v, const GFace *gf, SPoint2 &param, bool onSurface, bool failOnSeam, int dir)
Definition: MVertex.cpp:522
SPoint3
Definition: SPoint3.h:14
MVertex::getNum
std::size_t getNum() const
Definition: MVertex.h:86
Range::high
T high() const
Definition: Range.h:20
SVector3
Definition: SVector3.h:16
GVertex::edges
virtual std::vector< GEdge * > const & edges() const
Definition: GVertex.h:54
GEntity::getNativeType
virtual ModelType getNativeType() const
Definition: GEntity.h:268
getAllParameters
static void getAllParameters(MVertex *v, GFace *gf, std::vector< SPoint2 > &params)
Definition: MVertex.cpp:425
MVertex::onWhat
GEntity * onWhat() const
Definition: MVertex.h:82
GModel::getMaxVertexNumber
std::size_t getMaxVertexNumber() const
Definition: GModel.h:222
MVertex::point
SPoint3 point() const
Definition: MVertex.h:67
GmshMessage.h
GModel::setMaxVertexNumber
void setMaxVertexNumber(std::size_t num)
Definition: GModel.h:224
GEntity::GmshModel
@ GmshModel
Definition: GEntity.h:81
GEntity
Definition: GEntity.h:31
reparamMeshVertexOnEdge
bool reparamMeshVertexOnEdge(MVertex *v, const GEdge *ge, double &param)
Definition: MVertex.cpp:592
MVertex::writeMESH
void writeMESH(FILE *fp, double scalingFactor=1.0)
Definition: MVertex.cpp:274
GEntity::DiscreteCurve
@ DiscreteCurve
Definition: GEntity.h:104
GEntity::Plane
@ Plane
Definition: GEntity.h:105
GEdge.h
SwapBytes
void SwapBytes(char *array, int size, int n)
Definition: StringUtils.cpp:16
Range
Definition: Range.h:10
GEntity::mesh_vertices
std::vector< MVertex * > mesh_vertices
Definition: GEntity.h:56
GVertex
Definition: GVertex.h:23
MVertex.h
MVertex::writeBDF
void writeBDF(FILE *fp, int format=0, double scalingFactor=1.0)
Definition: MVertex.cpp:335
MVertex::writeVTK
void writeVTK(FILE *fp, bool binary=false, double scalingFactor=1.0, bool bigEndian=false)
Definition: MVertex.cpp:225
GModel
Definition: GModel.h:44
reparamMeshEdgeOnFace
bool reparamMeshEdgeOnFace(MVertex *v1, MVertex *v2, GFace *gf, SPoint2 &param1, SPoint2 &param2)
Definition: MVertex.cpp:474
GEdge::getBeginVertex
virtual GVertex * getBeginVertex() const
Definition: GEdge.h:63
MVertex::writeNEU
void writeNEU(FILE *fp, int dim, double scalingFactor=1.0)
Definition: MVertex.cpp:291
GFace::parFromPoint
virtual SPoint2 parFromPoint(const SPoint3 &, bool onSurface=true, bool convTestXYZ=false) const
Definition: GFace.cpp:1254
MVertex::writePLY2
void writePLY2(FILE *fp)
Definition: MVertex.cpp:184
GEntity::geomType
virtual GeomType geomType() const
Definition: GEntity.h:238
MVertex::writeSU2
void writeSU2(FILE *fp, int dim, double scalingFactor=1.0)
Definition: MVertex.cpp:396
MVertex::writeMATLAB
void writeMATLAB(FILE *fp, int type, bool binary, double scalingFactor=1.0)
Definition: MVertex.cpp:243
MVertexPtrLessThanLexicographic::getTolerance
static double getTolerance()
Definition: MVertex.cpp:410
GEdge::isSeam
virtual bool isSeam(const GFace *face) const
Definition: GEdge.h:101
MVertex::writeMSH2
void writeMSH2(FILE *fp, bool binary=false, bool saveParametric=false, double scalingFactor=1.0)
Definition: MVertex.cpp:124
angle3Vertices
double angle3Vertices(const MVertex *p1, const MVertex *p2, const MVertex *p3)
Definition: MVertex.cpp:16
GEntity::tag
int tag() const
Definition: GEntity.h:280
GEntity::BoundaryLayerCurve
@ BoundaryLayerCurve
Definition: GEntity.h:103
MVertex::writeMSH
void writeMSH(FILE *fp, bool binary=false, bool saveParametric=false, double scalingFactor=1.0)
Definition: MVertex.cpp:55
MVertex::_num
std::size_t _num
Definition: MVertex.h:29
MVertexPtrLessThanLexicographic::tolerance
static double tolerance
Definition: MVertex.h:211
MVertex::forceNum
void forceNum(std::size_t num)
Definition: MVertex.cpp:48
MVertex::deleteLast
void deleteLast()
Definition: MVertex.cpp:41
GEntity::DiscreteSurface
@ DiscreteSurface
Definition: GEntity.h:117
StringUtils.h
MVertex::getParameter
virtual bool getParameter(int i, double &par) const
Definition: MVertex.h:97
MVertex::_index
long int _index
Definition: MVertex.h:37
GEdge::parBounds
virtual Range< double > parBounds(int i) const =0
GVertex.h
z
const double z
Definition: GaussQuadratureQuad.cpp:56
GEdge
Definition: GEdge.h:26
MVertex::_ge
GEntity * _ge
Definition: MVertex.h:43
MVertex::writeKEY
void writeKEY(FILE *fp, double scalingFactor=1.0)
Definition: MVertex.cpp:372
MVertex::writeTOCHNOG
void writeTOCHNOG(FILE *fp, int dim, double scalingFactor=1.0)
Definition: MVertex.cpp:255
double_to_char8
static void double_to_char8(double val, char *str)
Definition: MVertex.cpp:308
GVertex::reparamOnFace
virtual SPoint2 reparamOnFace(const GFace *gf, int) const
Definition: GVertex.cpp:49
MVertex::writeOFF
void writeOFF(FILE *fp, double scalingFactor=1.0)
Definition: MVertex.cpp:283
GModel.h
MVertex::y
double y() const
Definition: MVertex.h:61
GEdge::getEndVertex
virtual GVertex * getEndVertex() const
Definition: GEdge.h:64
Range::low
T low() const
Definition: Range.h:18
GEntity::dim
virtual int dim() const
Definition: GEntity.h:196
MVertex::writeDIFF
void writeDIFF(FILE *fp, bool binary, double scalingFactor=1.0)
Definition: MVertex.cpp:388
GEdge::parFromPoint
virtual double parFromPoint(const SPoint3 &P) const
Definition: GEdge.cpp:595
MVertex::MVertex
MVertex(double x, double y, double z, GEntity *ge=nullptr, std::size_t num=0)
Definition: MVertex.cpp:26
GModel::current
static GModel * current(int index=-1)
Definition: GModel.cpp:136
GEntity::haveParametrization
virtual bool haveParametrization()
Definition: GEntity.h:251
MVertex::x
double x() const
Definition: MVertex.h:60