t8
1.2.0
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
|
We define the t8_element_array that stores elements of a given eclass scheme. More...
Go to the source code of this file.
Data Structures | |
struct | t8_element_array_t |
The t8_element_array_t is an array to store t8_element_t * of a given eclass_scheme implementation. More... | |
Functions | |
t8_element_array_t * | t8_element_array_new (t8_eclass_scheme_c *scheme) |
Creates a new array structure with 0 elements. More... | |
t8_element_array_t * | t8_element_array_new_count (t8_eclass_scheme_c *scheme, size_t num_elements) |
Creates a new array structure with a given length (number of elements) and calls t8_element_new for those elements. More... | |
void | t8_element_array_init (t8_element_array_t *element_array, t8_eclass_scheme_c *scheme) |
Initializes an already allocated (or static) array structure. More... | |
void | t8_element_array_init_size (t8_element_array_t *element_array, t8_eclass_scheme_c *scheme, size_t num_elements) |
Initializes an already allocated (or static) array structure and allocates a given number of elements and initializes them with t8_element_init. More... | |
void | t8_element_array_init_view (t8_element_array_t *view, t8_element_array_t *array, size_t offset, size_t length) |
Initializes an already allocated (or static) view from existing t8_element_array. More... | |
void | t8_element_array_init_data (t8_element_array_t *view, t8_element_t *base, t8_eclass_scheme_c *scheme, size_t elem_count) |
Initializes an already allocated (or static) view from given plain C data (array of t8_element_t). More... | |
void | t8_element_array_init_copy (t8_element_array_t *element_array, t8_eclass_scheme_c *scheme, t8_element_t *data, size_t num_elements) |
Initializes an already allocated (or static) array structure and copy an existing array of t8_element_t into it. More... | |
void | t8_element_array_resize (t8_element_array_t *element_array, size_t new_count) |
Change the number of elements stored in an element array. More... | |
void | t8_element_array_copy (t8_element_array_t *dest, t8_element_array_t *src) |
Copy the contents of an array into another. More... | |
t8_element_t * | t8_element_array_push (t8_element_array_t *element_array) |
Enlarge an array by one element. More... | |
t8_element_t * | t8_element_array_push_count (t8_element_array_t *element_array, size_t count) |
Enlarge an array by a number of elements. More... | |
t8_element_t * | t8_element_array_index_locidx (t8_element_array_t *element_array, t8_locidx_t index) |
Return a given element in an array. More... | |
t8_element_t * | t8_element_array_index_int (t8_element_array_t *element_array, int index) |
Return a given element in an array. More... | |
t8_eclass_scheme_c * | t8_element_array_get_scheme (t8_element_array_t *element_array) |
Return the eclass scheme associated to a t8_element_array. More... | |
size_t | t8_element_array_get_count (t8_element_array_t *element_array) |
Return the number of elements stored in a t8_element_array_t. More... | |
size_t | t8_element_array_get_size (t8_element_array_t *element_array) |
Return the data size of elements stored in a t8_element_array_t. More... | |
t8_element_t * | t8_element_array_get_data (t8_element_array_t *element_array) |
Return a pointer to the real data array stored in a t8_element_array. More... | |
sc_array_t * | t8_element_array_get_array (t8_element_array_t *element_array) |
Return a pointer to the sc_array stored in a t8_element_array. More... | |
void | t8_element_array_reset (t8_element_array_t *element_array) |
Sets the array count to zero and frees all elements. More... | |
void | t8_element_array_truncate (t8_element_array_t *element_array) |
Sets the array count to zero, but does not free elements. More... | |
We define the t8_element_array that stores elements of a given eclass scheme.
void t8_element_array_copy | ( | t8_element_array_t * | dest, |
t8_element_array_t * | src | ||
) |
Copy the contents of an array into another.
Both arrays must have the same eclass_scheme.
[in] | dest | Array will be resized and get new data. |
[in] | src | Array used as source of new data, will not be changed. |
sc_array_t* t8_element_array_get_array | ( | t8_element_array_t * | element_array | ) |
Return a pointer to the sc_array stored in a t8_element_array.
[in] | element_array | Array structure. |
size_t t8_element_array_get_count | ( | t8_element_array_t * | element_array | ) |
Return the number of elements stored in a t8_element_array_t.
[in] | element_array | Array structure. |
t8_element_t* t8_element_array_get_data | ( | t8_element_array_t * | element_array | ) |
Return a pointer to the real data array stored in a t8_element_array.
[in] | element_array | Array structure. |
t8_eclass_scheme_c* t8_element_array_get_scheme | ( | t8_element_array_t * | element_array | ) |
Return the eclass scheme associated to a t8_element_array.
[in] | element_array | Array of elements. |
size_t t8_element_array_get_size | ( | t8_element_array_t * | element_array | ) |
Return the data size of elements stored in a t8_element_array_t.
[in] | element_array | Array structure. |
t8_element_t* t8_element_array_index_int | ( | t8_element_array_t * | element_array, |
int | index | ||
) |
Return a given element in an array.
[in] | element_array | Array of elements. |
[in] | index | The index of an element whithin the array. |
t8_element_t* t8_element_array_index_locidx | ( | t8_element_array_t * | element_array, |
t8_locidx_t | index | ||
) |
Return a given element in an array.
[in] | element_array | Array of elements. |
[in] | index | The index of an element whithin the array. |
void t8_element_array_init | ( | t8_element_array_t * | element_array, |
t8_eclass_scheme_c * | scheme | ||
) |
Initializes an already allocated (or static) array structure.
[in,out] | element_array | Array structure to be initialized. |
[in] | scheme | The eclass scheme of which elements should be stored. |
void t8_element_array_init_copy | ( | t8_element_array_t * | element_array, |
t8_eclass_scheme_c * | scheme, | ||
t8_element_t * | data, | ||
size_t | num_elements | ||
) |
Initializes an already allocated (or static) array structure and copy an existing array of t8_element_t into it.
[in,out] | element_array | Array structure to be initialized. |
[in] | scheme | The eclass scheme of which elements should be stored. |
[in] | data | An array of t8_element_t which will be copied into element_array. The elements in data must belong to scheme and must be properly initialized with either t8_element_new or t8_element_init. |
[in] | num_elements | Number of elements in data to be copied. |
void t8_element_array_init_data | ( | t8_element_array_t * | view, |
t8_element_t * | base, | ||
t8_eclass_scheme_c * | scheme, | ||
size_t | elem_count | ||
) |
Initializes an already allocated (or static) view from given plain C data (array of t8_element_t).
The array view returned does not require t8_element_array_reset (doesn't hurt though).
[in,out] | view | Array structure to be initialized. |
[in] | base | The data must not be moved while view is alive. Must be an array of t8_element_t corresponding to scheme. |
[in] | scheme | The eclass scheme of the elements stored in base. |
[in] | elem_count | The length of the view in element units. The view cannot be resized to exceed this length. It is not necessary to call t8_element_array_reset later. |
void t8_element_array_init_size | ( | t8_element_array_t * | element_array, |
t8_eclass_scheme_c * | scheme, | ||
size_t | num_elements | ||
) |
Initializes an already allocated (or static) array structure and allocates a given number of elements and initializes them with t8_element_init.
[in,out] | element_array | Array structure to be initialized. |
[in] | scheme | The eclass scheme of which elements should be stored. |
[in] | num_elements | Number of initial array elements. |
void t8_element_array_init_view | ( | t8_element_array_t * | view, |
t8_element_array_t * | array, | ||
size_t | offset, | ||
size_t | length | ||
) |
Initializes an already allocated (or static) view from existing t8_element_array.
The array view returned does not require t8_element_array_reset (doesn't hurt though).
[in,out] | view | Array structure to be initialized. |
[in] | array | The array must not be resized while view is alive. |
[in] | offset | The offset of the viewed section in element units. This offset cannot be changed until the view is reset. |
[in] | length | The length of the view in element units. The view cannot be resized to exceed this length. It is not necessary to call sc_array_reset later. |
t8_element_array_t* t8_element_array_new | ( | t8_eclass_scheme_c * | scheme | ) |
Creates a new array structure with 0 elements.
[in] | scheme | The eclass scheme of which elements should be stored. |
t8_element_array_t* t8_element_array_new_count | ( | t8_eclass_scheme_c * | scheme, |
size_t | num_elements | ||
) |
Creates a new array structure with a given length (number of elements) and calls t8_element_new for those elements.
[in] | scheme | The eclass scheme of which elements should be stored. |
[in] | num_elements | Initial number of array elements. |
t8_element_t* t8_element_array_push | ( | t8_element_array_t * | element_array | ) |
Enlarge an array by one element.
[in,ou] | element_array Array structure to be modified. |
t8_element_t* t8_element_array_push_count | ( | t8_element_array_t * | element_array, |
size_t | count | ||
) |
Enlarge an array by a number of elements.
[in,ou] | element_array Array structure to be modified. | |
[in] | count | The number of elements to add. |
void t8_element_array_reset | ( | t8_element_array_t * | element_array | ) |
Sets the array count to zero and frees all elements.
[in,out] | element_array | Array structure to be reset. |
void t8_element_array_resize | ( | t8_element_array_t * | element_array, |
size_t | new_count | ||
) |
Change the number of elements stored in an element array.
[in,out] | element_array | The element array to be modified. |
[in] | new_count | The new element count of the array. If it is zero the effect equals t8_element_array_reset. |
void t8_element_array_truncate | ( | t8_element_array_t * | element_array | ) |
Sets the array count to zero, but does not free elements.
[in,out] | element_array | Element array structure to be truncated. |