File: Inquire

package info (click to toggle)
dxsamples 4.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 26,348 kB
  • ctags: 1,513
  • sloc: ansic: 10,079; sh: 8,445; java: 1,772; makefile: 1,101
file content (29 lines) | stat: -rw-r--r-- 861 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// In this example, we use Inquire to determine if an input data field is
// scalar or vector. If it's vector, we extract the x component for 
// visualization using Isosurface. Otherwise, we use the original data field.

macro contour(data)
{
   scalar = Inquire(data,"is scalar");
   output = Compute("$0 ? $1 : [$1.x]", scalar, data);
   contours = Isosurface(output, number = 3);
   camera = AutoCamera(contours);

   switchnumber = scalar+1;

   caption1 = Caption("vector field");
   caption2 = Caption("scalar field");
   caption = Switch(switchnumber, caption1, caption2);
   
   collected = Collect(caption, contours);
   Display(collected,camera);
}

scalarfield = Import("watermolecule");
vectorfield = Gradient(scalarfield);
scalarslice = MapToPlane(scalarfield);
vectorslice = MapToPlane(vectorfield);

contour(scalarslice);
contour(vectorslice);