src/base/cs_interface.h File Reference

| programmer's documentation

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
cs_interface.h File Reference
`#include "fvm_defs.h"`
`#include "fvm_periodicity.h"`
Include dependency graph for cs_interface.h:

Go to the source code of this file.

## Functions
int | cs_interface_rank (const cs_interface_t *itf)
| Return process rank associated with an interface's distant elements. More...
cs_lnum_t | cs_interface_size (const cs_interface_t *itf)
| Return number of local and distant elements defining an interface. More...
const cs_lnum_t * | cs_interface_get_elt_ids (const cs_interface_t *itf)
| Return pointer to array of local element ids defining an interface. More...
const cs_lnum_t * | cs_interface_get_match_ids (const cs_interface_t *itf)
| Return pointer to array of matching element ids defining an interface. More...
cs_lnum_t | cs_interface_get_tr_index_size (const cs_interface_t *itf)
| Return size of index of sub-sections for different transformations. More...
const cs_lnum_t * | cs_interface_get_tr_index (const cs_interface_t *itf)
| Return pointer to index of sub-sections for different transformations. More...
cs_interface_set_t * | cs_interface_set_create (cs_lnum_t n_elts, const cs_lnum_t parent_element_id[], const cs_gnum_t global_number[], const fvm_periodicity_t *periodicity, int n_periodic_lists, const int periodicity_num[], const cs_lnum_t n_periodic_couples[], const cs_gnum_t *const periodic_couples[])
| Creation of a list of interfaces between elements of a same type. More...
void | cs_interface_set_destroy (cs_interface_set_t **ifs)
| Destruction of an interface set. More...
int | cs_interface_set_size (const cs_interface_set_t *ifs)
| Return number of interfaces associated with an interface set. More...
cs_lnum_t | cs_interface_set_n_elts (const cs_interface_set_t *ifs)
| Return total number of elements in interface set. More...
const cs_interface_t * | cs_interface_set_get (const cs_interface_set_t *ifs, int interface_id)
| Return pointer to a given interface in an interface set. More...
const fvm_periodicity_t * | cs_interface_set_periodicity (const cs_interface_set_t *ifs)
| Return pointer to the periocicity structure associated of an interface set. More...
void | cs_interface_set_renumber (cs_interface_set_t *ifs, const cs_lnum_t old_to_new[])
| Apply renumbering of elements referenced by an interface set. More...
void | cs_interface_set_add_match_ids (cs_interface_set_t *ifs)
| Add matching element id information to an interface set. More...
void | cs_interface_set_free_match_ids (cs_interface_set_t *ifs)
| Free matching element id information of an interface set. More...
void | cs_interface_set_copy_array (const cs_interface_set_t *ifs, cs_datatype_t datatype, int stride, bool src_on_parent, const void *src, void *dest)
| Copy array from distant or matching interface elements to local elements. More...
void | cs_interface_set_copy_indexed (const cs_interface_set_t *ifs, cs_datatype_t datatype, bool src_on_parent, const cs_lnum_t src_index[], const cs_lnum_t dest_index[], const void *src, void *dest)
| Copy indexed array from distant or matching interface elements to local elements. More...
void | cs_interface_set_sum (cs_interface_set_t *ifs, cs_lnum_t n_elts, cs_lnum_t stride, bool interlace, cs_datatype_t datatype, void *var)
| Update the sum of values for elements associated with an interface set. More...
void | cs_interface_set_max (cs_interface_set_t *ifs, cs_lnum_t n_elts, cs_lnum_t stride, bool interlace, cs_datatype_t datatype, void *var)
| Update to maximum value for elements associated with an interface set. More...
void | cs_interface_set_dump (const cs_interface_set_t *ifs)
| Dump printout of an interface list. More...

## Function Documentation

const cs_lnum_t* cs_interface_get_elt_ids | ( | const cs_interface_t * | itf | ) |

Return pointer to array of local element ids defining an interface.

The size of the array may be obtained by cs_interface_size(). The array is owned by the interface structure, and is not copied (hence the constant qualifier for the return value).

Parameters

  [in] | itf | pointer to interface structure

Returns
  pointer to array of local element ids (0 to n-1) defining the interface

const cs_lnum_t* cs_interface_get_match_ids | ( | const cs_interface_t * | itf | ) |

Return pointer to array of matching element ids defining an interface.

This array is only available if cs_interface_set_add_match_ids() has been called for the containing interface set.

The size of the array may be obtained by cs_interface_size(). The array is owned by the interface structure, and is not copied (hence the constant qualifier for the return value).

Parameters

  [in] | itf | pointer to interface structure

Returns
  pointer to array of local element ids (0 to n-1) defining the interface

const cs_lnum_t* cs_interface_get_tr_index | ( | const cs_interface_t * | itf | ) |

Return pointer to index of sub-sections for different transformations.

The index is applicable to both local_num and distant_num arrays, with purely parallel equivalences appearing at position 0, and equivalences through periodic transform i at position i+1; In absence of periodicity, it may be NULL, as it is not needed.

Parameters

  [in] | itf | pointer to interface structure

Returns
  pointer to transform index for the interface

cs_lnum_t cs_interface_get_tr_index_size | ( | const cs_interface_t * | itf | ) |

Return size of index of sub-sections for different transformations.

The index is applicable to both local_num and distant_num arrays, with purely parallel equivalences appearing at position 0, and equivalences through periodic transform i at position i+1; Its size should thus be equal to 1 + number of periodic transforms + 1, In absence of periodicity, it may be 0, as the index is not needed.

Parameters

  [in] | itf | pointer to interface structure

Returns
  transform index size for the interface

int cs_interface_rank | ( | const cs_interface_t * | itf | ) |

Return process rank associated with an interface's distant elements.

Parameters

  [in] | itf | pointer to interface structure

Returns
  process rank associated with the interface's distant elements

void cs_interface_set_add_match_ids | ( | cs_interface_set_t * | ifs | ) |

Add matching element id information to an interface set.

This information is required by calls to cs_interface_get_dist_ids(), and may be freed using cs_interface_set_free_match_ids().

Parameters

  [in] | ifs | pointer to interface set structure

void cs_interface_set_copy_array | ( | const cs_interface_set_t * | ifs,
|  | cs_datatype_t | datatype,
|  | int | stride,
|  | bool | src_on_parent,
|  | const void * | src,
|  | void * | dest
| ) |  |

Copy array from distant or matching interface elements to local elements.

Source and destination arrays define values for all elements in the interface set (i.e. all elements listed by cs_interface_get_elt_ids() when looping over interfaces of a set.

Parameters

  [in] | ifs | pointer to interface set structure
  [in] | datatype | type of data considered
  [in] | stride | number of values per entity (interlaced)
  [in] | src_on_parent | true if source array is defined on the elements defined by ifs->elt_ids, false if source array defined directly on cs_interface_set_n_elts(ifs)
  [in] | src | source array (size: cs_interface_set_n_elts(ifs)*stride or parent array size * stride)
  [out] | dest | destination array (size: cs_interface_set_n_elts(ifs)*stride)

void cs_interface_set_copy_indexed | ( | const cs_interface_set_t * | ifs,
|  | cs_datatype_t | datatype,
|  | bool | src_on_parent,
|  | const cs_lnum_t | src_index[],
|  | const cs_lnum_t | dest_index[],
|  | const void * | src,
|  | void * | dest
| ) |  |

Copy indexed array from distant or matching interface elements to local elements.

Source and destination arrays define values for all elements in the interface set (i.e. all elements listed by cs_interface_get_elt_ids() when looping over interfaces of a set.

Note that when copying the same type of data to all matching elements, the source and destination index may be the same, if src_on_parent is true. To avoid requiring a separate destination index, the dest_index argument may be set to NULL, in which case it is assumed that source and destination are symmetric, and src_index is sufficient to determine sizes (whether src_on_parent is true or not).

In some use cases, for example when copying values only in one, the copying is not symmetric, so both a source and destination buffer must be provided.

Parameters

  [in] | ifs | pointer to interface set structure
  [in] | datatype | type of data considered
  [in] | src_on_parent | true if source array is defined on the elements defined by ifs->elt_ids, false if source array defined directly on cs_interface_set_n_elts(ifs)
  [in] | src_index | index for source array
  [in] | dest_index | index for destination array, or NULL
  [in] | src | source array (size: src_index[cs_interface_set_n_elts(ifs)] or parent array size)
  [out] | dest | destination array (size: src_index[cs_interface_set_n_elts(ifs)] or dest_index[cs_interface_set_n_elts(ifs)])

cs_interface_set_t* cs_interface_set_create | ( | cs_lnum_t | n_elts,
|  | const cs_lnum_t | parent_element_number[],
|  | const cs_gnum_t | global_number[],
|  | const fvm_periodicity_t * | periodicity,
|  | int | n_periodic_lists,
|  | const int | periodicity_num[],
|  | const cs_lnum_t | n_periodic_couples[],
|  | const cs_gnum_t *const | periodic_couples[]
| ) |  |

Creation of a list of interfaces between elements of a same type.

These interfaces may be used to identify equivalent vertices or faces using domain splitting, as well as periodic elements (on the same or on distant ranks).

Note that periodicity information will be completed and made consistent based on the input, so that if a periodic couple is defined on a given rank, the reverse couple wil be defined, whether it is also defined on the same or a different rank.

In addition, multiple periodicity interfaces will be built automatically if the periodicity structure provides for composed periodicities, so they need not be defined prior to this function being called.

The corresponding elements must be locally ordered.

Parameters

  [in] | n_elts | number of local elements considered (size of parent_element_number[])
  [in] | parent_element_number | pointer to list of selected elements local numbers (1 to n), or NULL if all first n_elts elements are used
  [in] | global_number | pointer to list of global (i.e. domain splitting independent) element numbers
  [in] | periodicity | periodicity information (NULL if none)
  [in] | n_periodic_lists | number of periodic lists (may be local)
  [in] | periodicity_num | periodicity number (1 to n) associated with each periodic list (primary periodicities only)
  [in] | n_periodic_couples | number of periodic couples associated with each periodic list
  [in] | periodic_couples | array indicating periodic couples (interlaced, using global numberings) for each list

Returns
  pointer to list of interfaces (possibly NULL in serial mode)

void cs_interface_set_destroy | ( | cs_interface_set_t ** | ifs | ) |

Destruction of an interface set.

Parameters

  [in,out] | ifs | pointer to pointer to structure to destroy

void cs_interface_set_dump | ( | const cs_interface_set_t * | ifs | ) |

Dump printout of an interface list.

Parameters

  [in] | ifs | pointer to structure that should be dumped

void cs_interface_set_free_match_ids | ( | cs_interface_set_t * | ifs | ) |

Free matching element id information of an interface set.

This information is used by calls to cs_interface_get_dist_ids(), and may be defined using cs_interface_set_add_match_ids().

Parameters

  [in] | ifs | pointer to interface set structure

const cs_interface_t* cs_interface_set_get | ( | const cs_interface_set_t * | ifs,
|  | int | interface_id
| ) |  |

Return pointer to a given interface in an interface set.

Parameters

  [in] | ifs | <– pointer to interface set structure
  [in] | interface_id | <– index of interface in set (0 to n-1)

Returns
  pointer to interface structure

void cs_interface_set_max | ( | cs_interface_set_t * | ifs,
|  | cs_lnum_t | n_elts,
|  | cs_lnum_t | stride,
|  | bool | interlace,
|  | cs_datatype_t | datatype,
|  | void * | var
| ) |  |

Update to maximum value for elements associated with an interface set.

On input, the variable array should contain local contributions. On output, contributions from matching elements on parallel or periodic boundaries have been added.

Only the values of elements belonging to the interfaces are modified.

Parameters

  [in] | ifs | pointer to a fvm_interface_set_t structure
  [in] | n_elts | number of elements in var buffer
  [in] | stride | number of values (non interlaced) by entity
  [in] | interlace | true if variable is interlaced (for stride > 1)
  [in] | datatype | type of data considered
  [in,out] | var | variable buffer

cs_lnum_t cs_interface_set_n_elts | ( | const cs_interface_set_t * | ifs | ) |

Return total number of elements in interface set.

This is equal to the sum of cs_interface_size() on the cs_interface_size() interfaces of a set.

Parameters

  [in] | ifs | pointer to interface set structure

Returns
  number of interfaces in set

const fvm_periodicity_t* cs_interface_set_periodicity | ( | const cs_interface_set_t * | ifs | ) |

Return pointer to the periocicity structure associated of an interface set.

Parameters

  [in] | ifs | pointer to interface set structure

Returns
  pointer to periodicity structure, or NULL

void cs_interface_set_renumber | ( | cs_interface_set_t * | ifs,
|  | const cs_lnum_t | old_to_new[]
| ) |  |

Apply renumbering of elements referenced by an interface set.

For any given element i, a negative old_to_new[i] value means that that element does not appear anymore in the new numbering.

Parameters

  [in,out] | ifs | pointer to interface set structure
  [in] | old_to_new | renumbering array (0 to n-1 numbering)

int cs_interface_set_size | ( | const cs_interface_set_t * | ifs | ) |

Return number of interfaces associated with an interface set.

Parameters

  [in] | ifs | pointer to interface set structure

Returns
  number of interfaces in set

void cs_interface_set_sum | ( | cs_interface_set_t * | ifs,
|  | cs_lnum_t | n_elts,
|  | cs_lnum_t | stride,
|  | bool | interlace,
|  | cs_datatype_t | datatype,
|  | void * | var
| ) |  |

Update the sum of values for elements associated with an interface set.

On input, the variable array should contain local contributions. On output, contributions from matching elements on parallel or periodic boundaries have been added.

Only the values of elements belonging to the interfaces are modified.

Parameters

  [in] | ifs | pointer to a fvm_interface_set_t structure
  [in] | n_elts | number of elements in var buffer
  [in] | stride | number of values (non interlaced) by entity
  [in] | interlace | true if variable is interlaced (for stride > 1)
  [in] | datatype | type of data considered
  [in,out] | var | variable buffer

cs_lnum_t cs_interface_size | ( | const cs_interface_t * | itf | ) |

Return number of local and distant elements defining an interface.

Parameters

  [in] | itf | pointer to interface structure

Returns
  number of local and distant elements defining the interface