7.3
general documentation
cs_array.c File Reference
#include "cs_defs.h"
#include <assert.h>
#include "bft_error.h"
#include "cs_array.h"
+ Include dependency graph for cs_array.c:

Functions

void cs_array_real_copy_sublist (cs_lnum_t n_elts, int stride, const cs_lnum_t elt_ids[], int mode, const cs_real_t ref[], cs_real_t dest[])
 Copy an array ("ref") into another array ("dest") on possibly only a part of the array(s). Array with stride > 1 are assumed to be interlaced. The sublist of element on which working is defined by "elt_ids" (of size "n_elts"). The way to apply the sublist is set with the parameter "mode" as follows: More...
 
void cs_array_real_copy (cs_lnum_t n_elts, cs_lnum_t dim, const cs_real_t src[], cs_real_t dest[restrict])
 Copy real values from an array to another of the same dimensions. More...
 
void cs_array_real_set_scalar (cs_lnum_t n_elts, cs_real_t ref_val, cs_real_t a[])
 Assign a constant scalar value to an array. More...
 
void cs_array_real_set_scalar_on_subset (cs_lnum_t n_elts, const cs_lnum_t elt_ids[], cs_real_t ref_val, cs_real_t a[])
 Assign a constant scalar value to an array on a selected subset of elements. If elt_ids = NULL, then one recovers the function cs_array_real_set_scalar. More...
 
void cs_array_real_set_vector (cs_lnum_t n_elts, const cs_real_t ref_val[3], cs_real_t *a)
 Assign a constant vector to an array of stride 3 which is interlaced. More...
 
void cs_array_real_set_vector_on_subset (cs_lnum_t n_elts, const cs_lnum_t elt_ids[], const cs_real_t ref_val[3], cs_real_t a[])
 Assign a constant vector to an interlaced array (of stride 3) on a selected subset of elements. If elt_ids = NULL, then one recovers the function cs_array_real_set_vector. More...
 
void cs_array_real_set_symm_tensor (cs_lnum_t n_elts, const cs_real_t ref_val[6], cs_real_t *a)
 Assign a constant vector of size 6 (optimized way to define a symmetric tensor) to an array (of stride 6) which is interlaced. More...
 
void cs_array_real_set_symm_tensor_on_subset (cs_lnum_t n_elts, const cs_lnum_t elt_ids[], const cs_real_t ref_val[6], cs_real_t *a)
 Assign a constant vector of size 6 (optimized way to define a symmetric tensor) to an interlaced array (of stride 6) on a selected subset of elements. If elt_ids = NULL, then one recovers the function cs_array_real_set_symm_tensor. More...
 
void cs_array_real_set_tensor (cs_lnum_t n_elts, const cs_real_t ref_tens[3][3], cs_real_t *a)
 Assign a constant 3x3 tensor to an array (of stride 9) which is interlaced. More...
 
void cs_array_real_set_tensor_on_subset (cs_lnum_t n_elts, const cs_lnum_t elt_ids[], const cs_real_t ref_tens[3][3], cs_real_t *a)
 Assign a constant 3x3 tensor to an interlaced array (of stride 9) on a subset of elements. If elt_ids = NULL, then one recovers the function cs_array_real_set_tensor. More...
 
void cs_array_real_fill_zero (cs_lnum_t size, cs_real_t a[])
 Assign zero to all elements of an array. More...
 
void cs_array_set_value_real (cs_lnum_t n_elts, cs_lnum_t dim, cs_real_t v, cs_real_t a[])
 Assign a constant value to an array (deprecated function). More...
 

Detailed Description

Array handling utilities.

Function Documentation

◆ cs_array_real_copy()

void cs_array_real_copy ( cs_lnum_t  n_elts,
cs_lnum_t  dim,
const cs_real_t  src[],
cs_real_t  dest[restrict] 
)

Copy real values from an array to another of the same dimensions.

Parameters
[in]n_eltsnumber of associated elements
[in]dimassociated dimension
[in]srcsource array values (size: n_elts*dim)
[out]destdestination array values (size: n_elts*dim)

◆ cs_array_real_copy_sublist()

void cs_array_real_copy_sublist ( cs_lnum_t  n_elts,
int  stride,
const cs_lnum_t  elt_ids[],
int  mode,
const cs_real_t  ref[],
cs_real_t  dest[] 
)

Copy an array ("ref") into another array ("dest") on possibly only a part of the array(s). Array with stride > 1 are assumed to be interlaced. The sublist of element on which working is defined by "elt_ids" (of size "n_elts"). The way to apply the sublist is set with the parameter "mode" as follows:

  • Only the "ref" array if mode = 0 (CS_ARRAY_IN_SUBLIST)
  • Only the "dest" array if mode = 1 (CS_ARRAY_OUT_SUBLIST)
  • Both "ref" and "dest" arrays if mode = 2 (CS_ARRAY_INOUT_SUBLIST)

It elt_ids = NULL or mode < 0 (CS_ARRAY_NO_SUBLIST), then the behavior is as cs_array_real_copy

One assumes that all arrays are allocated with a correct size.

Parameters
[in]n_eltsnumber of elements in the array
[in]stridenumber of values for each element
[in]modetype of indirection to apply
[in]elt_idssub list of element ids to consider
[in]refreference values to copy
[in,out]destarray storing values after applying the indirection

◆ cs_array_real_fill_zero()

void cs_array_real_fill_zero ( cs_lnum_t  size,
cs_real_t  a[] 
)

Assign zero to all elements of an array.

Parameters
[in]sizetotal number of elements to set to zero
[in,out]aarray to set

◆ cs_array_real_set_scalar()

void cs_array_real_set_scalar ( cs_lnum_t  n_elts,
cs_real_t  ref_val,
cs_real_t  a[] 
)

Assign a constant scalar value to an array.

Parameters
[in]n_eltsnumber of elements
[in]ref_valvalue to assign
[in,out]aarray to set

◆ cs_array_real_set_scalar_on_subset()

void cs_array_real_set_scalar_on_subset ( cs_lnum_t  n_elts,
const cs_lnum_t  elt_ids[],
cs_real_t  ref_val,
cs_real_t  a[] 
)

Assign a constant scalar value to an array on a selected subset of elements. If elt_ids = NULL, then one recovers the function cs_array_real_set_scalar.

Parameters
[in]n_eltsnumber of elements
[in]elt_idslist of ids defining the subset or NULL
[in]ref_valvalue to assign
[in,out]aarray to set

◆ cs_array_real_set_symm_tensor()

void cs_array_real_set_symm_tensor ( cs_lnum_t  n_elts,
const cs_real_t  ref_val[6],
cs_real_t a 
)

Assign a constant vector of size 6 (optimized way to define a symmetric tensor) to an array (of stride 6) which is interlaced.

Parameters
[in]n_eltsnumber of elements
[in]ref_valvector to assign
[in,out]aarray to set

◆ cs_array_real_set_symm_tensor_on_subset()

void cs_array_real_set_symm_tensor_on_subset ( cs_lnum_t  n_elts,
const cs_lnum_t  elt_ids[],
const cs_real_t  ref_val[6],
cs_real_t a 
)

Assign a constant vector of size 6 (optimized way to define a symmetric tensor) to an interlaced array (of stride 6) on a selected subset of elements. If elt_ids = NULL, then one recovers the function cs_array_real_set_symm_tensor.

Parameters
[in]n_eltsnumber of elements
[in]elt_idslist of ids defining the subset or NULL
[in]ref_valvector to assign
[in,out]aarray to set

◆ cs_array_real_set_tensor()

void cs_array_real_set_tensor ( cs_lnum_t  n_elts,
const cs_real_t  ref_tens[3][3],
cs_real_t a 
)

Assign a constant 3x3 tensor to an array (of stride 9) which is interlaced.

Parameters
[in]n_eltsnumber of elements
[in]ref_tenstensor to assign
[in,out]aarray to set

◆ cs_array_real_set_tensor_on_subset()

void cs_array_real_set_tensor_on_subset ( cs_lnum_t  n_elts,
const cs_lnum_t  elt_ids[],
const cs_real_t  ref_tens[3][3],
cs_real_t a 
)

Assign a constant 3x3 tensor to an interlaced array (of stride 9) on a subset of elements. If elt_ids = NULL, then one recovers the function cs_array_real_set_tensor.

Parameters
[in]n_eltsnumber of elements
[in]elt_idslist of ids defining the subset or NULL
[in]ref_tenstensor to assign
[in,out]aarray to set

◆ cs_array_real_set_vector()

void cs_array_real_set_vector ( cs_lnum_t  n_elts,
const cs_real_t  ref_val[3],
cs_real_t a 
)

Assign a constant vector to an array of stride 3 which is interlaced.

Parameters
[in]n_eltsnumber of elements
[in]ref_valvector to assign
[in,out]aarray to set

◆ cs_array_real_set_vector_on_subset()

void cs_array_real_set_vector_on_subset ( cs_lnum_t  n_elts,
const cs_lnum_t  elt_ids[],
const cs_real_t  ref_val[3],
cs_real_t  a[] 
)

Assign a constant vector to an interlaced array (of stride 3) on a selected subset of elements. If elt_ids = NULL, then one recovers the function cs_array_real_set_vector.

Parameters
[in]n_eltsnumber of elements
[in]elt_idslist of ids defining the subset or NULL
[in]ref_valvector to assign
[in,out]aarray to set

◆ cs_array_set_value_real()

void cs_array_set_value_real ( cs_lnum_t  n_elts,
cs_lnum_t  dim,
cs_real_t  v,
cs_real_t  a[] 
)

Assign a constant value to an array (deprecated function).

Parameters
[in]n_eltsnumber of associated elements
[in]dimassociated dimension
[in]vvalue to assign
[out]aarray values (size: n_elts*dim]