File utility.c

RCS Header: /cvsroot/petscgraphics/utility.c,v 1.1 2004/08/17 15:05:42 hazelsct Exp

This file contains small utility functions for various aspects of visualization and storage.


Included Files


Preprocessor definitions

#define __FUNCT__ "minmax_scale"

#define __FUNCT__ "field_indices"


Global Function field_indices()

Given an array of field_plot_type enums, fill (part of) the indices array with integers pointing to the true variable starts. For example, in 2-D with a vector field (two fields), a scalar field (one field), a symmetric tensor field (three fields) and a ternary composition field (two fields) for a total of 8 fields, this will fill the indices array with the values 0, 2, 3, 6 and pad the rest of indices with -1, indicating when those true field variables start in the overall set of field variables.

void field_indices ( int nfields, int ds, field_plot_type* plottypes, int* indices )

int nfields
Total number of fields.
int ds
Dimensionality of the space (used to determine the number of fields used for a vector or tensor field).
field_plot_type* plottypes
Array of field_plot_type enums with length nfields.
int* indices
Array to hold the return values.

Global Function minmax_scale()

Determine a sensible scale for plotting, returned in *minmax. If a scalar field, returns the minimum and maximum; if a vector field, returns the minimum and maximum magnitudes (in 1-D, just plain minimum and maximum); if a ternary, returns the corners of the smallest equilateral triangle in ternary space in which all of the data fit.

int minmax_scale ( PetscScalar* global_array, int points, int num_fields, int display_field, field_plot_type fieldtype, int dimensions, PetscScalar* minmax )

int minmax_scale
Returns zero or an error code.
PetscScalar* global_array
Array with values to scan for scale.
int points
Number of points in array to scan.
int num_fields
Number of fields in array.
int display_field
This display field (at least the start).
field_plot_type fieldtype
Type of field.
int dimensions
Number of dimensions.
PetscScalar* minmax
Array in which to return the minimum/maximum values.