gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
PViewVertexArrays.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 <algorithm>
8 #include "GmshMessage.h"
9 #include "GmshDefines.h"
10 #include "onelab.h"
11 #include "Iso.h"
12 #include "MEdge.h"
13 #include "MFace.h"
14 #include "PView.h"
15 #include "PViewOptions.h"
16 #include "PViewData.h"
17 #include "PViewDataRemote.h"
18 #include "Numeric.h"
19 #include "VertexArray.h"
20 #include "SmoothData.h"
21 #include "Context.h"
22 #include "OpenFile.h"
23 #include "mathEvaluator.h"
24 #include "Options.h"
25 #include "StringUtils.h"
26 #include "fullMatrix.h"
27 
28 static void saturate(int nb, double **val, double vmin, double vmax, int i0 = 0,
29  int i1 = 1, int i2 = 2, int i3 = 3, int i4 = 4, int i5 = 5,
30  int i6 = 6, int i7 = 7)
31 {
32  int id[8] = {i0, i1, i2, i3, i4, i5, i6, i7};
33  for(int i = 0; i < nb; i++) {
34  if(val[id[i]][0] > vmax)
35  val[id[i]][0] = vmax;
36  else if(val[id[i]][0] < vmin)
37  val[id[i]][0] = vmin;
38  }
39 }
40 
41 static double saturateVector(double *val, int numComp2, double *val2,
42  double min, double max)
43 {
44  double v = ComputeScalarRep(numComp2, val2); // v >= 0
45  if(v < min && v > 1e-15) {
46  double f = min / v;
47  for(int iComp = 0; iComp < numComp2; ++iComp) val2[iComp] *= f;
48  val[0] *= f;
49  val[1] *= f;
50  val[2] *= f;
51  return min;
52  }
53  if(v > max && v > 1e-15) {
54  double f = max / v;
55  for(int iComp = 0; iComp < numComp2; ++iComp) val2[iComp] *= f;
56  val[0] *= f;
57  val[1] *= f;
58  val[2] *= f;
59  return max;
60  }
61  return v;
62 }
63 
64 static SVector3 normal3(double **xyz, int i0 = 0, int i1 = 1, int i2 = 2)
65 {
66  SVector3 t1(xyz[i1][0] - xyz[i0][0], xyz[i1][1] - xyz[i0][1],
67  xyz[i1][2] - xyz[i0][2]);
68  SVector3 t2(xyz[i2][0] - xyz[i0][0], xyz[i2][1] - xyz[i0][1],
69  xyz[i2][2] - xyz[i0][2]);
70  SVector3 n = crossprod(t1, t2);
71  n.normalize();
72  return n;
73 }
74 
75 static SVector3 getPointNormal(PView *p, double v)
76 {
77  PViewOptions *opt = p->getOptions();
78  SVector3 n(0., 0., 0.);
79  if(opt->pointType > 0) {
80  // when we draw spheres, we use the normalized value (between 0
81  // and 1) stored in the first component of the normal to modulate
82  // the radius
83  double d = opt->tmpMax - opt->tmpMin;
84  n[0] = (v - opt->tmpMin) / (d ? d : 1.);
85  }
86  return n;
87 }
88 
89 static void getLineNormal(PView *p, double x[2], double y[2], double z[2],
90  double *v, SVector3 n[2], bool computeNormal)
91 {
92  PViewOptions *opt = p->getOptions();
93 
94  if(opt->lineType > 0) {
95  if(v) {
96  // when we draw tapered cylinders, we use the normalized values
97  // (between 0 and 1) stored in the first component of the
98  // normals to modulate the width
99  double d = opt->tmpMax - opt->tmpMin;
100  n[0][0] = (v[0] - opt->tmpMin) / (d ? d : 1.);
101  n[1][0] = (v[1] - opt->tmpMin) / (d ? d : 1.);
102  }
103  else {
104  // when we don't have values we use maximum width cylinders
105  n[0][0] = n[1][0] = 1.;
106  }
107  }
108  else if(computeNormal) {
110  if(bb.min().z() == bb.max().z())
111  n[0] = n[1] = SVector3(0., 0., 1.);
112  else if(bb.min().y() == bb.max().y())
113  n[0] = n[1] = SVector3(0., 1., 0.);
114  else if(bb.min().x() == bb.max().x())
115  n[0] = n[1] = SVector3(1., 0., 0.);
116  else {
117  // we don't have any info about the normal, just pick one
118  SVector3 t(x[1] - x[0], y[1] - y[0], z[1] - z[0]);
119  SVector3 ex(0., 0., 0.);
120  if(t[0] == 0.)
121  ex[0] = 1.;
122  else if(t[1] == 0.)
123  ex[1] = 1.;
124  else
125  ex[2] = 1.;
126  n[0] = crossprod(t, ex);
127  n[0].normalize();
128  n[1] = n[0];
129  }
130  }
131 }
132 
133 static bool getExternalValues(PView *p, int index, int ient, int iele,
134  int numNodes, int numComp, double **val,
135  int &numComp2, double **val2)
136 {
137  PViewOptions *opt = p->getOptions();
138 
139  // use self by default
140  numComp2 = numComp;
141  for(int i = 0; i < numNodes; i++)
142  for(int j = 0; j < numComp; j++) val2[i][j] = val[i][j];
143  opt->externalMin = opt->tmpMin;
144  opt->externalMax = opt->tmpMax;
145 
146  if(index < 0 || index >= (int)PView::list.size()) return false;
147 
148  PView *p2 = PView::list[index];
149  PViewData *data2 = p2->getData(true); // use adaptive data if available
150 
151  if(iele >= data2->getNumElements(opt->timeStep, ient)) return false;
152 
153  if(!data2->skipElement(opt->timeStep, ient, iele) &&
154  data2->getNumNodes(opt->timeStep, ient, iele) == numNodes) {
155  numComp2 = data2->getNumComponents(opt->timeStep, ient, iele);
156  for(int i = 0; i < numNodes; i++)
157  for(int j = 0; j < numComp2; j++)
158  data2->getValue(opt->timeStep, ient, iele, i, j, val2[i][j]);
159  if(opt->rangeType == PViewOptions::Custom) {
160  opt->externalMin = opt->customMin;
161  opt->externalMax = opt->customMax;
162  }
163  else if(opt->rangeType == PViewOptions::PerTimeStep) {
164  opt->externalMin = data2->getMin(opt->timeStep);
165  opt->externalMax = data2->getMax(opt->timeStep);
166  }
167  else {
168  opt->externalMin = data2->getMin();
169  opt->externalMax = data2->getMax();
170  }
171  return true;
172  }
173  return false;
174 }
175 
176 static void applyGeneralRaise(PView *p, int numNodes, int numComp,
177  double **vals, double **xyz)
178 {
179  PViewOptions *opt = p->getOptions();
180  if(!opt->genRaiseEvaluator) return;
181 
182  std::vector<double> values(14, 0.), res(3);
183  for(int k = 0; k < numNodes; k++) {
184  for(int i = 0; i < 3; i++) values[i] = xyz[k][i];
185  for(int i = 0; i < std::min(numComp, 9); i++) values[3 + i] = vals[k][i];
186  values[12] = p->getOptions()->timeStep;
187  values[13] = p->getOptions()->currentTime;
188  if(opt->genRaiseEvaluator->eval(values, res))
189  for(int i = 0; i < 3; i++) xyz[k][i] += opt->genRaiseFactor * res[i];
190  }
191 }
192 
193 void changeCoordinates(PView *p, int ient, int iele, int numNodes, int type,
194  int numComp, double **xyz, double **val)
195 {
196  PViewOptions *opt = p->getOptions();
197 
198  if(opt->explode != 1.) {
199  double barycenter[3] = {0., 0., 0.};
200  for(int i = 0; i < numNodes; i++)
201  for(int j = 0; j < 3; j++) barycenter[j] += xyz[i][j];
202  for(int j = 0; j < 3; j++) barycenter[j] /= (double)numNodes;
203  for(int i = 0; i < numNodes; i++)
204  for(int j = 0; j < 3; j++)
205  xyz[i][j] = barycenter[j] + opt->explode * (xyz[i][j] - barycenter[j]);
206  }
207 
208  if(opt->transform[0][0] != 1. || opt->transform[0][1] != 0. ||
209  opt->transform[0][2] != 0. || opt->transform[1][0] != 0. ||
210  opt->transform[1][1] != 1. || opt->transform[1][2] != 0. ||
211  opt->transform[2][0] != 0. || opt->transform[2][1] != 0. ||
212  opt->transform[2][2] != 1.) {
213  for(int i = 0; i < numNodes; i++) {
214  double old[3] = {xyz[i][0], xyz[i][1], xyz[i][2]};
215  for(int j = 0; j < 3; j++) {
216  xyz[i][j] = 0.;
217  for(int k = 0; k < 3; k++) xyz[i][j] += opt->transform[j][k] * old[k];
218  }
219  }
220  }
221 
222  if(opt->offset[0] || opt->offset[1] || opt->offset[2]) {
223  for(int i = 0; i < numNodes; i++)
224  for(int j = 0; j < 3; j++) xyz[i][j] += opt->offset[j];
225  }
226 
227  if(opt->raise[0] || opt->raise[1] || opt->raise[2]) {
228  for(int i = 0; i < numNodes; i++) {
229  double v = ComputeScalarRep(numComp, val[i]);
230  for(int j = 0; j < 3; j++) xyz[i][j] += opt->raise[j] * v;
231  }
232  }
233 
234  if(opt->normalRaise &&
235  (type == TYPE_LIN || type == TYPE_TRI || type == TYPE_QUA)) {
236  SVector3 n;
237  if(type == TYPE_LIN) {
238  // assumes lines in z=const plane, and raises in that plane
239  double x[2] = {xyz[0][0], xyz[1][0]};
240  double y[2] = {xyz[0][1], xyz[1][1]};
241  double z[2] = {xyz[0][2], xyz[1][2]};
242  SVector3 p(0, 0, 1.);
243  SVector3 t(x[1] - x[0], y[1] - y[0], z[1] - z[0]);
244  n = crossprod(t, p);
245  n.normalize();
246  }
247  else
248  n = normal3(xyz);
249  for(int i = 0; i < numNodes; i++) {
250  double v = ComputeScalarRep(numComp, val[i]);
251  for(int j = 0; j < 3; j++) xyz[i][j] += n[j] * opt->normalRaise * v;
252  }
253  }
254 
255  if(numComp == 3 && opt->vectorType == PViewOptions::Displacement) {
256  for(int i = 0; i < numNodes; i++) {
257  for(int j = 0; j < 3; j++)
258  xyz[i][j] += opt->displacementFactor * val[i][j];
259  }
260  }
261 
262  if(opt->useGenRaise) {
263  int numComp2;
264  double **val2 = new double *[numNodes];
265  for(int i = 0; i < numNodes; i++) val2[i] = new double[9];
266  getExternalValues(p, opt->viewIndexForGenRaise, ient, iele, numNodes,
267  numComp, val, numComp2, val2);
268  applyGeneralRaise(p, numNodes, numComp2, val2, xyz);
269  for(int i = 0; i < numNodes; i++) delete[] val2[i];
270  delete[] val2;
271  }
272 }
273 
274 static double evalClipPlane(int clip, double x, double y, double z)
275 {
276  return CTX::instance()->clipPlane[clip][0] * x +
277  CTX::instance()->clipPlane[clip][1] * y +
278  CTX::instance()->clipPlane[clip][2] * z +
280 }
281 
282 static double intersectClipPlane(int clip, int numNodes, double **xyz)
283 {
284  double val = evalClipPlane(clip, xyz[0][0], xyz[0][1], xyz[0][2]);
285  for(int i = 1; i < numNodes; i++) {
286  if(val * evalClipPlane(clip, xyz[i][0], xyz[i][1], xyz[i][2]) <= 0)
287  return 0.; // the element intersects the cut plane
288  }
289  return val;
290 }
291 
292 bool isElementVisible(PViewOptions *opt, int dim, int numNodes, double **xyz)
293 {
294  if(!CTX::instance()->clipWholeElements) return true;
295  bool hidden = false;
296  for(int clip = 0; clip < 6; clip++) {
297  if(opt->clip & (1 << clip)) {
298  if(dim < 3 && CTX::instance()->clipOnlyVolume) {}
299  else {
300  double d = intersectClipPlane(clip, numNodes, xyz);
301  if(dim == 3 && CTX::instance()->clipOnlyDrawIntersectingVolume && d) {
302  hidden = true;
303  break;
304  }
305  else if(d < 0) {
306  hidden = true;
307  break;
308  }
309  }
310  }
311  }
312  return !hidden;
313 }
314 
315 static void addOutlinePoint(PView *p, double **xyz, unsigned int color,
316  bool pre, int i0 = 0)
317 {
318  if(pre) return;
319  SVector3 n = getPointNormal(p, 1.);
320  p->va_points->add(&xyz[i0][0], &xyz[i0][1], &xyz[i0][2], &n, &color, nullptr,
321  true);
322 }
323 
324 static void addScalarPoint(PView *p, double **xyz, double **val, bool pre,
325  int i0 = 0, bool unique = false)
326 {
327  if(pre) return;
328 
329  PViewOptions *opt = p->getOptions();
330 
331  double vmin = opt->tmpMin, vmax = opt->tmpMax;
332  if(opt->saturateValues) saturate(1, val, vmin, vmax, i0);
333 
334  if(val[i0][0] >= vmin && val[i0][0] <= vmax) {
335  unsigned int col = opt->getColor(
336  val[i0][0], vmin, vmax, false,
337  (opt->intervalsType == PViewOptions::Discrete) ? opt->nbIso : -1);
338  SVector3 n = getPointNormal(p, val[i0][0]);
339  p->va_points->add(&xyz[i0][0], &xyz[i0][1], &xyz[i0][2], &n, &col, nullptr,
340  unique);
341  }
342 }
343 
344 static void addOutlineLine(PView *p, double **xyz, unsigned int color, bool pre,
345  int i0 = 0, int i1 = 1)
346 {
347  if(pre) return;
348 
349  const int in[2] = {i0, i1};
350  unsigned int col[2];
351  double x[2], y[2], z[2];
352  for(int i = 0; i < 2; i++) {
353  x[i] = xyz[in[i]][0];
354  y[i] = xyz[in[i]][1];
355  z[i] = xyz[in[i]][2];
356  col[i] = color;
357  }
358  SVector3 n[2];
359  getLineNormal(p, x, y, z, nullptr, n, true);
360  p->va_lines->add(x, y, z, n, col, nullptr, true);
361 }
362 
363 static void addScalarLine(PView *p, double **xyz, double **val, bool pre,
364  int i0 = 0, int i1 = 1, bool unique = false)
365 {
366  if(pre) return;
367 
368  PViewOptions *opt = p->getOptions();
369 
370  if(opt->boundary > 0) {
371  opt->boundary--;
372  addScalarPoint(p, xyz, val, pre, i0, true);
373  addScalarPoint(p, xyz, val, pre, i1, true);
374  opt->boundary++;
375  return;
376  }
377 
378  double vmin = opt->tmpMin, vmax = opt->tmpMax;
379  if(opt->saturateValues) saturate(2, val, vmin, vmax, i0, i1);
380 
381  double x[2] = {xyz[i0][0], xyz[i1][0]};
382  double y[2] = {xyz[i0][1], xyz[i1][1]};
383  double z[2] = {xyz[i0][2], xyz[i1][2]};
384  double v[2] = {val[i0][0], val[i1][0]};
385 
387  SVector3 n[2];
388  getLineNormal(p, x, y, z, v, n, true);
389  if(val[i0][0] >= vmin && val[i0][0] <= vmax && val[i1][0] >= vmin &&
390  val[i1][0] <= vmax) {
391  unsigned int col[2];
392  for(int i = 0; i < 2; i++) col[i] = opt->getColor(v[i], vmin, vmax);
393  p->va_lines->add(x, y, z, n, col, nullptr, unique);
394  }
395  else {
396  double x2[2], y2[2], z2[2], v2[2];
397  int nb = CutLine(x, y, z, v, vmin, vmax, x2, y2, z2, v2);
398  if(nb == 2) {
399  unsigned int col[2];
400  for(int i = 0; i < 2; i++) col[i] = opt->getColor(v2[i], vmin, vmax);
401  p->va_lines->add(x2, y2, z2, n, col, nullptr, unique);
402  }
403  }
404  }
405 
407  for(int k = 0; k < opt->nbIso; k++) {
408  if(vmin == vmax) k = opt->nbIso / 2;
409  double min = opt->getScaleValue(k, opt->nbIso + 1, vmin, vmax);
410  double max = opt->getScaleValue(k + 1, opt->nbIso + 1, vmin, vmax);
411  double x2[2], y2[2], z2[2], v2[2];
412  int nb = CutLine(x, y, z, v, min, max, x2, y2, z2, v2);
413  if(nb == 2) {
414  unsigned int color = opt->getColor(k, opt->nbIso);
415  unsigned int col[2] = {color, color};
416  SVector3 n[2];
417  getLineNormal(p, x2, y2, z2, v2, n, true);
418  p->va_lines->add(x2, y2, z2, n, col, nullptr, unique);
419  }
420  if(vmin == vmax) break;
421  }
422  }
423 
424  if(opt->intervalsType == PViewOptions::Iso) {
425  for(int k = 0; k < opt->nbIso; k++) {
426  if(vmin == vmax) k = opt->nbIso / 2;
427  double iso = opt->getScaleValue(k, opt->nbIso, vmin, vmax);
428  double x2[1], y2[1], z2[1];
429  int nb = IsoLine(x, y, z, v, iso, x2, y2, z2);
430  if(nb == 1) {
431  unsigned int color = opt->getColor(k, opt->nbIso);
432  SVector3 n = getPointNormal(p, iso);
433  p->va_points->add(x2, y2, z2, &n, &color, nullptr, unique);
434  }
435  if(vmin == vmax) break;
436  }
437  }
438 }
439 
440 static void addOutlineTriangle(PView *p, double **xyz, unsigned int color,
441  bool pre, int i0 = 0, int i1 = 1, int i2 = 2)
442 {
443  PViewOptions *opt = p->getOptions();
444 
445  const int il[3][2] = {{i0, i1}, {i1, i2}, {i2, i0}};
446 
447  SVector3 nfac = normal3(xyz, i0, i1, i2);
448 
449  for(int i = 0; i < 3; i++) {
450  double x[2] = {xyz[il[i][0]][0], xyz[il[i][1]][0]};
451  double y[2] = {xyz[il[i][0]][1], xyz[il[i][1]][1]};
452  double z[2] = {xyz[il[i][0]][2], xyz[il[i][1]][2]};
453  SVector3 n[2] = {nfac, nfac};
454  unsigned int col[2] = {color, color};
455  if(opt->smoothNormals) {
456  for(int j = 0; j < 2; j++) {
457  if(pre)
458  p->normals->add(x[j], y[j], z[j], n[j][0], n[j][1], n[j][2]);
459  else
460  p->normals->get(x[j], y[j], z[j], n[j][0], n[j][1], n[j][2]);
461  }
462  }
463  getLineNormal(p, x, y, z, nullptr, n, false);
464  if(!pre) p->va_lines->add(x, y, z, n, col, nullptr, true);
465  }
466 }
467 
468 static void addScalarTriangle(PView *p, double **xyz, double **val, bool pre,
469  int i0 = 0, int i1 = 1, int i2 = 2,
470  bool unique = false, bool skin = false)
471 {
472  PViewOptions *opt = p->getOptions();
473 
474  const int il[3][2] = {{i0, i1}, {i1, i2}, {i2, i0}};
475 
476  if(opt->boundary > 0) {
477  opt->boundary--;
478  for(int i = 0; i < 3; i++)
479  addScalarLine(p, xyz, val, pre, il[i][0], il[i][1], true);
480  opt->boundary++;
481  return;
482  }
483 
484  double vmin = opt->tmpMin, vmax = opt->tmpMax;
485  if(opt->saturateValues) saturate(3, val, vmin, vmax, i0, i1, i2);
486 
487  double x[3] = {xyz[i0][0], xyz[i1][0], xyz[i2][0]};
488  double y[3] = {xyz[i0][1], xyz[i1][1], xyz[i2][1]};
489  double z[3] = {xyz[i0][2], xyz[i1][2], xyz[i2][2]};
490  double v[3] = {val[i0][0], val[i1][0], val[i2][0]};
491 
492  SVector3 nfac = normal3(xyz, i0, i1, i2);
493 
495  if(val[i0][0] >= vmin && val[i0][0] <= vmax && val[i1][0] >= vmin &&
496  val[i1][0] <= vmax && val[i2][0] >= vmin && val[i2][0] <= vmax) {
497  SVector3 n[3] = {nfac, nfac, nfac};
498  unsigned int col[3];
499  for(int i = 0; i < 3; i++) {
500  if(opt->smoothNormals) {
501  if(pre)
502  p->normals->add(x[i], y[i], z[i], n[i][0], n[i][1], n[i][2]);
503  else
504  p->normals->get(x[i], y[i], z[i], n[i][0], n[i][1], n[i][2]);
505  }
506  col[i] = opt->getColor(v[i], vmin, vmax);
507  }
508  if(!pre) p->va_triangles->add(x, y, z, n, col, nullptr, unique, skin);
509  }
510  else {
511  double x2[10], y2[10], z2[10], v2[10];
512  int nb = CutTriangle(x, y, z, v, vmin, vmax, x2, y2, z2, v2);
513  if(nb >= 3) {
514  for(int j = 2; j < nb; j++) {
515  double x3[3] = {x2[0], x2[j - 1], x2[j]};
516  double y3[3] = {y2[0], y2[j - 1], y2[j]};
517  double z3[3] = {z2[0], z2[j - 1], z2[j]};
518  double v3[3] = {v2[0], v2[j - 1], v2[j]};
519  SVector3 n[3] = {nfac, nfac, nfac};
520  unsigned int col[3];
521  for(int i = 0; i < 3; i++) {
522  if(opt->smoothNormals) {
523  if(pre)
524  p->normals->add(x3[i], y3[i], z3[i], n[i][0], n[i][1], n[i][2]);
525  else
526  p->normals->get(x3[i], y3[i], z3[i], n[i][0], n[i][1], n[i][2]);
527  }
528  col[i] = opt->getColor(v3[i], vmin, vmax);
529  }
530  if(!pre)
531  p->va_triangles->add(x3, y3, z3, n, col, nullptr, unique, skin);
532  }
533  }
534  }
535  }
536 
538  for(int k = 0; k < opt->nbIso; k++) {
539  if(vmin == vmax) k = opt->nbIso / 2;
540  double min = opt->getScaleValue(k, opt->nbIso + 1, vmin, vmax);
541  double max = opt->getScaleValue(k + 1, opt->nbIso + 1, vmin, vmax);
542  double x2[10], y2[10], z2[10], v2[10];
543  int nb = CutTriangle(x, y, z, v, min, max, x2, y2, z2, v2);
544  if(nb >= 3) {
545  unsigned int color = opt->getColor(k, opt->nbIso);
546  unsigned int col[3] = {color, color, color};
547  for(int j = 2; j < nb; j++) {
548  double x3[3] = {x2[0], x2[j - 1], x2[j]};
549  double y3[3] = {y2[0], y2[j - 1], y2[j]};
550  double z3[3] = {z2[0], z2[j - 1], z2[j]};
551  SVector3 n[3] = {nfac, nfac, nfac};
552  if(opt->smoothNormals) {
553  for(int i = 0; i < 3; i++) {
554  if(pre)
555  p->normals->add(x3[i], y3[i], z3[i], n[i][0], n[i][1], n[i][2]);
556  else
557  p->normals->get(x3[i], y3[i], z3[i], n[i][0], n[i][1], n[i][2]);
558  }
559  }
560  if(!pre)
561  p->va_triangles->add(x3, y3, z3, n, col, nullptr, unique, skin);
562  }
563  }
564  if(vmin == vmax) break;
565  }
566  }
567 
568  if(opt->intervalsType == PViewOptions::Iso) {
569  for(int k = 0; k < opt->nbIso; k++) {
570  if(vmin == vmax) k = opt->nbIso / 2;
571  double iso = opt->getScaleValue(k, opt->nbIso, vmin, vmax);
572  double x2[3], y2[3], z2[3];
573  int nb = IsoTriangle(x, y, z, v, iso, x2, y2, z2);
574  if(nb == 2) {
575  unsigned int color = opt->getColor(k, opt->nbIso);
576  unsigned int col[2] = {color, color};
577  SVector3 n[2] = {nfac, nfac};
578  if(opt->smoothNormals) {
579  for(int i = 0; i < 2; i++) {
580  if(pre)
581  p->normals->add(x2[i], y2[i], z2[i], n[i][0], n[i][1], n[i][2]);
582  else
583  p->normals->get(x2[i], y2[i], z2[i], n[i][0], n[i][1], n[i][2]);
584  }
585  }
586  double v[2] = {iso, iso};
587  getLineNormal(p, x, y, z, v, n, false);
588  if(!pre) p->va_lines->add(x2, y2, z2, n, col, nullptr, unique);
589  }
590  if(vmin == vmax) break;
591  }
592  }
593 }
594 
595 static void addOutlineQuadrangle(PView *p, double **xyz, unsigned int color,
596  bool pre, int i0 = 0, int i1 = 1, int i2 = 2,
597  int i3 = 3)
598 {
599  PViewOptions *opt = p->getOptions();
600 
601  const int il[4][2] = {{i0, i1}, {i1, i2}, {i2, i3}, {i3, i0}};
602 
603  SVector3 nfac = normal3(xyz, i0, i1, i2);
604 
605  for(int i = 0; i < 4; i++) {
606  double x[2] = {xyz[il[i][0]][0], xyz[il[i][1]][0]};
607  double y[2] = {xyz[il[i][0]][1], xyz[il[i][1]][1]};
608  double z[2] = {xyz[il[i][0]][2], xyz[il[i][1]][2]};
609  SVector3 n[2] = {nfac, nfac};
610  unsigned int col[2] = {color, color};
611  if(opt->smoothNormals) {
612  for(int j = 0; j < 2; j++) {
613  if(pre)
614  p->normals->add(x[j], y[j], z[j], n[j][0], n[j][1], n[j][2]);
615  else
616  p->normals->get(x[j], y[j], z[j], n[j][0], n[j][1], n[j][2]);
617  }
618  }
619  getLineNormal(p, x, y, z, nullptr, n, false);
620  if(!pre) p->va_lines->add(x, y, z, n, col, nullptr, true);
621  }
622 }
623 
624 static void addScalarQuadrangle(PView *p, double **xyz, double **val, bool pre,
625  int i0 = 0, int i1 = 1, int i2 = 2, int i3 = 3,
626  bool unique = false)
627 {
628  PViewOptions *opt = p->getOptions();
629 
630  const int il[4][2] = {{i0, i1}, {i1, i2}, {i2, i3}, {i3, i0}};
631  const int it[2][3] = {{i0, i1, i2}, {i0, i2, i3}};
632 
633  if(opt->boundary > 0) {
634  opt->boundary--;
635  for(int i = 0; i < 4; i++)
636  addScalarLine(p, xyz, val, pre, il[i][0], il[i][1], true);
637  opt->boundary++;
638  return;
639  }
640 
641  for(int i = 0; i < 2; i++)
642  addScalarTriangle(p, xyz, val, pre, it[i][0], it[i][1], it[i][2], unique);
643 }
644 
645 static void addOutlinePolygon(PView *p, double **xyz, unsigned int color,
646  bool pre, int numNodes)
647 {
648  for(int i = 0; i < numNodes / 3; i++)
649  addOutlineTriangle(p, xyz, color, pre, 3 * i, 3 * i + 1, 3 * i + 2);
650 }
651 
652 static void addScalarPolygon(PView *p, double **xyz, double **val, bool pre,
653  int numNodes)
654 {
655  PViewOptions *opt = p->getOptions();
656 
657  if(opt->boundary > 0) {
658  const int il[3][2] = {{0, 1}, {1, 2}, {2, 0}};
659  std::map<MEdge, int, MEdgeLessThan> edges;
660  std::vector<MVertex *> verts;
661  verts.reserve(numNodes);
662  for(int i = 0; i < numNodes; i++)
663  verts.push_back(new MVertex(xyz[i][0], xyz[i][1], xyz[i][2]));
664  for(int i = 0; i < numNodes / 3; i++) {
665  for(int j = 0; j < 3; j++) {
666  MEdge ed(verts[3 * i + il[j][0]], verts[3 * i + il[j][1]]);
667  std::map<MEdge, int, MEdgeLessThan>::iterator ite;
668  for(ite = edges.begin(); ite != edges.end(); ite++)
669  if((*ite).first == ed) break;
670  if(ite == edges.end())
671  edges[ed] = 100 * i + j;
672  else
673  edges.erase(ite);
674  }
675  }
676 
677  opt->boundary--;
678  for(auto ite = edges.begin(); ite != edges.end(); ite++) {
679  int i = (int)(*ite).second / 100;
680  int j = (*ite).second % 100;
681  if(j < 3)
682  addScalarLine(p, xyz, val, pre, 3 * i + il[j][0], 3 * i + il[j][0],
683  true);
684  }
685  opt->boundary++;
686 
687  for(int i = 0; i < numNodes; i++) delete verts[i];
688  return;
689  }
690 
691  for(int i = 0; i < numNodes / 3; i++)
692  addScalarTriangle(p, xyz, val, pre, 3 * i, 3 * i + 1, 3 * i + 2);
693 }
694 
695 static void addOutlineTetrahedron(PView *p, double **xyz, unsigned int color,
696  bool pre)
697 {
698  const int it[4][3] = {{0, 2, 1}, {0, 1, 3}, {0, 3, 2}, {3, 1, 2}};
699  for(int i = 0; i < 4; i++)
700  addOutlineTriangle(p, xyz, color, pre, it[i][0], it[i][1], it[i][2]);
701 }
702 
703 static void addScalarTetrahedron(PView *p, double **xyz, double **val, bool pre,
704  int i0 = 0, int i1 = 1, int i2 = 2, int i3 = 3)
705 {
706  PViewOptions *opt = p->getOptions();
707 
708  const int it[4][3] = {{i0, i2, i1}, {i0, i1, i3}, {i0, i3, i2}, {i3, i1, i2}};
709 
710  if(opt->boundary > 0 || opt->intervalsType == PViewOptions::Continuous ||
712  bool skin = (opt->boundary > 0) ? false : opt->drawSkinOnly;
713  opt->boundary--;
714  for(int i = 0; i < 4; i++)
715  addScalarTriangle(p, xyz, val, pre, it[i][0], it[i][1], it[i][2], true,
716  skin);
717  opt->boundary++;
718  return;
719  }
720 
721  double vmin = opt->tmpMin, vmax = opt->tmpMax;
722  if(opt->saturateValues) saturate(4, val, vmin, vmax, i0, i1, i2, i3);
723 
724  double x[4] = {xyz[i0][0], xyz[i1][0], xyz[i2][0], xyz[i3][0]};
725  double y[4] = {xyz[i0][1], xyz[i1][1], xyz[i2][1], xyz[i3][1]};
726  double z[4] = {xyz[i0][2], xyz[i1][2], xyz[i2][2], xyz[i3][2]};
727  double v[4] = {val[i0][0], val[i1][0], val[i2][0], val[i3][0]};
728 
729  if(opt->intervalsType == PViewOptions::Iso) {
730  for(int k = 0; k < opt->nbIso; k++) {
731  if(vmin == vmax) k = opt->nbIso / 2;
732  double iso = opt->getScaleValue(k, opt->nbIso, vmin, vmax);
733  double x2[6], y2[6], z2[6], nn[3];
734  int nb = IsoSimplex(x, y, z, v, iso, x2, y2, z2, nn);
735  if(nb >= 3) {
736  unsigned int color = opt->getColor(k, opt->nbIso);
737  unsigned int col[3] = {color, color, color};
738  for(int j = 2; j < nb; j++) {
739  double x3[3] = {x2[0], x2[j - 1], x2[j]};
740  double y3[3] = {y2[0], y2[j - 1], y2[j]};
741  double z3[3] = {z2[0], z2[j - 1], z2[j]};
742  SVector3 n[3];
743  for(int i = 0; i < 3; i++) {
744  n[i][0] = nn[0];
745  n[i][1] = nn[1];
746  n[i][2] = nn[2];
747  if(opt->smoothNormals) {
748  if(pre)
749  p->normals->add(x3[i], y3[i], z3[i], n[i][0], n[i][1], n[i][2]);
750  else
751  p->normals->get(x3[i], y3[i], z3[i], n[i][0], n[i][1], n[i][2]);
752  }
753  }
754  if(!pre)
755  p->va_triangles->add(x3, y3, z3, n, col, nullptr, false, false);
756  }
757  }
758  if(vmin == vmax) break;
759  }
760  }
761 }
762 
763 static void addOutlineHexahedron(PView *p, double **xyz, unsigned int color,
764  bool pre)
765 {
766  const int iq[6][4] = {{0, 3, 2, 1}, {0, 1, 5, 4}, {0, 4, 7, 3},
767  {1, 2, 6, 5}, {2, 3, 7, 6}, {4, 5, 6, 7}};
768 
769  for(int i = 0; i < 6; i++)
770  addOutlineQuadrangle(p, xyz, color, pre, iq[i][0], iq[i][1], iq[i][2],
771  iq[i][3]);
772 }
773 
774 static void addScalarHexahedron(PView *p, double **xyz, double **val, bool pre)
775 {
776  PViewOptions *opt = p->getOptions();
777 
778  const int iq[6][4] = {{0, 3, 2, 1}, {0, 1, 5, 4}, {0, 4, 7, 3},
779  {1, 2, 6, 5}, {2, 3, 7, 6}, {4, 5, 6, 7}};
780  const int is[6][4] = {{0, 1, 3, 7}, {0, 4, 1, 7}, {1, 4, 5, 7},
781  {1, 2, 3, 7}, {1, 6, 2, 7}, {1, 5, 6, 7}};
782 
783  if(opt->boundary > 0) {
784  opt->boundary--;
785  for(int i = 0; i < 6; i++)
786  addScalarQuadrangle(p, xyz, val, pre, iq[i][0], iq[i][1], iq[i][2],
787  iq[i][3], true);
788  opt->boundary++;
789  return;
790  }
791 
792  for(int i = 0; i < 6; i++)
793  addScalarTetrahedron(p, xyz, val, pre, is[i][0], is[i][1], is[i][2],
794  is[i][3]);
795 }
796 
797 static void addOutlinePrism(PView *p, double **xyz, unsigned int color,
798  bool pre)
799 {
800  const int iq[3][4] = {{0, 1, 4, 3}, {0, 3, 5, 2}, {1, 2, 5, 4}};
801  const int it[2][3] = {{0, 2, 1}, {3, 4, 5}};
802 
803  for(int i = 0; i < 3; i++)
804  addOutlineQuadrangle(p, xyz, color, pre, iq[i][0], iq[i][1], iq[i][2],
805  iq[i][3]);
806  for(int i = 0; i < 2; i++)
807  addOutlineTriangle(p, xyz, color, pre, it[i][0], it[i][1], it[i][2]);
808 }
809 
810 static void addScalarPrism(PView *p, double **xyz, double **val, bool pre)
811 {
812  PViewOptions *opt = p->getOptions();
813  const int iq[3][4] = {{0, 1, 4, 3}, {0, 3, 5, 2}, {1, 2, 5, 4}};
814  const int it[2][3] = {{0, 2, 1}, {3, 4, 5}};
815  const int is[3][4] = {{0, 1, 2, 4}, {0, 4, 2, 5}, {0, 3, 4, 5}};
816 
817  if(opt->boundary > 0) {
818  opt->boundary--;
819  for(int i = 0; i < 3; i++)
820  addScalarQuadrangle(p, xyz, val, pre, iq[i][0], iq[i][1], iq[i][2],
821  iq[i][3], true);
822  for(int i = 0; i < 2; i++)
823  addScalarTriangle(p, xyz, val, pre, it[i][0], it[i][1], it[i][2], true);
824  opt->boundary++;
825  return;
826  }
827 
828  for(int i = 0; i < 3; i++)
829  addScalarTetrahedron(p, xyz, val, pre, is[i][0], is[i][1], is[i][2],
830  is[i][3]);
831 }
832 
833 static void addOutlinePyramid(PView *p, double **xyz, unsigned int color,
834  bool pre)
835 {
836  const int it[4][3] = {{0, 1, 4}, {3, 0, 4}, {1, 2, 4}, {2, 3, 4}};
837 
838  addOutlineQuadrangle(p, xyz, color, pre, 0, 3, 2, 1);
839  for(int i = 0; i < 4; i++)
840  addOutlineTriangle(p, xyz, color, pre, it[i][0], it[i][1], it[i][2]);
841 }
842 
843 static void addScalarPyramid(PView *p, double **xyz, double **val, bool pre)
844 {
845  PViewOptions *opt = p->getOptions();
846 
847  const int it[4][3] = {{0, 1, 4}, {3, 0, 4}, {1, 2, 4}, {2, 3, 4}};
848  const int is[2][4] = {{0, 1, 3, 4}, {1, 2, 3, 4}};
849 
850  if(opt->boundary > 0) {
851  opt->boundary--;
852  addScalarQuadrangle(p, xyz, val, pre, 0, 3, 2, 1, true);
853  for(int i = 0; i < 4; i++)
854  addScalarTriangle(p, xyz, val, pre, it[i][0], it[i][1], it[i][2], true);
855  opt->boundary++;
856  return;
857  }
858 
859  for(int i = 0; i < 2; i++)
860  addScalarTetrahedron(p, xyz, val, pre, is[i][0], is[i][1], is[i][2],
861  is[i][3]);
862 }
863 
864 static void addOutlineTrihedron(PView *p, double **xyz, unsigned int color,
865  bool pre)
866 {
867  addOutlineQuadrangle(p, xyz, color, pre, 0, 1, 2, 3);
868 }
869 
870 static void addScalarTrihedron(PView *p, double **xyz, double **val, bool pre,
871  int i0 = 0, int i1 = 1, int i2 = 2, int i3 = 3,
872  bool unique = false)
873 {
874  addScalarQuadrangle(p, xyz, val, pre, i0, i1, i2, i3, unique);
875 }
876 
877 static void addOutlinePolyhedron(PView *p, double **xyz, unsigned int color,
878  bool pre, int numNodes)
879 {
880  // FIXME: this code is horribly slow
881  const int it[4][3] = {{0, 2, 1}, {0, 1, 3}, {0, 3, 2}, {3, 1, 2}};
882  std::map<MFace, int, MFaceLessThan> triFaces;
883  std::vector<MVertex *> verts;
884  verts.reserve(numNodes);
885  for(int i = 0; i < numNodes; i++)
886  verts.push_back(new MVertex(xyz[i][0], xyz[i][1], xyz[i][2]));
887  for(int i = 0; i < numNodes / 4; i++) {
888  for(int j = 0; j < 4; j++) {
889  MFace f(verts[4 * i + it[j][0]], verts[4 * i + it[j][1]],
890  verts[4 * i + it[j][2]]);
891  std::map<MFace, int, MFaceLessThan>::iterator ite;
892  for(ite = triFaces.begin(); ite != triFaces.end(); ite++)
893  if((*ite).first == f) break;
894  if(ite == triFaces.end())
895  triFaces[f] = 100 * i + j;
896  else
897  triFaces.erase(ite);
898  }
899  }
900  for(auto ite = triFaces.begin(); ite != triFaces.end(); ite++) {
901  int i = (int)(*ite).second / 100;
902  int j = (*ite).second % 100;
903  if(j < 4)
904  addOutlineTriangle(p, xyz, color, pre, 4 * i + it[j][0], 4 * i + it[j][1],
905  4 * i + it[j][2]);
906  }
907  for(int i = 0; i < numNodes; i++) delete verts[i];
908 }
909 
910 static void addScalarPolyhedron(PView *p, double **xyz, double **val, bool pre,
911  int numNodes)
912 {
913  PViewOptions *opt = p->getOptions();
914 
915  if(opt->boundary > 0) { return; }
916 
917  for(int i = 0; i < numNodes / 4; i++)
918  addScalarTetrahedron(p, xyz, val, pre, 4 * i, 4 * i + 1, 4 * i + 2,
919  4 * i + 3);
920 }
921 
922 static void addOutlineElement(PView *p, int type, double **xyz, bool pre,
923  int numNodes)
924 {
925  PViewOptions *opt = p->getOptions();
926  switch(type) {
927  case TYPE_PNT: addOutlinePoint(p, xyz, opt->color.point, pre); break;
928  case TYPE_LIN: addOutlineLine(p, xyz, opt->color.line, pre); break;
929  case TYPE_TRI: addOutlineTriangle(p, xyz, opt->color.triangle, pre); break;
930  case TYPE_QUA:
931  addOutlineQuadrangle(p, xyz, opt->color.quadrangle, pre);
932  break;
933  case TYPE_POLYG:
934  addOutlinePolygon(p, xyz, opt->color.quadrangle, pre, numNodes);
935  break;
936  case TYPE_TET:
937  addOutlineTetrahedron(p, xyz, opt->color.tetrahedron, pre);
938  break;
939  case TYPE_HEX:
940  addOutlineHexahedron(p, xyz, opt->color.hexahedron, pre);
941  break;
942  case TYPE_PRI: addOutlinePrism(p, xyz, opt->color.prism, pre); break;
943  case TYPE_PYR: addOutlinePyramid(p, xyz, opt->color.pyramid, pre); break;
944  case TYPE_TRIH: addOutlineTrihedron(p, xyz, opt->color.pyramid, pre); break;
945  case TYPE_POLYH:
946  addOutlinePolyhedron(p, xyz, opt->color.pyramid, pre, numNodes);
947  break;
948  }
949 }
950 
951 static void addScalarElement(PView *p, int type, double **xyz, double **val,
952  bool pre, int numNodes)
953 {
954  switch(type) {
955  case TYPE_PNT: addScalarPoint(p, xyz, val, pre); break;
956  case TYPE_LIN: addScalarLine(p, xyz, val, pre); break;
957  case TYPE_TRI: addScalarTriangle(p, xyz, val, pre); break;
958  case TYPE_QUA: addScalarQuadrangle(p, xyz, val, pre); break;
959  case TYPE_POLYG: addScalarPolygon(p, xyz, val, pre, numNodes); break;
960  case TYPE_TET: addScalarTetrahedron(p, xyz, val, pre); break;
961  case TYPE_HEX: addScalarHexahedron(p, xyz, val, pre); break;
962  case TYPE_PRI: addScalarPrism(p, xyz, val, pre); break;
963  case TYPE_PYR: addScalarPyramid(p, xyz, val, pre); break;
964  case TYPE_TRIH: addScalarTrihedron(p, xyz, val, pre); break;
965  case TYPE_POLYH: addScalarPolyhedron(p, xyz, val, pre, numNodes); break;
966  }
967 }
968 
969 static void addVectorElement(PView *p, int ient, int iele, int numNodes,
970  int type, double **xyz, double **val, bool pre)
971 {
972  // use adaptive data if available
973  PViewData *data = p->getData(true);
974  PViewOptions *opt = p->getOptions();
975 
976  int numComp2;
977  double **val2 = new double *[numNodes];
978  for(int i = 0; i < numNodes; i++) val2[i] = new double[9];
979  getExternalValues(p, opt->externalViewIndex, ient, iele, numNodes, 3, val,
980  numComp2, val2);
981 
983  for(int i = 0; i < numNodes; i++)
984  val2[i][0] = ComputeScalarRep(numComp2, val2[i]);
985 
986  // add scalar element with correct min/max
987  double min = opt->tmpMin, max = opt->tmpMax;
988  opt->tmpMin = opt->externalMin;
989  opt->tmpMax = opt->externalMax;
990  addScalarElement(p, type, xyz, val2, pre, numNodes);
991  opt->tmpMin = min;
992  opt->tmpMax = max;
993 
994  // add point trajectories
995  // FIXME: this should be optional
996  if(!pre && numNodes == 1 && opt->timeStep > 0 && opt->lineWidth) {
997  for(int ts = 0; ts < opt->timeStep; ts++) {
998  if(!data->hasTimeStep(ts)) continue;
999  int numComp = data->getNumComponents(ts, ient, iele);
1000  double xyz0[3], dxyz[3][2] = {{0., 0.}, {0., 0.}, {0., 0.}};
1001  data->getNode(ts, ient, iele, 0, xyz0[0], xyz0[1], xyz0[2]);
1002  for(int j = 0; j < 3; j++) {
1003  int comp = opt->forceNumComponents ? opt->componentMap[j] : j;
1004  if(comp >= 0 && comp < numComp) {
1005  data->getValue(ts, ient, iele, 0, comp, dxyz[j][0]);
1006  data->getValue(ts + 1, ient, iele, 0, comp, dxyz[j][1]);
1007  }
1008  }
1009  unsigned int col[2];
1010  double norm[2];
1011  for(int i = 0; i < 2; i++) {
1012  norm[i] = sqrt(dxyz[0][i] * dxyz[0][i] + dxyz[1][i] * dxyz[1][i] +
1013  dxyz[2][i] * dxyz[2][i]);
1014  col[i] = opt->getColor(norm[i], opt->tmpMin, opt->tmpMax);
1015  }
1016  for(int j = 0; j < 3; j++) {
1017  dxyz[j][0] = xyz0[j] + dxyz[j][0] * opt->displacementFactor;
1018  dxyz[j][1] = xyz0[j] + dxyz[j][1] * opt->displacementFactor;
1019  }
1020  SVector3 n[2];
1021  getLineNormal(p, dxyz[0], dxyz[1], dxyz[2], norm, n, true);
1022  p->va_lines->add(dxyz[0], dxyz[1], dxyz[2], n, col, nullptr, false);
1023  }
1024  }
1025  for(int i = 0; i < numNodes; i++) delete[] val2[i];
1026  delete[] val2;
1027  return;
1028  }
1029 
1030  if(pre) {
1031  for(int i = 0; i < numNodes; i++) delete[] val2[i];
1032  delete[] val2;
1033  return;
1034  }
1035 
1036  if(opt->glyphLocation == PViewOptions::Vertex) {
1037  for(int i = 0; i < numNodes; i++) {
1038  double v2 = opt->saturateValues ?
1039  saturateVector(val[i], numComp2, val2[i], opt->externalMin,
1040  opt->externalMax) :
1041  ComputeScalarRep(numComp2, val2[i]);
1042  if(v2 >= opt->externalMin && v2 <= opt->externalMax) {
1043  unsigned int color = opt->getColor(
1044  v2, opt->externalMin, opt->externalMax, false,
1045  (opt->intervalsType == PViewOptions::Discrete) ? opt->nbIso : -1);
1046  unsigned int col[2] = {color, color};
1047  double dxyz[3][2];
1048  for(int j = 0; j < 3; j++) {
1049  dxyz[j][0] = xyz[i][j];
1050  dxyz[j][1] = val[i][j];
1051  }
1052  p->va_vectors->add(dxyz[0], dxyz[1], dxyz[2], nullptr, col, nullptr,
1053  false);
1054  }
1055  }
1056  }
1057 
1058  if(opt->glyphLocation == PViewOptions::COG) {
1059  // compute value by averaging the norm and averaging the directions (this
1060  // allows to preserve the min/max)
1061  SPoint3 pc(0., 0., 0.);
1062  double d[3] = {0., 0., 0.};
1063  double v2 = 0.;
1064  for(int i = 0; i < numNodes; i++) {
1065  pc += SPoint3(xyz[i][0], xyz[i][1], xyz[i][2]);
1066  v2 += opt->saturateValues ?
1067  saturateVector(val[i], numComp2, val2[i], opt->externalMin,
1068  opt->externalMax) :
1069  ComputeScalarRep(numComp2, val2[i]);
1070  for(int j = 0; j < 3; j++) d[j] += val[i][j];
1071  }
1072  pc /= (double)numNodes;
1073  v2 /= (double)numNodes;
1074  norme(d);
1075  for(int i = 0; i < 3; i++) d[i] *= v2;
1076 
1077  // need tolerance since we compare computed results (the average)
1078  // instead of the raw data used to compute bounds
1079  if(v2 >= opt->externalMin * (1. - 1.e-15) &&
1080  v2 <= opt->externalMax * (1. + 1.e-15)) {
1081  unsigned int color = opt->getColor(
1082  v2, opt->externalMin, opt->externalMax, false,
1083  (opt->intervalsType == PViewOptions::Discrete) ? opt->nbIso : -1);
1084  unsigned int col[2] = {color, color};
1085  double dxyz[3][2];
1086  for(int i = 0; i < 3; i++) {
1087  dxyz[i][0] = pc[i];
1088  dxyz[i][1] = d[i];
1089  }
1090  p->va_vectors->add(dxyz[0], dxyz[1], dxyz[2], nullptr, col, nullptr,
1091  false);
1092  }
1093  }
1094  for(int i = 0; i < numNodes; i++) delete[] val2[i];
1095  delete[] val2;
1096 }
1097 
1098 static void addTriangle(PView *p, PViewOptions *opt, double *x0, double *x1,
1099  double *x2, SPoint3 &xx, double val)
1100 {
1101  unsigned int color = opt->getColor(
1102  val, opt->tmpMin, opt->tmpMax, false,
1103  (opt->intervalsType == PViewOptions::Discrete) ? opt->nbIso : -1);
1104 
1105  SVector3 a(x1[0] - x0[0], x1[1] - x0[1], x1[2] - x0[2]);
1106  SVector3 b(x2[0] - x0[0], x2[1] - x0[1], x2[2] - x0[2]);
1107  SVector3 c(xx.x() - x0[0], xx.y() - x0[1], xx.z() - x0[2]);
1108  SVector3 N = crossprod(a, b);
1109  unsigned int col[3] = {color, color, color};
1110  N.normalize();
1111  if(dot(c, N) > 0) {
1112  double XX[3] = {x0[0], x1[0], x2[0]};
1113  double YY[3] = {x0[1], x1[1], x2[1]};
1114  double ZZ[3] = {x0[2], x1[2], x2[2]};
1115  SVector3 NN[3] = {N, N, N};
1116  p->va_triangles->add(XX, YY, ZZ, NN, col, nullptr, false);
1117  }
1118  else {
1119  double XX[3] = {x1[0], x0[0], x2[0]};
1120  double YY[3] = {x1[1], x0[1], x2[1]};
1121  double ZZ[3] = {x1[2], x0[2], x2[2]};
1122  SVector3 NN[3] = {-N, -N, -N};
1123  p->va_triangles->add(XX, YY, ZZ, NN, col, nullptr, false);
1124  }
1125 }
1126 
1127 static void addTensorElement(PView *p, int iEnt, int iEle, int numNodes,
1128  int type, double **xyz, double **val, bool pre)
1129 {
1130  PViewOptions *opt = p->getOptions();
1131  fullMatrix<double> tensor(3, 3);
1132  fullVector<double> S(3), imS(3);
1133  fullMatrix<double> leftV(3, 3), rightV(3, 3);
1134 
1135  if(opt->tensorType == PViewOptions::VonMises) {
1136  for(int i = 0; i < numNodes; i++) val[i][0] = ComputeVonMises(val[i]);
1137  addScalarElement(p, type, xyz, val, pre, numNodes);
1138  }
1139 
1140  else if(opt->tensorType == PViewOptions::Frame) {
1141  if(opt->glyphLocation == PViewOptions::Vertex) {
1142  for(int i = 0; i < numNodes; i++) {
1143  double d0[3], d1[3], d2[3];
1144  double nrm = sqrt(val[i][0] * val[i][0] + val[i][1] * val[i][1] +
1145  val[i][2] * val[i][2]);
1146 
1147  for(int j = 0; j < 3; j++) {
1148  d0[j] = opt->displacementFactor * val[i][j + 0 * 3] / nrm;
1149  d1[j] = opt->displacementFactor * val[i][j + 1 * 3] / nrm;
1150  d2[j] = opt->displacementFactor * val[i][j + 2 * 3] / nrm;
1151  }
1152  double x = xyz[i][0];
1153  double y = xyz[i][1];
1154  double z = xyz[i][2];
1155 
1156  SPoint3 xx(x, y, z);
1157  double x0[3] = {x + d0[0] + d1[0] + d2[0], y + d0[1] + d1[1] + d2[1],
1158  z + d0[2] + d1[2] + d2[2]};
1159  double x1[3] = {x - d0[0] + d1[0] + d2[0], y - d0[1] + d1[1] + d2[1],
1160  z - d0[2] + d1[2] + d2[2]};
1161  double x2[3] = {x - d0[0] - d1[0] + d2[0], y - d0[1] - d1[1] + d2[1],
1162  z - d0[2] - d1[2] + d2[2]};
1163  double x3[3] = {x + d0[0] - d1[0] + d2[0], y + d0[1] - d1[1] + d2[1],
1164  z + d0[2] - d1[2] + d2[2]};
1165 
1166  double x4[3] = {x + d0[0] + d1[0] - d2[0], y + d0[1] + d1[1] - d2[1],
1167  z + d0[2] + d1[2] - d2[2]};
1168  double x5[3] = {x - d0[0] + d1[0] - d2[0], y - d0[1] + d1[1] - d2[1],
1169  z - d0[2] + d1[2] - d2[2]};
1170  double x6[3] = {x - d0[0] - d1[0] - d2[0], y - d0[1] - d1[1] - d2[1],
1171  z - d0[2] - d1[2] - d2[2]};
1172  double x7[3] = {x + d0[0] - d1[0] - d2[0], y + d0[1] - d1[1] - d2[1],
1173  z + d0[2] - d1[2] - d2[2]};
1174 
1175  if((nrm > opt->tmpMin && opt->tmpMax) || opt->saturateValues) {
1176  addTriangle(p, opt, x0, x1, x2, xx, nrm);
1177  addTriangle(p, opt, x2, x3, x0, xx, nrm);
1178  addTriangle(p, opt, x4, x7, x6, xx, nrm);
1179  addTriangle(p, opt, x6, x5, x4, xx, nrm);
1180  addTriangle(p, opt, x0, x3, x7, xx, nrm);
1181  addTriangle(p, opt, x7, x4, x0, xx, nrm);
1182  addTriangle(p, opt, x1, x5, x6, xx, nrm);
1183  addTriangle(p, opt, x6, x2, x1, xx, nrm);
1184  addTriangle(p, opt, x0, x4, x5, xx, nrm);
1185  addTriangle(p, opt, x5, x1, x0, xx, nrm);
1186  addTriangle(p, opt, x3, x2, x6, xx, nrm);
1187  addTriangle(p, opt, x6, x7, x3, xx, nrm);
1188  }
1189  }
1190  }
1191  }
1192  else if(opt->tensorType == PViewOptions::Ellipse ||
1194  if(opt->glyphLocation == PViewOptions::Vertex) {
1195  double vval[3][4] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
1196  for(int i = 0; i < numNodes; i++) {
1197  for(int j = 0; j < 3; j++) {
1198  tensor(j, 0) = val[i][0 + j * 3];
1199  tensor(j, 1) = val[i][1 + j * 3];
1200  tensor(j, 2) = val[i][2 + j * 3];
1201  }
1202  tensor.eig(S, imS, leftV, rightV, false);
1203  for(int k = 0; k < 3; k++) {
1204  vval[k][0] = xyz[i][k];
1205  for(int j = 0; j < 3; j++) { vval[k][j + 1] = rightV(k, j) * S(j); }
1206  }
1207  double lmax = std::max(S(0), std::max(S(1), S(2)));
1208  unsigned int color = opt->getColor(
1209  lmax, opt->tmpMin, opt->tmpMax, false,
1210  (opt->intervalsType == PViewOptions::Discrete) ? opt->nbIso : -1);
1211  unsigned int col[4] = {color, color, color, color};
1212  p->va_ellipses->add(vval[0], vval[1], vval[2], nullptr, col, nullptr,
1213  false);
1214  }
1215  }
1216  else if(opt->glyphLocation == PViewOptions::COG) {
1217  double vval[3][4] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
1218  for(int i = 0; i < numNodes; i++) {
1219  for(int j = 0; j < 3; j++) {
1220  tensor(j, 0) = val[i][0 + j * 3];
1221  tensor(j, 1) = val[i][1 + j * 3];
1222  tensor(j, 2) = val[i][2 + j * 3];
1223  }
1224  tensor.eig(S, imS, leftV, rightV, false);
1225  for(int j = 0; j < 3; j++) {
1226  vval[0][j + 1] += rightV(0, j) * S(j) / numNodes;
1227  vval[1][j + 1] += rightV(1, j) * S(j) / numNodes;
1228  vval[2][j + 1] += rightV(2, j) * S(j) / numNodes;
1229  }
1230  vval[0][0] += xyz[i][0] / numNodes;
1231  vval[1][0] += xyz[i][1] / numNodes;
1232  vval[2][0] += xyz[i][2] / numNodes;
1233  }
1234  double lmax = std::max(S(0), std::max(S(1), S(2)));
1235  unsigned int color = opt->getColor(
1236  lmax, opt->tmpMin, opt->tmpMax, false,
1237  (opt->intervalsType == PViewOptions::Discrete) ? opt->nbIso : -1);
1238  unsigned int col[4] = {color, color, color, color};
1239  p->va_ellipses->add(vval[0], vval[1], vval[2], nullptr, col, nullptr,
1240  false);
1241  }
1242  }
1243  else {
1244  double **vval[3] = {new double *[numNodes], new double *[numNodes],
1245  new double *[numNodes]};
1246  for(int i = 0; i < 3; i++)
1247  for(int j = 0; j < numNodes; j++) vval[i][j] = new double[3];
1248  for(int i = 0; i < numNodes; i++) {
1249  for(int j = 0; j < 3; j++) {
1250  tensor(j, 0) = val[i][0 + j * 3];
1251  tensor(j, 1) = val[i][1 + j * 3];
1252  tensor(j, 2) = val[i][2 + j * 3];
1253  }
1254  tensor.eig(S, imS, leftV, rightV,
1257  val[i][0] = S(0);
1258  else if(PViewOptions::MaxEigenValue == opt->tensorType)
1259  val[i][0] = S(2);
1260  else if(PViewOptions::EigenVectors == opt->tensorType) {
1261  for(int j = 0; j < 3; j++) {
1262  vval[0][i][j] = rightV(j, 0) * S(0);
1263  vval[1][i][j] = rightV(j, 1) * S(1);
1264  vval[2][i][j] = rightV(j, 2) * S(2);
1265  }
1266  }
1267  }
1268 
1270  addVectorElement(p, iEnt, iEle, numNodes, type, xyz, vval[0], pre);
1271  addVectorElement(p, iEnt, iEle, numNodes, type, xyz, vval[1], pre);
1272  addVectorElement(p, iEnt, iEle, numNodes, type, xyz, vval[2], pre);
1273  }
1274  else
1275  addScalarElement(p, type, xyz, val, pre, numNodes);
1276  for(int i = 0; i < 3; i++) {
1277  for(int j = 0; j < numNodes; j++) delete[] vval[i][j];
1278  delete[] vval[i];
1279  }
1280  }
1281 }
1282 
1283 static void addElementsInArrays(PView *p, bool preprocessNormalsOnly)
1284 {
1285  static int numNodesError = 0, numCompError = 0;
1286 
1287  // use adaptive data if available
1288  PViewData *data = p->getData(true);
1289  PViewOptions *opt = p->getOptions();
1290 
1291  opt->tmpBBox.reset();
1292 
1293  int NMAX = PVIEW_NMAX;
1294  double **xyz = new double *[NMAX];
1295  double **val = new double *[NMAX];
1296  for(int i = 0; i < NMAX; i++) {
1297  xyz[i] = new double[3];
1298  val[i] = new double[9];
1299  }
1300  for(int ent = 0; ent < data->getNumEntities(opt->timeStep); ent++) {
1301  if(data->skipEntity(opt->timeStep, ent)) continue;
1302  for(int i = 0; i < data->getNumElements(opt->timeStep, ent); i++) {
1303  if(data->skipElement(opt->timeStep, ent, i, true, opt->sampling))
1304  continue;
1305  int type = data->getType(opt->timeStep, ent, i);
1306  if(opt->skipElement(type)) continue;
1307  int numComp = data->getNumComponents(opt->timeStep, ent, i);
1308  int numNodes = data->getNumNodes(opt->timeStep, ent, i);
1309  if(numNodes > PVIEW_NMAX) {
1310  if(type == TYPE_POLYG || type == TYPE_POLYH) {
1311  if(numNodes > NMAX) {
1312  for(int j = 0; j < NMAX; j++) {
1313  delete[] xyz[j];
1314  delete[] val[j];
1315  }
1316  delete[] xyz;
1317  delete[] val;
1318  NMAX = numNodes;
1319  xyz = new double *[NMAX];
1320  val = new double *[NMAX];
1321  for(int j = 0; j < NMAX; j++) {
1322  xyz[j] = new double[3];
1323  val[j] = new double[9];
1324  }
1325  }
1326  }
1327  else {
1328  if(numNodesError != numNodes) {
1329  numNodesError = numNodes;
1330  Msg::Warning(
1331  "Fields with %d nodes per element cannot be displayed: "
1332  "either force the field type or select 'Adapt visualization "
1333  "grid' if the field is high-order",
1334  numNodes);
1335  }
1336  continue;
1337  }
1338  }
1339  if((numComp > 9 && !opt->forceNumComponents) ||
1340  opt->forceNumComponents > 9) {
1341  if(numCompError != numComp) {
1342  numCompError = numComp;
1343  Msg::Warning(
1344  "Fields with %d components cannot be displayed: "
1345  "either force the field type or select 'Adapt visualization "
1346  "grid' if the field is high-order",
1347  numComp);
1348  }
1349  continue;
1350  }
1351  for(int j = 0; j < numNodes; j++) {
1352  data->getNode(opt->timeStep, ent, i, j, xyz[j][0], xyz[j][1],
1353  xyz[j][2]);
1354  if(opt->forceNumComponents) {
1355  for(int k = 0; k < opt->forceNumComponents; k++) {
1356  int comp = opt->componentMap[k];
1357  if(comp >= 0 && comp < numComp)
1358  data->getValue(opt->timeStep, ent, i, j, comp, val[j][k]);
1359  else
1360  val[j][k] = 0.;
1361  }
1362  }
1363  else
1364  for(int k = 0; k < numComp; k++)
1365  data->getValue(opt->timeStep, ent, i, j, k, val[j][k]);
1366  }
1367  if(opt->forceNumComponents) numComp = opt->forceNumComponents;
1368 
1369  changeCoordinates(p, ent, i, numNodes, type, numComp, xyz, val);
1370  int dim = data->getDimension(opt->timeStep, ent, i);
1371  if(!isElementVisible(opt, dim, numNodes, xyz)) continue;
1372 
1373  for(int j = 0; j < numNodes; j++)
1374  opt->tmpBBox += SPoint3(xyz[j][0], xyz[j][1], xyz[j][2]);
1375 
1376  if(opt->showElement && !data->useGaussPoints())
1377  addOutlineElement(p, type, xyz, preprocessNormalsOnly, numNodes);
1378 
1379  if(opt->intervalsType != PViewOptions::Numeric) {
1380  if(data->useGaussPoints()) {
1381  for(int j = 0; j < numNodes; j++) {
1382  double *x2 = new double[3];
1383  double **xyz2 = &x2;
1384  double *v2 = new double[9];
1385  double **val2 = &v2;
1386  xyz2[0][0] = xyz[j][0];
1387  xyz2[0][1] = xyz[j][1];
1388  xyz2[0][2] = xyz[j][2];
1389  for(int k = 0; k < numComp; k++) val2[0][k] = val[j][k];
1390  if(numComp == 1 && opt->drawScalars)
1391  addScalarElement(p, TYPE_PNT, xyz2, val2, preprocessNormalsOnly,
1392  numNodes);
1393  else if(numComp == 3 && opt->drawVectors)
1394  addVectorElement(p, ent, i, 1, TYPE_PNT, xyz2, val2,
1395  preprocessNormalsOnly);
1396  else if(numComp == 9 && opt->drawTensors)
1397  addTensorElement(p, ent, i, 1, TYPE_PNT, xyz2, val2,
1398  preprocessNormalsOnly);
1399  delete[] x2;
1400  delete[] v2;
1401  }
1402  }
1403  else if(numComp == 1 && opt->drawScalars)
1404  addScalarElement(p, type, xyz, val, preprocessNormalsOnly, numNodes);
1405  else if(numComp == 3 && opt->drawVectors)
1406  addVectorElement(p, ent, i, numNodes, type, xyz, val,
1407  preprocessNormalsOnly);
1408  else if(numComp == 9 && opt->drawTensors)
1409  addTensorElement(p, ent, i, numNodes, type, xyz, val,
1410  preprocessNormalsOnly);
1411  }
1412  }
1413  }
1414  for(int j = 0; j < NMAX; j++) {
1415  delete[] xyz[j];
1416  delete[] val[j];
1417  }
1418  delete[] xyz;
1419  delete[] val;
1420 }
1421 
1422 class initPView {
1423 private:
1424  // we try to estimate how many primitives will end up in the vertex
1425  // arrays, since reallocating the arrays takes a huge amount of time
1426  // on Windows/Cygwin
1427  int _estimateIfClipped(PView *p, int num)
1428  {
1429  if(CTX::instance()->clipWholeElements &&
1430  CTX::instance()->clipOnlyDrawIntersectingVolume) {
1431  PViewOptions *opt = p->getOptions();
1432  for(int clip = 0; clip < 6; clip++) {
1433  if(opt->clip & (1 << clip)) return (int)sqrt((double)num);
1434  }
1435  }
1436  return num;
1437  }
1439  {
1440  PViewData *data = p->getData(true);
1441  PViewOptions *opt = p->getOptions();
1442  int heuristic = data->getNumPoints(opt->timeStep);
1443  return heuristic + 10000;
1444  }
1446  {
1447  PViewData *data = p->getData(true);
1448  PViewOptions *opt = p->getOptions();
1449  int heuristic = data->getNumLines(opt->timeStep);
1450  return heuristic + 10000;
1451  }
1453  {
1454  PViewData *data = p->getData(true);
1455  PViewOptions *opt = p->getOptions();
1456  int tris = data->getNumTriangles(opt->timeStep);
1457  int quads = data->getNumQuadrangles(opt->timeStep);
1458  int polygs = data->getNumPolygons(opt->timeStep);
1459  int tets = data->getNumTetrahedra(opt->timeStep);
1460  int prisms = data->getNumPrisms(opt->timeStep);
1461  int pyrs = data->getNumPyramids(opt->timeStep);
1462  int trihs = data->getNumTrihedra(opt->timeStep);
1463  int hexas = data->getNumHexahedra(opt->timeStep);
1464  int polyhs = data->getNumPolyhedra(opt->timeStep);
1465  int heuristic = 0;
1466  if(opt->intervalsType == PViewOptions::Iso)
1467  heuristic = (tets + prisms + pyrs + hexas + polyhs) / 10;
1468  else if(opt->intervalsType == PViewOptions::Continuous)
1469  heuristic = (tris + 2 * quads + 3 * polygs + 6 * tets + 8 * prisms +
1470  6 * pyrs + 2 * trihs + 12 * hexas + 10 * polyhs);
1471  else if(opt->intervalsType == PViewOptions::Discrete)
1472  heuristic = (tris + 2 * quads + 3 * polygs + 6 * tets + 8 * prisms +
1473  6 * pyrs + 2 * trihs + 12 * hexas + 10 * polyhs) *
1474  2;
1475  heuristic = _estimateIfClipped(p, heuristic);
1476  return heuristic + 10000;
1477  }
1479  {
1480  PViewData *data = p->getData(true);
1481  PViewOptions *opt = p->getOptions();
1482  int heuristic = data->getNumVectors(opt->timeStep);
1483  heuristic = _estimateIfClipped(p, heuristic);
1484  return heuristic + 1000;
1485  }
1487  {
1488  PViewData *data = p->getData(true);
1489  PViewOptions *opt = p->getOptions();
1490  int heuristic = data->getNumTensors(opt->timeStep);
1491  heuristic = _estimateIfClipped(p, heuristic);
1492  return heuristic + 1000;
1493  }
1494 
1495 public:
1497  {
1498  // use adaptive data if available
1499  PViewData *data = p->getData(true);
1500  PViewOptions *opt = p->getOptions();
1501 
1502  if(data->getDirty() || !data->getNumTimeSteps() || !p->getChanged())
1503  return false;
1504  if(!opt->visible || opt->type != PViewOptions::Plot3D) return false;
1505 
1506  p->deleteVertexArrays();
1507 
1508  if(data->isRemote()) {
1509  // FIXME: need to rewrite option code and add nice serialization
1510  std::string fileName =
1512  PrintOptions(0, GMSH_FULLRC, 0, 0, fileName.c_str());
1513  std::string options = ConvertFileToString(fileName);
1514  data->fillRemoteVertexArrays(options);
1515  return false;
1516  }
1517 
1518  if(opt->useGenRaise) opt->createGeneralRaise();
1519 
1520  if(opt->rangeType == PViewOptions::Custom) {
1521  opt->tmpMin = opt->customMin;
1522  opt->tmpMax = opt->customMax;
1523  }
1524  else if(opt->rangeType == PViewOptions::PerTimeStep) {
1525  opt->tmpMin = data->getMin(opt->timeStep);
1526  opt->tmpMax = data->getMax(opt->timeStep);
1527  }
1528  else {
1529  // FIXME: this is not perfect for multi-step adaptive views, as
1530  // we don't have the correct min/max info for the other steps
1531  opt->tmpMin = data->getMin();
1532  opt->tmpMax = data->getMax();
1533  }
1534 
1535  p->va_points = new VertexArray(1, _estimateNumPoints(p));
1536  p->va_lines = new VertexArray(2, _estimateNumLines(p));
1538  p->va_vectors = new VertexArray(2, _estimateNumVectors(p));
1540 
1541  if(p->normals) delete p->normals;
1542 
1543  p->normals = new smooth_normals(opt->angleSmoothNormals);
1544 
1545  if(opt->smoothNormals) addElementsInArrays(p, true);
1546  addElementsInArrays(p, false);
1547 
1548  p->va_points->finalize();
1549  p->va_lines->finalize();
1550  p->va_triangles->finalize();
1551  p->va_vectors->finalize();
1552  p->va_ellipses->finalize();
1553 
1554  Msg::Debug(
1555  "%d vertices in vertex arrays (%g Mb)",
1561  p->va_ellipses->getMemoryInMb());
1562 
1563  p->setChanged(false);
1564  return true;
1565  }
1566 };
1567 
1569 {
1570  initPView init;
1571  return init(this);
1572 }
1573 
1575  const char *bytes, int swap)
1576 {
1577  std::string name;
1578  int tag, type, numSteps;
1579  double min, max, time, xmin, ymin, zmin, xmax, ymax, zmax;
1580  if(!VertexArray::decodeHeader(length, bytes, swap, name, tag, type, min, max,
1581  numSteps, time, xmin, ymin, zmin, xmax, ymax,
1582  zmax))
1583  return;
1584 
1585  Msg::Debug("Filling vertex array (type %d) in view tag %d", type, tag);
1586 
1587  SBoundingBox3d bbox(xmin, ymin, zmin, xmax, ymax, zmax);
1588 
1589  PView *p = PView::getViewByTag(tag);
1590  if(!p) {
1591  Msg::Info("View tag %d does not exist: creating new view", tag);
1592  PViewData *data =
1593  new PViewDataRemote(remote, min, max, numSteps, time, bbox);
1594  data->setName(name + " (remote)");
1595  p = new PView(data, tag);
1596  SetBoundingBox();
1597  }
1598  else {
1599  PViewDataRemote *data = dynamic_cast<PViewDataRemote *>(p->getData());
1600  if(data) {
1601  data->setMin(min);
1602  data->setMax(max);
1603  data->setTime(time);
1604  data->setBoundingBox(bbox);
1605  }
1606  }
1607  // not perfect (does not take transformations into account)
1608  p->getOptions()->tmpBBox = bbox;
1609 
1610  switch(type) {
1611  case 1:
1612  if(p->va_points) delete p->va_points;
1613  p->va_points = new VertexArray(1, 100);
1614  p->va_points->fromChar(length, bytes, swap);
1615  break;
1616  case 2:
1617  if(p->va_lines) delete p->va_lines;
1618  p->va_lines = new VertexArray(2, 100);
1619  p->va_lines->fromChar(length, bytes, swap);
1620  break;
1621  case 3:
1622  if(p->va_triangles) delete p->va_triangles;
1623  p->va_triangles = new VertexArray(3, 100);
1624  p->va_triangles->fromChar(length, bytes, swap);
1625  break;
1626  case 4:
1627  if(p->va_vectors) delete p->va_vectors;
1628  p->va_vectors = new VertexArray(2, 100);
1629  p->va_vectors->fromChar(length, bytes, swap);
1630  break;
1631  case 5:
1632  if(p->va_ellipses) delete p->va_ellipses;
1633  p->va_ellipses = new VertexArray(4, 100);
1634  p->va_ellipses->fromChar(length, bytes, swap);
1635  break;
1636  default: Msg::Error("Cannot fill vertex array of type %d", type); return;
1637  }
1638 
1639  p->setChanged(false);
1640  p->getData()->setDirty(false);
1641 }
addOutlinePrism
static void addOutlinePrism(PView *p, double **xyz, unsigned int color, bool pre)
Definition: PViewVertexArrays.cpp:797
PViewOptions::timeStep
int timeStep
Definition: PViewOptions.h:61
crossprod
SVector3 crossprod(const SVector3 &a, const SVector3 &b)
Definition: SVector3.h:150
PViewData::getNumPolygons
virtual int getNumPolygons(int step=-1)
Definition: PViewData.h:118
PViewOptions::externalMin
double externalMin
Definition: PViewOptions.h:47
addOutlineHexahedron
static void addOutlineHexahedron(PView *p, double **xyz, unsigned int color, bool pre)
Definition: PViewVertexArrays.cpp:763
PView::va_points
VertexArray * va_points
Definition: PView.h:156
PViewOptions::lineWidth
double lineWidth
Definition: PViewOptions.h:69
PViewData::getNumLines
virtual int getNumLines(int step=-1)
Definition: PViewData.h:115
PViewOptions::tensorType
int tensorType
Definition: PViewOptions.h:60
PView
Definition: PView.h:27
PViewOptions::EigenVectors
@ EigenVectors
Definition: PViewOptions.h:31
PViewData::getNumPyramids
virtual int getNumPyramids(int step=-1)
Definition: PViewData.h:122
MEdge
Definition: MEdge.h:14
addOutlinePolygon
static void addOutlinePolygon(PView *p, double **xyz, unsigned int color, bool pre, int numNodes)
Definition: PViewVertexArrays.cpp:645
dot
double dot(const SVector3 &a, const SMetric3 &m, const SVector3 &b)
Definition: STensor3.h:71
VertexArray::fromChar
void fromChar(int length, const char *bytes, int swap)
Definition: VertexArray.cpp:313
PViewData::skipElement
virtual bool skipElement(int step, int ent, int ele, bool checkVisibility=false, int samplingRate=1)
Definition: PViewData.cpp:90
addOutlineTrihedron
static void addOutlineTrihedron(PView *p, double **xyz, unsigned int color, bool pre)
Definition: PViewVertexArrays.cpp:864
PViewOptions::useGenRaise
int useGenRaise
Definition: PViewOptions.h:74
PVIEW_NMAX
#define PVIEW_NMAX
Definition: PView.h:179
fullVector< double >
mathEvaluator.h
TYPE_LIN
#define TYPE_LIN
Definition: GmshDefines.h:65
PViewOptions::drawScalars
int drawScalars
Definition: PViewOptions.h:67
getExternalValues
static bool getExternalValues(PView *p, int index, int ient, int iele, int numNodes, int numComp, double **val, int &numComp2, double **val2)
Definition: PViewVertexArrays.cpp:133
VertexArray::getMemoryInMb
double getMemoryInMb()
Definition: VertexArray.cpp:34
addScalarElement
static void addScalarElement(PView *p, int type, double **xyz, double **val, bool pre, int numNodes)
Definition: PViewVertexArrays.cpp:951
CTX::homeDir
std::string homeDir
Definition: Context.h:147
Msg::Info
static void Info(const char *fmt,...)
Definition: GmshMessage.cpp:587
PViewOptions::genRaiseFactor
double genRaiseFactor
Definition: PViewOptions.h:75
PViewData::getNumTimeSteps
virtual int getNumTimeSteps()=0
Msg::Debug
static void Debug(const char *fmt,...)
Definition: GmshMessage.cpp:752
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
addScalarPolygon
static void addScalarPolygon(PView *p, double **xyz, double **val, bool pre, int numNodes)
Definition: PViewVertexArrays.cpp:652
PViewOptions::normalRaise
double normalRaise
Definition: PViewOptions.h:50
MVertex
Definition: MVertex.h:24
PViewOptions::skipElement
bool skipElement(int type)
Definition: PViewOptions.cpp:139
Msg::Warning
static void Warning(const char *fmt,...)
Definition: GmshMessage.cpp:543
isElementVisible
bool isElementVisible(PViewOptions *opt, int dim, int numNodes, double **xyz)
Definition: PViewVertexArrays.cpp:292
PViewData::getNode
virtual int getNode(int step, int ent, int ele, int nod, double &x, double &y, double &z)
Definition: PViewData.h:141
Msg::Error
static void Error(const char *fmt,...)
Definition: GmshMessage.cpp:482
PViewOptions::sampling
int sampling
Definition: PViewOptions.h:82
PViewOptions::tmpMax
double tmpMax
Definition: PViewOptions.h:47
VertexArray.h
ConvertFileToString
std::string ConvertFileToString(const std::string &fileName)
Definition: StringUtils.cpp:119
SPoint3
Definition: SPoint3.h:14
LegendrePolynomials::f
void f(int n, double u, double *val)
Definition: orthogonalBasis.cpp:77
PViewData::getValue
virtual void getValue(int step, int ent, int ele, int idx, double &val)
Definition: PViewData.h:159
mathEvaluator::eval
bool eval(const std::vector< double > &values, std::vector< double > &res)
Definition: mathEvaluator.h:47
addOutlinePyramid
static void addOutlinePyramid(PView *p, double **xyz, unsigned int color, bool pre)
Definition: PViewVertexArrays.cpp:833
TYPE_PNT
#define TYPE_PNT
Definition: GmshDefines.h:64
SBoundingBox3d::min
SPoint3 min() const
Definition: SBoundingBox3d.h:90
initPView::_estimateNumVectors
int _estimateNumVectors(PView *p)
Definition: PViewVertexArrays.cpp:1478
PViewOptions::color
struct PViewOptions::@32 color
PViewDataRemote::setMax
void setMax(double max)
Definition: PViewDataRemote.h:54
SVector3
Definition: SVector3.h:16
addScalarTetrahedron
static void addScalarTetrahedron(PView *p, double **xyz, double **val, bool pre, int i0=0, int i1=1, int i2=2, int i3=3)
Definition: PViewVertexArrays.cpp:703
PViewData::getNumPoints
virtual int getNumPoints(int step=-1)
Definition: PViewData.h:114
TYPE_TRI
#define TYPE_TRI
Definition: GmshDefines.h:66
VertexArray
Definition: VertexArray.h:151
addScalarPyramid
static void addScalarPyramid(PView *p, double **xyz, double **val, bool pre)
Definition: PViewVertexArrays.cpp:843
PViewOptions::currentTime
double currentTime
Definition: PViewOptions.h:62
PView.h
addOutlinePolyhedron
static void addOutlinePolyhedron(PView *p, double **xyz, unsigned int color, bool pre, int numNodes)
Definition: PViewVertexArrays.cpp:877
PViewOptions::pyramid
unsigned int pyramid
Definition: PViewOptions.h:87
PView::va_vectors
VertexArray * va_vectors
Definition: PView.h:156
PViewOptions::tetrahedron
unsigned int tetrahedron
Definition: PViewOptions.h:87
addOutlineQuadrangle
static void addOutlineQuadrangle(PView *p, double **xyz, unsigned int color, bool pre, int i0=0, int i1=1, int i2=2, int i3=3)
Definition: PViewVertexArrays.cpp:595
smooth_normals
Definition: SmoothData.h:100
PViewOptions::quadrangle
unsigned int quadrangle
Definition: PViewOptions.h:86
VertexArray::getNumVertices
int getNumVertices()
Definition: VertexArray.h:174
saturateVector
static double saturateVector(double *val, int numComp2, double *val2, double min, double max)
Definition: PViewVertexArrays.cpp:41
initPView::_estimateNumTriangles
int _estimateNumTriangles(PView *p)
Definition: PViewVertexArrays.cpp:1452
GmshMessage.h
edges
static int edges[6][2]
Definition: meshGRegionLocalMeshMod.cpp:23
PViewData::getNumEntities
virtual int getNumEntities(int step=-1)
Definition: PViewData.h:127
PViewData.h
addTriangle
static void addTriangle(PView *p, PViewOptions *opt, double *x0, double *x1, double *x2, SPoint3 &xx, double val)
Definition: PViewVertexArrays.cpp:1098
applyGeneralRaise
static void applyGeneralRaise(PView *p, int numNodes, int numComp, double **vals, double **xyz)
Definition: PViewVertexArrays.cpp:176
PViewOptions::displacementFactor
double displacementFactor
Definition: PViewOptions.h:50
PViewOptions::angleSmoothNormals
double angleSmoothNormals
Definition: PViewOptions.h:56
SetBoundingBox
void SetBoundingBox(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)
Definition: OpenFile.cpp:115
PViewOptions::MaxEigenValue
@ MaxEigenValue
Definition: PViewOptions.h:29
TYPE_PRI
#define TYPE_PRI
Definition: GmshDefines.h:70
PViewOptions::nbIso
int nbIso
Definition: PViewOptions.h:54
smooth_normals::add
void add(double x, double y, double z, double nx, double ny, double nz)
Definition: SmoothData.cpp:215
PViewOptions::Iso
@ Iso
Definition: PViewOptions.h:19
addScalarLine
static void addScalarLine(PView *p, double **xyz, double **val, bool pre, int i0=0, int i1=1, bool unique=false)
Definition: PViewVertexArrays.cpp:363
PViewOptions::glyphLocation
int glyphLocation
Definition: PViewOptions.h:60
PViewOptions::smoothNormals
int smoothNormals
Definition: PViewOptions.h:55
VertexArray::decodeHeader
static int decodeHeader(int length, const char *bytes, int swap, std::string &name, int &tag, int &type, double &min, double &max, int &numSteps, double &time, double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax)
Definition: VertexArray.cpp:273
PViewOptions::line
unsigned int line
Definition: PViewOptions.h:86
PViewOptions::customMax
double customMax
Definition: PViewOptions.h:47
PView::setChanged
void setChanged(bool val)
Definition: PView.cpp:241
PViewOptions::externalViewIndex
int externalViewIndex
Definition: PViewOptions.h:73
PViewOptions::tmpBBox
SBoundingBox3d tmpBBox
Definition: PViewOptions.h:49
PViewOptions::showElement
int showElement
Definition: PViewOptions.h:58
PViewData::getDirty
virtual bool getDirty()
Definition: PViewData.h:62
initPView::_estimateIfClipped
int _estimateIfClipped(PView *p, int num)
Definition: PViewVertexArrays.cpp:1427
initPView::_estimateNumEllipses
int _estimateNumEllipses(PView *p)
Definition: PViewVertexArrays.cpp:1486
addOutlineLine
static void addOutlineLine(PView *p, double **xyz, unsigned int color, bool pre, int i0=0, int i1=1)
Definition: PViewVertexArrays.cpp:344
evalClipPlane
static double evalClipPlane(int clip, double x, double y, double z)
Definition: PViewVertexArrays.cpp:274
CTX::instance
static CTX * instance()
Definition: Context.cpp:122
PViewOptions::Numeric
@ Numeric
Definition: PViewOptions.h:19
PrintOptions
void PrintOptions(int num, int level, int diff, int help, const char *filename, std::vector< std::string > *vec)
Definition: Options.cpp:636
SPoint3::x
double x(void) const
Definition: SPoint3.h:125
fullMatrix< double >
CutLine
int CutLine(double *X, double *Y, double *Z, double *Val, double V1, double V2, double *Xp2, double *Yp2, double *Zp2, double *Vp2)
Definition: Iso.cpp:180
PViewData::getDimension
virtual int getDimension(int step, int ent, int ele)
Definition: PViewData.h:134
PViewOptions::pointType
int pointType
Definition: PViewOptions.h:68
MFace
Definition: MFace.h:20
MFace.h
PViewData::getMax
virtual double getMax(int step=-1, bool onlyVisible=false, int tensorRep=0, int forceNumComponents=0, int componentMap[9]=nullptr)=0
initPView
Definition: PViewVertexArrays.cpp:1422
PView::getViewByTag
static PView * getViewByTag(int tag, int timeStep=-1, int partition=-1)
Definition: PView.cpp:376
PViewData::getType
virtual int getType(int step, int ent, int ele)
Definition: PViewData.h:183
PViewOptions::Ellipse
@ Ellipse
Definition: PViewOptions.h:32
PViewData::getNumHexahedra
virtual int getNumHexahedra(int step=-1)
Definition: PViewData.h:120
PViewOptions::transform
double transform[3][3]
Definition: PViewOptions.h:50
addOutlineElement
static void addOutlineElement(PView *p, int type, double **xyz, bool pre, int numNodes)
Definition: PViewVertexArrays.cpp:922
PView::normals
smooth_normals * normals
Definition: PView.h:166
addOutlinePoint
static void addOutlinePoint(PView *p, double **xyz, unsigned int color, bool pre, int i0=0)
Definition: PViewVertexArrays.cpp:315
PViewOptions::createGeneralRaise
void createGeneralRaise()
Definition: PViewOptions.cpp:120
PViewDataRemote::setTime
void setTime(double time)
Definition: PViewDataRemote.h:56
PViewData::getBoundingBox
virtual SBoundingBox3d getBoundingBox(int step=-1)=0
PView::va_ellipses
VertexArray * va_ellipses
Definition: PView.h:156
GMSH_FULLRC
#define GMSH_FULLRC
Definition: Options.h:20
swap
void swap(double &a, double &b)
Definition: meshTriangulation.cpp:27
PViewOptions::COG
@ COG
Definition: PViewOptions.h:36
PViewOptions::raise
double raise[3]
Definition: PViewOptions.h:50
PViewOptions::hexahedron
unsigned int hexahedron
Definition: PViewOptions.h:87
PViewOptions::genRaiseEvaluator
mathEvaluator * genRaiseEvaluator
Definition: PViewOptions.h:77
norm
void norm(const double *vec, double *norm)
Definition: gmshLevelset.cpp:202
Numeric.h
PViewData::hasTimeStep
virtual bool hasTimeStep(int step)
Definition: PViewData.h:211
changeCoordinates
void changeCoordinates(PView *p, int ient, int iele, int numNodes, int type, int numComp, double **xyz, double **val)
Definition: PViewVertexArrays.cpp:193
PViewData::fillRemoteVertexArrays
virtual int fillRemoteVertexArrays(std::string &options)
Definition: PViewData.h:282
PView::getData
PViewData * getData(bool useAdaptiveIfAvailable=false)
Definition: PView.cpp:233
PViewOptions::rangeType
int rangeType
Definition: PViewOptions.h:59
onelab.h
PViewData::getNumQuadrangles
virtual int getNumQuadrangles(int step=-1)
Definition: PViewData.h:117
PViewOptions::intervalsType
int intervalsType
Definition: PViewOptions.h:54
CTX::clipPlane
double clipPlane[6][4]
Definition: Context.h:277
PView::PView
PView(int tag=-1)
Definition: PView.cpp:53
addScalarTriangle
static void addScalarTriangle(PView *p, double **xyz, double **val, bool pre, int i0=0, int i1=1, int i2=2, bool unique=false, bool skin=false)
Definition: PViewVertexArrays.cpp:468
PViewOptions::forceNumComponents
int forceNumComponents
Definition: PViewOptions.h:81
PViewOptions.h
PViewOptions::prism
unsigned int prism
Definition: PViewOptions.h:87
PViewOptions::saturateValues
int saturateValues
Definition: PViewOptions.h:57
PViewOptions::Frame
@ Frame
Definition: PViewOptions.h:34
addOutlineTriangle
static void addOutlineTriangle(PView *p, double **xyz, unsigned int color, bool pre, int i0=0, int i1=1, int i2=2)
Definition: PViewVertexArrays.cpp:440
PViewData::getNumTrihedra
virtual int getNumTrihedra(int step=-1)
Definition: PViewData.h:123
PViewOptions::MinEigenValue
@ MinEigenValue
Definition: PViewOptions.h:30
PViewOptions::VonMises
@ VonMises
Definition: PViewOptions.h:28
PViewData::getNumNodes
virtual int getNumNodes(int step, int ent, int ele)
Definition: PViewData.h:137
GmshDefines.h
SPoint3::y
double y(void) const
Definition: SPoint3.h:127
Iso.h
PViewOptions::Vertex
@ Vertex
Definition: PViewOptions.h:36
IsoLine
int IsoLine(double *X, double *Y, double *Z, double *Val, double V, double *Xp, double *Yp, double *Zp)
Definition: Iso.cpp:36
PViewData::setName
virtual void setName(const std::string &val)
Definition: PViewData.h:71
addScalarTrihedron
static void addScalarTrihedron(PView *p, double **xyz, double **val, bool pre, int i0=0, int i1=1, int i2=2, int i3=3, bool unique=false)
Definition: PViewVertexArrays.cpp:870
PViewDataRemote.h
PViewData::isRemote
virtual bool isRemote()
Definition: PViewData.h:281
onelab::localNetworkClient
Definition: onelab.h:1471
clip
static GmshColorTable clip
Definition: ColorTable.cpp:1053
fullMatrix::eig
bool eig(fullVector< double > &eigenValReal, fullVector< double > &eigenValImag, fullMatrix< scalar > &leftEigenVect, fullMatrix< scalar > &rightEigenVect, bool sortRealPart=false)
Definition: fullMatrix.h:727
PViewOptions::Displacement
@ Displacement
Definition: PViewOptions.h:25
PView::fillVertexArrays
bool fillVertexArrays()
Definition: PViewVertexArrays.cpp:1568
addVectorElement
static void addVectorElement(PView *p, int ient, int iele, int numNodes, int type, double **xyz, double **val, bool pre)
Definition: PViewVertexArrays.cpp:969
PViewData::setDirty
virtual void setDirty(bool val)
Definition: PViewData.h:63
addScalarHexahedron
static void addScalarHexahedron(PView *p, double **xyz, double **val, bool pre)
Definition: PViewVertexArrays.cpp:774
addElementsInArrays
static void addElementsInArrays(PView *p, bool preprocessNormalsOnly)
Definition: PViewVertexArrays.cpp:1283
S
#define S
Definition: DefaultOptions.h:21
PViewData::getNumVectors
virtual int getNumVectors(int step=-1)
Definition: PViewData.h:112
PViewOptions::customMin
double customMin
Definition: PViewOptions.h:47
normal3
static SVector3 normal3(double **xyz, int i0=0, int i1=1, int i2=2)
Definition: PViewVertexArrays.cpp:64
PViewData
Definition: PViewData.h:29
length
double length(Quaternion &q)
Definition: Camera.cpp:346
TYPE_PYR
#define TYPE_PYR
Definition: GmshDefines.h:69
StringUtils.h
PViewData::getNumTetrahedra
virtual int getNumTetrahedra(int step=-1)
Definition: PViewData.h:119
PViewDataRemote
Definition: PViewDataRemote.h:17
PViewOptions::type
int type
Definition: PViewOptions.h:40
PViewOptions::Ellipsoid
@ Ellipsoid
Definition: PViewOptions.h:33
CutTriangle
int CutTriangle(double *X, double *Y, double *Z, double *Val, double V1, double V2, double *Xp2, double *Yp2, double *Zp2, double *Vp2)
Definition: Iso.cpp:233
PViewOptions::PerTimeStep
@ PerTimeStep
Definition: PViewOptions.h:37
addScalarPrism
static void addScalarPrism(PView *p, double **xyz, double **val, bool pre)
Definition: PViewVertexArrays.cpp:810
TYPE_QUA
#define TYPE_QUA
Definition: GmshDefines.h:67
TYPE_POLYG
#define TYPE_POLYG
Definition: GmshDefines.h:72
MEdge.h
PView::va_triangles
VertexArray * va_triangles
Definition: PView.h:156
Context.h
SBoundingBox3d::reset
void reset()
Definition: SBoundingBox3d.h:43
PViewOptions::externalMax
double externalMax
Definition: PViewOptions.h:47
addTensorElement
static void addTensorElement(PView *p, int iEnt, int iEle, int numNodes, int type, double **xyz, double **val, bool pre)
Definition: PViewVertexArrays.cpp:1127
PViewOptions::Discrete
@ Discrete
Definition: PViewOptions.h:19
PViewData::getNumComponents
virtual int getNumComponents(int step, int ent, int ele)
Definition: PViewData.h:152
smooth_normals::get
bool get(double x, double y, double z, double &nx, double &ny, double &nz) const
Definition: SmoothData.cpp:234
ComputeVonMises
double ComputeVonMises(double *V)
Definition: Numeric.cpp:496
PViewDataRemote::setBoundingBox
void setBoundingBox(SBoundingBox3d &bbox)
Definition: PViewDataRemote.h:55
PViewData::getNumTensors
virtual int getNumTensors(int step=-1)
Definition: PViewData.h:113
getPointNormal
static SVector3 getPointNormal(PView *p, double v)
Definition: PViewVertexArrays.cpp:75
PViewOptions::triangle
unsigned int triangle
Definition: PViewOptions.h:86
z
const double z
Definition: GaussQuadratureQuad.cpp:56
PViewOptions::boundary
int boundary
Definition: PViewOptions.h:68
PViewOptions::lineType
int lineType
Definition: PViewOptions.h:68
PViewData::getNumPrisms
virtual int getNumPrisms(int step=-1)
Definition: PViewData.h:121
PView::deleteVertexArrays
void deleteVertexArrays()
Definition: PView.cpp:210
PViewOptions
Definition: PViewOptions.h:16
PView::getOptions
PViewOptions * getOptions()
Definition: PView.h:81
PViewOptions::vectorType
int vectorType
Definition: PViewOptions.h:60
PViewOptions::componentMap
int componentMap[9]
Definition: PViewOptions.h:81
PViewOptions::drawTensors
int drawTensors
Definition: PViewOptions.h:67
initPView::operator()
bool operator()(PView *p)
Definition: PViewVertexArrays.cpp:1496
TYPE_HEX
#define TYPE_HEX
Definition: GmshDefines.h:71
PViewOptions::clip
int clip
Definition: PViewOptions.h:80
intersectClipPlane
static double intersectClipPlane(int clip, int numNodes, double **xyz)
Definition: PViewVertexArrays.cpp:282
TYPE_TET
#define TYPE_TET
Definition: GmshDefines.h:68
PViewOptions::Continuous
@ Continuous
Definition: PViewOptions.h:19
SPoint3::z
double z(void) const
Definition: SPoint3.h:129
PViewOptions::getScaleValue
double getScaleValue(int iso, int numIso, double min, double max)
Definition: PViewOptions.cpp:33
PViewData::getMin
virtual double getMin(int step=-1, bool onlyVisible=false, int tensorRep=0, int forceNumComponents=0, int componentMap[9]=nullptr)=0
addScalarPolyhedron
static void addScalarPolyhedron(PView *p, double **xyz, double **val, bool pre, int numNodes)
Definition: PViewVertexArrays.cpp:910
TYPE_TRIH
#define TYPE_TRIH
Definition: GmshDefines.h:76
VertexArray::finalize
void finalize()
Definition: VertexArray.cpp:138
Options.h
PViewData::getNumElements
virtual int getNumElements(int step=-1, int ent=-1)
Definition: PViewData.h:131
PViewDataRemote::setMin
void setMin(double min)
Definition: PViewDataRemote.h:53
initPView::_estimateNumPoints
int _estimateNumPoints(PView *p)
Definition: PViewVertexArrays.cpp:1438
addScalarPoint
static void addScalarPoint(PView *p, double **xyz, double **val, bool pre, int i0=0, bool unique=false)
Definition: PViewVertexArrays.cpp:324
PViewData::getNumPolyhedra
virtual int getNumPolyhedra(int step=-1)
Definition: PViewData.h:124
PView::fillVertexArray
static void fillVertexArray(onelab::localNetworkClient *remote, int length, const char *data, int swap)
Definition: PViewVertexArrays.cpp:1574
PViewOptions::tmpMin
double tmpMin
Definition: PViewOptions.h:47
PViewOptions::Custom
@ Custom
Definition: PViewOptions.h:37
IsoSimplex
int IsoSimplex(double *X, double *Y, double *Z, double *Val, double V, double *Xp, double *Yp, double *Zp, double n[3])
Definition: Iso.cpp:75
PView::getChanged
bool & getChanged()
Definition: PView.h:96
PViewOptions::viewIndexForGenRaise
int viewIndexForGenRaise
Definition: PViewOptions.h:73
CTX::tmpFileName
std::string tmpFileName
Definition: Context.h:141
norme
double norme(double a[3])
Definition: Numeric.h:123
PView::list
static std::vector< PView * > list
Definition: PView.h:112
VertexArray::add
void add(double *x, double *y, double *z, SVector3 *n, unsigned int *col, MElement *ele=nullptr, bool unique=true, bool boundary=false)
Definition: VertexArray.cpp:81
SBoundingBox3d::max
SPoint3 max() const
Definition: SBoundingBox3d.h:91
addScalarQuadrangle
static void addScalarQuadrangle(PView *p, double **xyz, double **val, bool pre, int i0=0, int i1=1, int i2=2, int i3=3, bool unique=false)
Definition: PViewVertexArrays.cpp:624
getLineNormal
static void getLineNormal(PView *p, double x[2], double y[2], double z[2], double *v, SVector3 n[2], bool computeNormal)
Definition: PViewVertexArrays.cpp:89
PViewOptions::offset
double offset[3]
Definition: PViewOptions.h:50
PViewOptions::getColor
unsigned int getColor(double val, double min, double max, bool forceLinear=false, int numColors=-1)
Definition: PViewOptions.cpp:86
PView::va_lines
VertexArray * va_lines
Definition: PView.h:156
TYPE_POLYH
#define TYPE_POLYH
Definition: GmshDefines.h:73
SBoundingBox3d
Definition: SBoundingBox3d.h:21
PViewData::getNumTriangles
virtual int getNumTriangles(int step=-1)
Definition: PViewData.h:116
PViewData::useGaussPoints
virtual bool useGaussPoints()
Definition: PViewData.h:221
fullMatrix.h
OpenFile.h
PViewOptions::drawSkinOnly
int drawSkinOnly
Definition: PViewOptions.h:68
IsoTriangle
int IsoTriangle(double *X, double *Y, double *Z, double *Val, double V, double *Xp, double *Yp, double *Zp)
Definition: Iso.cpp:50
initPView::_estimateNumLines
int _estimateNumLines(PView *p)
Definition: PViewVertexArrays.cpp:1445
saturate
static void saturate(int nb, double **val, double vmin, double vmax, int i0=0, int i1=1, int i2=2, int i3=3, int i4=4, int i5=5, int i6=6, int i7=7)
Definition: PViewVertexArrays.cpp:28
addOutlineTetrahedron
static void addOutlineTetrahedron(PView *p, double **xyz, unsigned int color, bool pre)
Definition: PViewVertexArrays.cpp:695
SmoothData.h
ComputeScalarRep
double ComputeScalarRep(int numComp, double *val, int tensorRep)
Definition: Numeric.cpp:506
PViewOptions::visible
int visible
Definition: PViewOptions.h:54
PViewOptions::drawVectors
int drawVectors
Definition: PViewOptions.h:67
SVector3::normalize
double normalize()
Definition: SVector3.h:38
PViewData::skipEntity
virtual bool skipEntity(int step, int ent)
Definition: PViewData.h:206
PViewOptions::explode
double explode
Definition: PViewOptions.h:51
PViewOptions::Plot3D
@ Plot3D
Definition: PViewOptions.h:18
PViewOptions::point
unsigned int point
Definition: PViewOptions.h:86