Hitmap 1.3
 All Data Structures Namespaces Files Functions Variables Typedefs Friends Macros Groups Pages
Macros | Typedefs | Variables
hit_tile.h File Reference
#include "hit_tileP.h"
Include dependency graph for hit_tile.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define hit_tileNewType(baseType)
 
#define hit_tileIsNull(var)
 
Flags
#define HIT_FILE_INT
 
#define HIT_FILE_LONG
 
#define HIT_FILE_FLOAT
 
#define HIT_FILE_DOUBLE
 
#define HIT_FILE_TILE
 
#define HIT_FILE_ARRAY
 
#define HIT_VERTICES
 
#define HIT_EDGES
 
#define HIT_VERTICES_EDGES
 
Initilizers and tile memory management
#define hit_tileSingle(tile, var, type)
 
#define hit_tileDomain(newVarP, baseType, numDims,...)
 
#define hit_tileDomainShape(newVarP, baseType, shape)
 
#define hit_tileAlloc(var)
 
#define hit_tileDomainAlloc(newVarP, baseType, numDims,...)
 
#define hit_tileDomainShapeAlloc(newVarP, baseType, shape)
 
#define hit_tileFree(var)
 
#define hit_tileFill(var, value)
 
#define hit_tileClone(newVar, oldVar)
 
Selection functions
#define hit_tileSelectNoBoundary(newVar, oldVar, shape)
 
#define hit_tileSelect(newVar, oldVar, shape)
 
#define hit_tileSelectArrayCoordsNoBoundary(newVar, oldVar, shape)
 
#define hit_tileSelectArrayCoords(newVar, oldVar, shape)
 
Access to tile elements
#define hit_tileElemAt(var, ndims,...)
 
#define hit_tileElemAtArrayCoords(var, ndims,...)
 
#define hit_tileElemAtNoStride(var, ndims,...)
 
Domain iterators
#define hit_tileForDimDomainArray(tile, dim, index)
 
#define hit_tileForDimDomain(tile, dim, index)
 
Data movement to/from ancestor
#define hit_tileUpdateToAncestor(shadow)
 
#define hit_tileUpdateFromAncestor(shadow)
 
Input/Output for dense array tiles.
#define hit_tileFileWrite(var, file, coord)
 
#define hit_tileFileRead(var, file, coord)
 
#define hit_tileTextFileWrite(var, file, coord, datatype, s1, s2)
 
#define hit_tileTextFileRead(var, file, coord, datatype, s1, s2)
 

Typedefs

typedef struct HitTile HitTile
 

Functions

Other tile structure utilities
int hit_tileReduceDims (void *newVar, int numReductions)
 
void hit_tileGlue (void *tileInA, void *tileInB, void *tileOut)
 

Variables

HitTile HIT_TILE_NULL
 

Retrieving information about the tile shape

#define hit_tileDims(var)
 
#define hit_tileShape(var)
 
#define hit_tileDimCard(var, dim)
 
#define hit_tileCard(var)
 
#define hit_tileDimSig(var, dim)
 
#define hit_tileDimBegin(var, dim)
 
#define hit_tileDimEnd(var, dim)
 
#define hit_tileDimStride(var, dim)
 
#define hit_tileDimLast(var, dim)
 
HitShape hit_tileShapeLocal (const void *inTile)
 

Index spaces information and transformation

#define hit_tileDimHasArrayCoord(var, dim, pos)
 
#define hit_tileHasArrayCoords(var, ndims,...)
 
#define hit_tileTile2Array(var, dim, pos)
 
#define hit_tileArray2Tile(var, dim, pos)
 
HitShape hit_tileShapeTile2Array (void *var, HitShape sh)
 
HitShape hit_tileShapeArray2Tile (void *var, HitShape sh)
 

Detailed Description

Hierarchical tiling of multi-dimensional dense and sparse structures. Definitions and functions to manipulate HitTile types. This type defines a handler for dense arrays and sparse structures with meta-information to create and manipulate hierarchical tiles.

Version
1.6
Author
Arturo Gonzalez-Escribano
Javier Fresno Bausela
Carlos de Blas Carton
Yuri Torres de la Sierra
Date
Mar 2013

Definition in file hit_tile.h.

Macro Definition Documentation

#define HIT_EDGES

Flag to allocate edges in a CSR/Bitmap sparse shape.

Definition at line 214 of file hit_tile.h.

#define HIT_FILE_ARRAY

Flag for read/write file operations in array files (with array coordinates)

Definition at line 201 of file hit_tile.h.

#define HIT_FILE_DOUBLE

Flag for read/write file operations with double numbers

Definition at line 189 of file hit_tile.h.

#define HIT_FILE_FLOAT

Flag for read/write file operations with float numbers

Definition at line 184 of file hit_tile.h.

#define HIT_FILE_INT

Flag for read/write file operations with integer numbers.

Definition at line 174 of file hit_tile.h.

#define HIT_FILE_LONG

Flag for read/write file operations with long integer numbers.

Definition at line 179 of file hit_tile.h.

#define HIT_FILE_TILE

Flag for read/write file operations in tile files (with tile coordinates)

Definition at line 196 of file hit_tile.h.

#define hit_tileAlloc (   var)

Allocate memory for the elements of an array tile.

The parameter variable should have been previously initialized with hit_tileDomain() or hit_tileDomainShape(). This function cannot be used on a previously allocated variable before using hit_tileFree().

Parameters
[in,out]varHitTile* A pointer to a HitTile derived type variable.

Definition at line 319 of file hit_tile.h.

#define hit_tileArray2Tile (   var,
  dim,
  pos 
)

Transforms a dimensional index from ancestor array to tile coordinates space.

Parameters
[in]varHitTile A HitTile derived type variable.
[in]dimint Number of the dimension of the array.
[in]posint Index to trasnform.
Return values
intTransformed index.

Definition at line 875 of file hit_tile.h.

#define hit_tileCard (   var)

Get the cardinality of a HitTile variable.

Returns the total number of elements of the whole array tile variable.

Parameters
[in]varHitTile A HitTile derived type variable.
Return values
intCardinality of the HitTile variable.

Definition at line 763 of file hit_tile.h.

#define hit_tileClone (   newVar,
  oldVar 
)

Clone the array tile.

This function duplicates the handler and the array elements on a new not yet initialized array tile variable.

Parameters
[out]newVarHitTile* A pointer to a non-initialized HitTile derived type variable.
[in]oldVarHitTile* A pointer to a initialized and allocated HitTile derived type variable.

Definition at line 404 of file hit_tile.h.

#define hit_tileDimBegin (   var,
  dim 
)

Get the begin index of the signature of a specific dimension of a HitTile variable.

Parameters
[in]varHitTile A HitTile derived type variable.
[in]dimint Number of the dimension.
Return values
intBegin index of the signature in the specified dimension of the HitTile variable.

Definition at line 786 of file hit_tile.h.

#define hit_tileDimCard (   var,
  dim 
)

Get the cardinality of a HitTile variable in a given dimension.

Returns the number of rows, columns, etc. of the domain of the array tile variable.

Parameters
[in]varHitTile A HitTile derived type variable.
[in]dimint Number of the dimension.
Return values
intCardinality in the specified dimension of the HitTile variable.

Definition at line 750 of file hit_tile.h.

#define hit_tileDimEnd (   var,
  dim 
)

Get the end index of the signature of a specific dimension of a HitTile variable.

Parameters
[in]varHitTile A HitTile derived type variable.
[in]dimint Number of the dimension.
Return values
intEnd index of the signature in the specified dimension of the HitTile variable.

Definition at line 796 of file hit_tile.h.

#define hit_tileDimHasArrayCoord (   var,
  dim,
  pos 
)

Check if an index is in the domain space of a given dimension of the array tile.

Parameters
[in]varHitTile A HitTile derived type variable.
[in]dimint Selected dimension.
[in]posint Index to check.
Return values
intTrue if the index is in the dimensional domain space. False otherwise.

Definition at line 836 of file hit_tile.h.

#define hit_tileDimLast (   var,
  dim 
)

Get the last index in tile-coordinates of a specific dimension of a HitTile variable.

Parameters
[in]varHitTile A HitTile derived type variable.
[in]dimint Number of the dimension.
Return values
Lasttile-coordinate index in the specified dimension of the HitTile variable.

Definition at line 816 of file hit_tile.h.

#define hit_tileDims (   var)

Get the number of dimensions of a HitTile variable.

Parameters
[in]varHitTile A HitTile derived type variable.
Return values
intNumber of dimensions of the HitTile variable.

Definition at line 713 of file hit_tile.h.

#define hit_tileDimSig (   var,
  dim 
)

Get the signature of a specific dimension of a HitTile variable.

Parameters
[in]varHitTile A HitTile derived type variable.
[in]dimint Number of the dimension.
Return values
HitSigSignature in the specified dimension of the HitTile variable.

Definition at line 776 of file hit_tile.h.

#define hit_tileDimStride (   var,
  dim 
)

Get the stride of the signature of a specific dimension of a HitTile variable.

Parameters
[in]varHitTile A HitTile derived type variable.
[in]dimint Number of the dimension.
Return values
intStride of the signature in the specified dimension of the HitTile variable.

Definition at line 806 of file hit_tile.h.

#define hit_tileDomain (   newVarP,
  baseType,
  numDims,
  ... 
)

Initializer: Initialize the sizes and base type of a new multidimensional array tile.

The sizes of the array are a list of integers. The elements are numbered from 0 to n-1 on each dimension.

This function initializes the tile variable but does not allocate memory for the elements.

Parameters
[out]newVarPHitTile_<baseType> A pointer to a HitTile derived type variable to be initialized.
[in]baseType__typeName The name of the type of the elements in the new array tile.
[in]numDimsint Number of dimensions of the array. Limited by HIT_MAXDIMS.
[in]...int_list A list of numDims integer positive numbers defining the cardinalities on each dimension.
See Also
hit_tileAlloc(), hit_tileDomainAlloc()

Definition at line 286 of file hit_tile.h.

#define hit_tileDomainAlloc (   newVarP,
  baseType,
  numDims,
  ... 
)

Initializer: Initialize and allocate memory for a new multidimensional array tile.

The sizes of the array are a list of integers. The elements are numbered from 0 to n-1 on each dimension.

Parameters
[out]newVarPHitTile_<baseType> A pointer to a HitTile derived type variable to be initialized.
[in]baseType__typeName The name of the type of the elements in the new array tile.
[in]numDimsint Number of dimensions of the array. Limited by HIT_MAXDIMS.
[in]...int_list A list of numDims integer positive numbers defining the cardinalities on each dimension.
See Also
hit_tileAlloc(), hit_tileDomain(), hit_tileDomainShape(), hit_tileDomainShapeAlloc()

Definition at line 336 of file hit_tile.h.

#define hit_tileDomainShape (   newVarP,
  baseType,
  shape 
)

Initializer: Initialize the shape and base type of a new multidimensional array tile.

This initializer based on a shape object allows to specify arrays with indexes starting and ending at any integer number (positive or negative).

This function initializes the tile variable but does not allocate memory for the elements.

Parameters
[out]newVarPHitTile_<baseType> A pointer to a HitTile derived type variable to be initialized.
[in]baseType__typeName The name of the type of the elements in the new array tile.
[in]shapeHitShape Shape object for the new array.
See Also
hit_tileAlloc(), hit_tileDomainShapeAlloc()

Definition at line 304 of file hit_tile.h.

#define hit_tileDomainShapeAlloc (   newVarP,
  baseType,
  shape 
)

Initializer: Initialize and allocate memory for a new multidimensional array tile.

This initializer based on a shape object allows to specify arrays with indexes starting and ending at any integer number (positive or negative).

Parameters
[out]newVarPHitTile_<baseType> A pointer to a HitTile derived type variable to be initialized.
[in]baseType__typeName The name of the type of the elements in the new array tile.
[in]shapeHitShape Shape object for the new array.
See Also
hit_tileAlloc(), hit_tileDomain(), hit_tileDomainShape(), hit_tileDomainAlloc()

Definition at line 354 of file hit_tile.h.

#define hit_tileElemAt (   var,
  ndims,
  ... 
)

Access to an element of an array tile, using tile coordinates.

This macro is used in expressions and assignments to access or modify the value of an element of the array tile variable.

Parameters
[in]varHitTile A HitTile derived type variable.
[in]ndimsint Number of dimensions of the array. It must be known at compilation time. Limited to HIT_MAXDIMS.
[in]...int_list List of ndims integer indexes.

Definition at line 519 of file hit_tile.h.

#define hit_tileElemAtArrayCoords (   var,
  ndims,
  ... 
)

Access to an element of an array tile, using ancestor array coordinates.

This macro is used in expressions and assignments to access or modify the value of an element of the array tile variable.

Parameters
[in]varHitTile A HitTile derived type variable.
[in]ndimsint Number of dimensions of the array. It must be known at compilation time. Limited to HIT_MAXDIMS.
[in]...int_list List of ndims integer indexes.

Definition at line 534 of file hit_tile.h.

#define hit_tileElemAtNoStride (   var,
  ndims,
  ... 
)

Access to an element of an array tile, using tile coordinates in a ATile.

This macro is used in expressions and assignments to access or modify the value of an element of the array tile variable.

Deprecated:
This macro con only be used for HitATile arrays. It is equivalent to hit_tileElemAt(), but faster. The name will be changed and it will be moved to be a member of the HitATile class. The HitATile subclass has no stride in any dimension. The domain is contiguous or compact.
Parameters
[in]varHitTile A HitTile derived type variable.
[in]ndimsint Number of dimensions of the array. It must be known at compilation time. Limited to HIT_MAXDIMS.
[in]...int_list List of ndims integer indexes.
See Also
hit_tileElemAt()

Definition at line 558 of file hit_tile.h.

#define hit_tileFill (   var,
  value 
)

Initialize the elements of a tile array with a value.

The tile variable should have been previously initialized and allocated. The value is provided through a pointer to a variable of the base type which contains the value. The value is copied to all the elements of the array tile.

Parameters
[in,out]varHitTile_<baseType>* A pointer to a HitTile derived type variable.
[in]value<baseType>* Pointer to a variable of the base type with the value.

Definition at line 390 of file hit_tile.h.

#define hit_tileForDimDomain (   tile,
  dim,
  index 
)
Value:
for( index=0; \
index<hit_tileDimCard(tile,dim); \
index++ )
#define hit_tileDimCard(var, dim)
Definition: hit_tile.h:750

Loop across the tile indexes of a dimension of an array tile.

Parameters
[in]tileHitTile A HitTile derived type variable.
[in]dimint Number of the dimension.
[out]indexint Variable index to be used as counter in the loop.

Definition at line 587 of file hit_tile.h.

#define hit_tileForDimDomainArray (   tile,
  dim,
  index 
)
Value:
for( index=hit_tileDimBegin(tile, dim); \
index<=hit_tileDimEnd(tile,dim); \
index=index+hit_tileDimStride(tile,dim) )
#define hit_tileDimStride(var, dim)
Definition: hit_tile.h:806
#define hit_tileDimBegin(var, dim)
Definition: hit_tile.h:786
#define hit_tileDimEnd(var, dim)
Definition: hit_tile.h:796

Loop across the ancestor array indexes of a dimension of an array tile.

Parameters
[in]tileHitTile A HitTile derived type variable.
[in]dimint Number of the dimension.
[out]indexint Variable index to be used as counter in the loop.

Definition at line 576 of file hit_tile.h.

#define hit_tileFree (   var)

Free allocated memory for the elements of an array tile.

In case that the array tile has not been previously allocated, or it does not use its own memory (see hit_tileSelect()), the function call is ignored.

Parameters
[in,out]varHitTile A HitTile derived type variable.

Definition at line 369 of file hit_tile.h.

#define hit_tileHasArrayCoords (   var,
  ndims,
  ... 
)

Check if a multi-dimensional index is in the domain space of the array tile.

Parameters
[in]varHitTile A HitTile derived type variable.
[in]ndimsint Number of dimensions of the array.
[in]...int_list List of ndims integer indexes.
Return values
intTrue if the multi-dimensonal index is in the domain space. False otherwise.

Definition at line 850 of file hit_tile.h.

#define hit_tileIsNull (   var)

Check if a tile variable is set to the Null value.

Parameters
[in]varHitTile A tile variable
Return values
intBoolean value. True if the variable is set to Null. False otherwise.
See Also
HIT_TILE_NULL

Definition at line 241 of file hit_tile.h.

#define hit_tileNewType (   baseType)

Generate particular polymorphic types of HitTile.

This macro allows to define particular polymorphic types of HitTile. The new defined type will be named: HitTile_<baseType>.

Version
1.6
Author
Arturo Gonzalez-Escribano
Javier Fresno Bausela
Parameters
[in]baseType__typeName Name of a valid native or derived C type.

Definition at line 163 of file hit_tile.h.

#define hit_tileSelect (   newVar,
  oldVar,
  shape 
)

Initialize a hierarchical subselection using tile coordinates.

The output tile is a selection of the input tile, where the new domain is expressed using a shape with tile coordinates of the originale variable. It checks if the subselection domain is out of bounds of the original variable and returns HIT_TILE_NULL in that case.

Parameters
[out]newVarHitTile* A pointer to a non-initialized HitTile derived type variable.
[in]oldVarHitTile* A pointer to a initialized and allocated HitTile derived type variable.
[in]shapeHitShape A shape indicating the domain to select.
See Also
hit_tileSelectNoBoundary(), hit_tileSelectArrayCoords()

Definition at line 453 of file hit_tile.h.

#define hit_tileSelectArrayCoords (   newVar,
  oldVar,
  shape 
)

Initialize a hierarchical subselection using ancestor array coordinates.

The output tile is a selection of the input tile, where the new domain is expressed using a shape with the ancestor array coordinates of the originale variable. It checks if the subselection domain is out of bounds of the original variable and returns HIT_TILE_NULL in that case.

Parameters
[out]newVarHitTile* A pointer to a non-initialized HitTile derived type variable.
[in]oldVarHitTile* A pointer to a initialized and allocated HitTile derived type variable.
[in]shapeHitShape A shape indicating the domain to select.
See Also
hit_tileSelect(), hit_tileSelectArrayCoordsNoBoundary()

Definition at line 494 of file hit_tile.h.

#define hit_tileSelectArrayCoordsNoBoundary (   newVar,
  oldVar,
  shape 
)

Initialize a hierarchical subselection using array coordinates and no boundaries check.

The output tile is a selection of the input tile, where the new domain is expressed using a shape with the ancestor array coordinates of the originale variable. This function skips to check if the selection domain is out of bounds of the original variable. Elements out of bounds can not be used is such selections, unless the new selection tile is allocated to have its own memory.

Parameters
[out]newVarHitTile* A pointer to a non-initialized HitTile derived type variable.
[in]oldVarHitTile* A pointer to a initialized and allocated HitTile derived type variable.
[in]shapeHitShape A shape indicating the domain to select.
See Also
hit_tileSelectArrayCoords(), hit_tileSelectNoBoundary()

Definition at line 475 of file hit_tile.h.

#define hit_tileSelectNoBoundary (   newVar,
  oldVar,
  shape 
)

Initialize a hierarchical subselection using tile coordinates and no boundaries check.

The output tile is a selection of the input tile, where the new domain is expressed using a shape with tile coordinates of the originale variable. This function skips to check if the selection domain is out of bounds of the original variable. Elements out of bounds can not be used is such selections, unless the new selection tile is allocated to have its own memory.

Parameters
[out]newVarHitTile* A pointer to a non-initialized HitTile derived type variable.
[in]oldVarHitTile* A pointer to a initialized and allocated HitTile derived type variable.
[in]shapeHitShape A shape indicating the domain to select.
See Also
hit_tileSelect(), hit_tileSelectArrayCoordsNoBoundary()

Definition at line 434 of file hit_tile.h.

#define hit_tileShape (   var)

Get the shape of a HitTile variable.

Parameters
[in]varHitTile A HitTile derived type variable.
Return values
HitShapeShape of the HitTile variable.

Definition at line 723 of file hit_tile.h.

#define hit_tileSingle (   tile,
  var,
  type 
)

Initializer: Build a tile with a single element that points to a previous declared variable.

This constructor is useful to create tiles that allow to use generate Hitmap communication objects that do operations on single variables.

Parameters
[in]var<type> A variable of any type.
[in]type__typeName The type name of the variable.
Return values
HitTile_<type>A tile variable with a single element that points to the variable.

Definition at line 266 of file hit_tile.h.

#define hit_tileTile2Array (   var,
  dim,
  pos 
)

Transforms a dimensional index from tile to ancestor array coordinates space.

Parameters
[in]varHitTile A HitTile derived type variable.
[in]dimint Number of the dimension of the array.
[in]posint Index to trasnform.
Return values
intTransformed index.

Definition at line 864 of file hit_tile.h.

#define hit_tileUpdateFromAncestor (   shadow)

Update elements of the input tile with its ancestor values.

Update the elements of the input tile with the values in the same indexed elements of the nearest ancestor variable in the selection chain. The input tile variable should be a selection of another tile, and it has to be allocated to have its own memory.

Parameters
[in,out]shadowHitTile* A pointer to a HitTile derived type variable.

Definition at line 627 of file hit_tile.h.

#define hit_tileUpdateToAncestor (   shadow)

Update elements of the ancestor tile with the input tile values.

Update the elements of the nearest ancestor variable in the selection chain, with the values of the same indexed elements of the input variable. The input tile variable should be a selection of another tile, and it has to be allocated to have its own memory.

Parameters
[in]shadowHitTile* A pointer to a HitTile derived type variable.

Definition at line 613 of file hit_tile.h.

#define HIT_VERTICES

Flag to allocate only the vertices in a CSR/Bitmap sparse shape.

Definition at line 208 of file hit_tile.h.

#define HIT_VERTICES_EDGES

Flag to allocate vertices and edges in a CSR/Bitmap sparse shape.

Definition at line 220 of file hit_tile.h.

Typedef Documentation

Shortcut for the struct HitTile type.

Definition at line 147 of file hit_tile.h.

Function Documentation

void hit_tileGlue ( void *  tileInA,
void *  tileInB,
void *  tileOut 
)

Glue two 1-dimensional array tiles with contiguous domains.

For two array tile variables of 1-dimension, and with contigous domains ( [a:b] and [b+1,c] ), this function generates a new tile variable with the whole domain ( [a:c] ) and a single contigous memory zone for the data of the two variables.

Deprecated:
Not needed in the Trasgo translation system anymore, and not needed for any application example.
Parameters
[in,out]tileInAA pointer to a HitTile derived type variable.
[in,out]tileInBA pointer to a HitTile derived type variable.
[out]tileOutA pointer to a non-initialized HitTile derived type variable.

Definition at line 1698 of file hit_tile.c.

Here is the call graph for this function:

int hit_tileReduceDims ( void *  newVar,
int  numReductions 
)

Reduce dimensions.

If the shape of a HitTile variable has some starting cardinalities which are 1 (e.g. a matrix of 1xn elements), the variable can be accesed faster if the initial trivial dimensions are eliminated (e.g. accesing the 1xn matrix as a vector of n elements).

This function eliminates the number of required starting dimensions of a variable shape as long as they are equal to 1, without modifying the values of the elements or its storage.

For example, if a variable have four dimensions, and its cardinalities are 1,1,2,4, we may request to reduce 2 dimensions. The result is the same variable, with the same data, but having only 2 dimensions with cardinalities 2,4.

Deprecated:
Not needed in the Trasgo translation system anymore, and not needed for any application example.
Parameters
[in,out]newVarA pointer to a HitTile derived type variable.
[in]numReductionsNumber of starting dimensions to eliminate.
Returns
0 if the reduction is correct, 1 in case the number of required dimensions cannot be reduced.

Definition at line 1296 of file hit_tile.c.

HitShape hit_tileShapeArray2Tile ( void *  var,
HitShape  sh 
)

Transforms a shape from ancestor array to tile coordinates space.

Parameters
[in]varA HitTile derived type variable.
[in]shShape to be transformed.
Return values
Transformedshape.

Definition at line 1640 of file hit_tile.c.

HitShape hit_tileShapeLocal ( const void *  inTile)

Get the shape of a HitTile variable in tile coordinates.

Parameters
[in]inTileA HitTile derived type variable.
Returns
Shape of the HitTile variable in tile coordinates.

Definition at line 1608 of file hit_tile.c.

HitShape hit_tileShapeTile2Array ( void *  var,
HitShape  sh 
)

Transforms a shape from tile to ancestor array coordinates space.

Parameters
[in]varA HitTile derived type variable.
[in]shShape to be transformed.
Return values
Transformedshape.

Definition at line 1622 of file hit_tile.c.

Variable Documentation

HitTile HIT_TILE_NULL

Null value for HitTile derived types.

Definition at line 63 of file hit_tile.c.