Hitmap 1.3
|
#include "hit_tileP.h"
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) |
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.
Definition in file hit_tile.h.
#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().
[in,out] | var | HitTile* 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.
[in] | var | HitTile A HitTile derived type variable. |
[in] | dim | int Number of the dimension of the array. |
[in] | pos | int Index to trasnform. |
int | Transformed index. |
Definition at line 875 of file hit_tile.h.
#define hit_tileCard | ( | var | ) |
#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.
[out] | newVar | HitTile* A pointer to a non-initialized HitTile derived type variable. |
[in] | oldVar | HitTile* 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.
int | Begin 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.
int | Cardinality 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.
int | End 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.
[in] | var | HitTile A HitTile derived type variable. |
[in] | dim | int Selected dimension. |
[in] | pos | int Index to check. |
int | True 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.
Last | tile-coordinate index in the specified dimension of the HitTile variable. |
Definition at line 816 of file hit_tile.h.
#define hit_tileDims | ( | var | ) |
#define hit_tileDimSig | ( | var, | |
dim | |||
) |
#define hit_tileDimStride | ( | var, | |
dim | |||
) |
Get the stride of the signature of a specific dimension of a HitTile variable.
int | Stride 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.
[out] | newVarP | HitTile_<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] | numDims | int 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. |
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.
[out] | newVarP | HitTile_<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] | numDims | int 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. |
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.
[out] | newVarP | HitTile_<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] | shape | HitShape Shape object for the new array. |
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).
[out] | newVarP | HitTile_<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] | shape | HitShape Shape object for the new array. |
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.
[in] | var | HitTile A HitTile derived type variable. |
[in] | ndims | int 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.
[in] | var | HitTile A HitTile derived type variable. |
[in] | ndims | int 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.
[in] | var | HitTile A HitTile derived type variable. |
[in] | ndims | int 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 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.
[in,out] | var | HitTile_<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 | |||
) |
Loop across the tile indexes of a dimension of an array tile.
[in] | tile | HitTile A HitTile derived type variable. |
[in] | dim | int Number of the dimension. |
[out] | index | int 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 | |||
) |
Loop across the ancestor array indexes of a dimension of an array tile.
[in] | tile | HitTile A HitTile derived type variable. |
[in] | dim | int Number of the dimension. |
[out] | index | int 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.
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.
[in] | var | HitTile A HitTile derived type variable. |
[in] | ndims | int Number of dimensions of the array. |
[in] | ... | int_list List of ndims integer indexes. |
int | True 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.
[in] | var | HitTile A tile variable |
int | Boolean value. True if the variable is set to Null. False otherwise. |
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>.
[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.
[out] | newVar | HitTile* A pointer to a non-initialized HitTile derived type variable. |
[in] | oldVar | HitTile* A pointer to a initialized and allocated HitTile derived type variable. |
[in] | shape | HitShape A shape indicating the domain to select. |
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.
[out] | newVar | HitTile* A pointer to a non-initialized HitTile derived type variable. |
[in] | oldVar | HitTile* A pointer to a initialized and allocated HitTile derived type variable. |
[in] | shape | HitShape A shape indicating the domain to select. |
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.
[out] | newVar | HitTile* A pointer to a non-initialized HitTile derived type variable. |
[in] | oldVar | HitTile* A pointer to a initialized and allocated HitTile derived type variable. |
[in] | shape | HitShape A shape indicating the domain to select. |
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.
[out] | newVar | HitTile* A pointer to a non-initialized HitTile derived type variable. |
[in] | oldVar | HitTile* A pointer to a initialized and allocated HitTile derived type variable. |
[in] | shape | HitShape A shape indicating the domain to select. |
Definition at line 434 of file hit_tile.h.
#define hit_tileShape | ( | var | ) |
#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.
[in] | var | <type> A variable of any type. |
[in] | type | __typeName The type name of the variable. |
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.
[in] | var | HitTile A HitTile derived type variable. |
[in] | dim | int Number of the dimension of the array. |
[in] | pos | int Index to trasnform. |
int | Transformed 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.
[in,out] | shadow | HitTile* 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.
[in] | shadow | HitTile* 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.
Shortcut for the struct HitTile type.
Definition at line 147 of file hit_tile.h.
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.
[in,out] | tileInA | A pointer to a HitTile derived type variable. |
[in,out] | tileInB | A pointer to a HitTile derived type variable. |
[out] | tileOut | A pointer to a non-initialized HitTile derived type variable. |
Definition at line 1698 of file hit_tile.c.
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.
[in,out] | newVar | A pointer to a HitTile derived type variable. |
[in] | numReductions | Number of starting dimensions to eliminate. |
Definition at line 1296 of file hit_tile.c.
Transforms a shape from ancestor array to tile coordinates space.
[in] | var | A HitTile derived type variable. |
[in] | sh | Shape to be transformed. |
Transformed | shape. |
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.
[in] | inTile | A HitTile derived type variable. |
Definition at line 1608 of file hit_tile.c.
Transforms a shape from tile to ancestor array coordinates space.
[in] | var | A HitTile derived type variable. |
[in] | sh | Shape to be transformed. |
Transformed | shape. |
Definition at line 1622 of file hit_tile.c.
HitTile HIT_TILE_NULL |
Null value for HitTile derived types.
Definition at line 63 of file hit_tile.c.