In file Grid.h:

class Grid : public BaseType

Holds the Grid data type.

Inheritance:


Public Methods

Grid(const string &n = "")
The Grid constructor.
Grid(const Grid &rhs)
The Grid copy constructor
virtual BaseType* var(const string &name, bool exact_match = true)
Note the paramter #exact_match# is not used by this mfunc
BaseType* array_var()
Returns the Grid Array
Pix first_map_var()
Returns the index of the first Map vector
void next_map_var(Pix &p)
Increments the Map vector index
BaseType* map_var(Pix p)
Given an index, returns the corresponding Map vector
virtual int components(bool constrained = false)
Returns the number of components in the Grid object.
virtual bool projection_yields_grid()
Returns TRUE if the current projection will yield a Grid that will pass the #check_semantics()# function
virtual unsigned int val2buf(void *buf, bool reuse = false)
Returns the size of the Grid type
virtual unsigned int buf2val(void **val)
Returns the size of the Grid type
virtual void print_decl(ostream &os, string space = " ", bool print_semi = true, bool constraint_info = false, bool constrained = false)
Prints the Grid declaration only if a valid Grid.
virtual bool check_semantics(string &msg, bool all = false)
Return true if this Grid is well formed

Inherited from BaseType:

Public Methods

virtual BaseType* ptr_duplicate()
string name() const
void set_name(const string &n)
Type type() const
void set_type(const Type &t)
string type_name() const
bool is_simple_type()
bool is_vector_type()
bool is_constructor_type()
virtual int element_count(bool leaves = false)
bool synthesized_p()
void set_synthesized_p(bool state)
bool read_p()
virtual void set_read_p(bool state)
bool send_p()
virtual void set_send_p(bool state)
xdrproc_t xdr_coder()
virtual void add_var(BaseType *v, Part p = nil)
virtual unsigned int width()
virtual bool read(const string &dataset, int &error)
virtual bool serialize(const string &dataset, DDS &dds, XDR *sink, bool ce_eval = true)
virtual bool deserialize(XDR *source, DDS *dds, bool reuse = false)
virtual void print_val(ostream &os, string space = "", bool print_decl_p = true)
virtual bool ops(BaseType *b, int op, const string &dataset)

Documentation

The Grid data type is a collection of an Array and a set of ``Map'' vectors. The Map vectors are one-dimensional arrays corresponding to each dimension of the central Array. Using this scheme, a Grid can represent, in a rectilinear array, data which is not in reality rectilinear. An example will help make it clear. Assume that the following array contains measurements of some real quantity, conducted at nine different points in space: \begin{verbatim} A = [ 1 2 3 4 ] [ 2 4 6 8 ] [ 3 6 9 12] \end{verbatim} To locate this Array in the real world, we could note the location of one corner of the grid, and the grid spacing. This would allow us to calculate the location of any of the other points of the Array. This approach will not work, however, unless the grid spacing is precisely regular. If the distance between Row 1 and Row 2 is not the same as the distance between Row 2 and Row 3, the scheme will break down. The solution is to equip the Array with two Map vectors that define the location of each row or column of the array: \begin{verbatim} A = [ 1 2 3 4 ] Row = [ 0 ] [ 2 4 6 8 ] [ 3 ] [ 3 6 9 12] [ 8 ] Column = [ 0 2 8 27] \end{verbatim} The real location of the point in the first row and column of the array is now exactly fixed at (0,0), and the point in the last row and last column is at (8,27). The Grid data type has two parts: an Array, and a singly-linked list of Map vectors to describe the Array. The access functions for this class include a function to return the Array (#array_var()#), and a set of functions for cycling through the list of Map vectors.
Grid(const string &n = "")
The Grid constructor requires only the name of the variable to be created. The name may be omitted, which will create a nameless variable. This may be adequate for some applications.
Parameters:
n - A string containing the name of the variable to be created.

Grid(const Grid &rhs)
The Grid copy constructor

virtual BaseType* var(const string &name, bool exact_match = true)
Note the paramter #exact_match# is not used by this mfunc.
See Also:
BaseType.h

BaseType* array_var()
Returns the Grid Array

Pix first_map_var()
Returns the index of the first Map vector

void next_map_var(Pix &p)
Increments the Map vector index

BaseType* map_var(Pix p)
Given an index, returns the corresponding Map vector

virtual int components(bool constrained = false)
Returns the number of components in the Grid object. This is equal to one plus the number of Map vectors. If there is a constraint expression in effect, the number of dimensions needed may be smaller than the actual number in the stored data. (Or the Array might not even be requested.) In this case, a user can request the smaller number with the {\it constrained} flag.
Returns:
The number of components in the Grid object.
Parameters:
constrained - If TRUE, the function returns the number of components contained in the constrained Grid. Since a constraint expression might well eliminate one or more of the Grid dimensions, this number can be lower than the actual number of components. If this parameter is FALSE (the default), the actual number of components will be returned.

virtual bool projection_yields_grid()
Returns TRUE if the current projection will yield a Grid that will pass the #check_semantics()# function. A Grid that, when projected, will not pass the #check_semantics()# function must be sent as either a Structure of Arrays or a single Array depending on the projection. The function first checks to see whether the Array is present. Then, for each dimension in the Array part, the function checks the corresponding Map vector to make sure it is present in the projected Grid. If for each projected dimension in the Array component, there is a matching Map vector, then the Grid is valid.
Returns:
TRUE if the projected grid is still a Grid. FALSE otherwise.

virtual unsigned int val2buf(void *buf, bool reuse = false)
Returns the size of the Grid type. Use the #val2buf()# functions of the member elements to insert values into the Grid buffer.

virtual unsigned int buf2val(void **val)
Returns the size of the Grid type. Use the #buf2val()# functions of the member elements to read values from the Grid buffer.

virtual void print_decl(ostream &os, string space = " ", bool print_semi = true, bool constraint_info = false, bool constrained = false)
If the projected Grid is not a valid grid, this function will convert the declaration to an Array or Structure, whichever seems more appropriate.
See Also:
Array
Structure

virtual bool check_semantics(string &msg, bool all = false)
Return true if this Grid is well formed. The array dimensions and number of map vectors must match and both the array and maps must be of simple-type elements.


This class has no child classes.
See Also:
Array

alphabetic index hierarchy of classes


generated by doc++