File libluminate/utility.c

RCS Header

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


Included Files


Preprocessor definitions

#define _REENTRANT 1

#define ORBIT2 1

#define IMLIB2_EXISTS 1

#define _FORTIFY_SOURCE 2

#define DPRINTF( fmt, args... )

#define __FUNCT__ "auto_scale"

#define __FUNCT__ "field_indices"


Global Function auto_scale()

Determine a sensible scale for plotting, returned in *scale. 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 auto_scale ( PetscScalar* global_array, int points, int num_fields, int display_field, field_plot_type fieldtype, int dimensions, PetscScalar* scale )

int auto_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* scale
Array in which to return the minimum/maximum values.

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.