There are three ways to create the structured grid data:
1 using scripts (use the data=, data+ methods from visage_data superclass),
2 using the plot3d reader,
3 or using the netCDF reader.
The examples in this man page show how to create a structured grid using a script. For large data sets, however, this is impractical and one of the reader objects should be used.
cell_points! internal method to compute cell point id's from current cell, origin, aspect ratio, and dimensions.
cell_coords! internal method to compute cell coordinates from current cell, origin, aspect ratio, and dimensions.
point_cells! find all the cells that use a particular point.
number_cells! compute the number of cells in the volume.
cell_neighbor! get the neighbor to the current cell given the
current cell and parametric coordinates.
location! compute the location of a x-y-z point from an initial position. The location is the cell number plus the parametric coordinates (r-s-t) in the cell.
location_to_cell! convert a location in the form of (i.r,j.s,k.t) to a cell numer plus a parametric coordinate (r,s,t).
position! compute the position of a point from the cell number and parametric coordinates.
output! bformatted print (using unix command more) of data values.
/* * Create structured grid */ structured_grid_set new: grid dimensions= (2,3,4); grid data=(0., 0., 0., 1., 0., 0., 0., 1., 0., 1., 1., 0., 0., 2., 0., 1., 2., 0.) data+(0., 0., 1., 1., 0., 1., 0., 1., 1., 1., 1., 1., 0., 2., 1., 1., 2., 1.) data+(0., 0., 2., 1., 0., 2., 0., 1., 2., 1., 1., 2., 0., 2., 2., 1., 2., 2.) data+(0., 0., 3., 1., 0., 3., 0., 1., 3., 1., 1., 3., 0., 2., 3., 1., 2., 3.) ; /* * Vector data */ visage_vector new: velocity; velocity data= (0., 0., 0., 1., 0., 0., 0., 2., 0., 0., 0., 3.) data+ (1., 0., 0., 1., 0., 0., 0., 2., 0., 0., 0., 3.) data+ (2., 0., 0., 1., 0., 0., 0., 2., 0., 0., 0., 3.) data+ (2., 0., 0., 1., 0., 0., 0., 2., 0., 0., 0., 3.) data+ (2., 0., 0., 1., 0., 0., 0., 2., 0., 0., 0., 3.) data+ (3., 0., 0., 1., 0., 0., 0., 2., 0., 0., 0., 3.) ; /* * Scalar data */ visage_scalar new: pressure;
pressure data=(0., 0., 0., 1., 0., 0., 0., 2., 0., 0., 0., 3.) data+ (1., 1., 1., 2., 1., 1., 3., 2., 1., 1., 1., 3.) ; /* * Create a data set */ visage_data_set new: adata_set geometry= grid scalar_data= pressure vector_data= velocity ; /* * Now create a visual image */ /* * Create an outline */ data_outline new: an_outline data_in= adata_set generate_data! ; display_lines new: draw_outline data_in= an_outline ; actor new: outline_actor modeller=draw_outline ; /* * Create a geometry */ data_geometry new: a_geometry extent=(1,1,1,3,1,4) data_in= adata_set ; display_surface new: draw_surface data_in= a_geometry ; actor new: geometry_actor modeller=draw_surface ; /* * Create an iso-surface */ data_iso_surface new: iso value=2.0 data_in= adata_set ; display_all new: draw_iso data_in= iso ; actor new: iso_actor modeller=draw_iso ;
/* * Render the image */ renderer new: aren actors= [actor instances?] render! ;