9.1
general documentation
cs_array.h File Reference
#include <string.h>
#include "base/cs_defs.h"
#include "base/cs_base_accel.h"
#include "base/cs_dispatch.h"
#include "base/cs_mdspan.h"
#include "base/cs_parall.h"
+ Include dependency graph for cs_array.h:

Go to the source code of this file.

Classes

class  array< T, N, L >
 

Namespaces

namespace  cs
 

Macros

#define CS_ARRAY_SUBSET_NULL   -1
 
#define CS_ARRAY_SUBSET_IN   0
 
#define CS_ARRAY_SUBSET_OUT   1
 
#define CS_ARRAY_SUBSET_INOUT   2
 

Typedefs

template<class T >
using cs_array = cs::array< T, 1, cs::layout::right >
 
template<class T , cs::layout L = cs::layout::right>
using cs_array_2d = cs::array< T, 2, L >
 
template<class T , cs::layout L = cs::layout::right>
using cs_array_3d = cs::array< T, 3, L >
 
template<class T , cs::layout L = cs::layout::right>
using cs_array_4d = cs::array< T, 4, L >
 
template<class T , int N, cs::layout L = cs::layout::right>
using cs_mdarray = cs::array< T, N, L >
 
template<class T , int N>
using cs_mdarray_r = cs::array< T, N, cs::layout::right >
 
template<class T , int N>
using cs_mdarray_l = cs::array< T, N, cs::layout::left >
 

Functions

template<typename T , size_t stride, typename... Arrays>
void cs_arrays_set_value (const cs_lnum_t n_elts, const T *ref_val, Arrays &&... arrays)
 Assign values to all elements of multiple arrays. ref_val is input as a pointer or an array. More...
 
template<typename T , size_t stride, typename... Arrays>
void cs_arrays_set_value (const cs_lnum_t n_elts, const T ref_val, Arrays &&... arrays)
 Assign values to all elements of multiple arrays. ref_val is input as a scalar. More...
 
template<typename T , size_t stride, typename... Arrays>
void cs_arrays_set_value (cs_dispatch_context &ctx, const cs_lnum_t n_elts, const T *ref_val, Arrays &&... arrays)
 Assign values to all elements of multiple arrays. ref_val is input as a pointer or an array. More...
 
template<typename T , size_t stride, typename... Arrays>
void cs_arrays_set_value (cs_dispatch_context &ctx, const cs_lnum_t n_elts, const T ref_val, Arrays &&... arrays)
 Assign values to all elements of multiple arrays. ref_val is input as a scalar. More...
 
template<typename T , size_t stride, typename... Arrays>
void cs_arrays_set_zero (cs_dispatch_context &ctx, const cs_lnum_t n_elts, Arrays &&... arrays)
 Assign zero value to all elements of multiple arrays. More...
 
template<typename T , size_t stride, typename... Arrays>
void cs_arrays_set_value_on_subset (const cs_lnum_t n_elts, const cs_lnum_t *elt_ids, const T *ref_val, Arrays &&... arrays)
 Assign values on a selected subset of elements to multiple arrays. ref_val is input as a pointer or an array. More...
 
template<typename T , size_t stride, typename... Arrays>
void cs_arrays_set_value_on_subset (const cs_lnum_t n_elts, const cs_lnum_t *elt_ids, const T ref_val, Arrays &&... arrays)
 Assign values on a selected subset of elements to multiple arrays. ref_val is input as a scalar. More...
 
template<typename T >
void cs_array_copy (const cs_lnum_t size, const T *src, T *dest)
 Copy values from an array to another of the same dimensions. More...
 
template<typename T >
void cs_array_difference (cs_lnum_t size, const T *x, const T *y, T *diff)
 Compute the difference diff = x - y. All arrays have the same dimension. More...
 
void cs_array_bool_fill_true (cs_lnum_t size, bool a[])
 Assign true to all elements of an array. Case of an array of booleans. More...
 
void cs_array_bool_fill_false (cs_lnum_t size, bool a[])
 Assign false to all elements of an array. Case of an array of booleans. More...
 
void cs_array_flag_fill_zero (cs_lnum_t size, cs_flag_t a[])
 Assign zero to all elements of an array. Case of a cs_flag_t array. More...
 
void cs_array_lnum_fill_zero (cs_lnum_t size, cs_lnum_t a[])
 Assign zero to all elements of an array. Case of a cs_lnum_t array. More...
 
void cs_array_lnum_copy (cs_lnum_t size, const cs_lnum_t src[], cs_lnum_t dest[])
 Copy values from an array of cs_lnum_t type to another of the same dimensions. More...
 
void cs_array_lnum_set_value (cs_lnum_t size, cs_lnum_t num, cs_lnum_t a[])
 Assign the value "num" to all elements of an array. Case of a cs_lnum_t array. More...
 
void cs_array_lnum_set_value_on_subset (cs_lnum_t n_elts, const cs_lnum_t elt_ids[], cs_lnum_t num, cs_lnum_t a[])
 Assign the value "num" to an array on a selected subset of elements. if elt_ids is null, then one recovers the function cs_array_lnum_set_value. More...
 
void cs_array_int_fill_zero (cs_lnum_t size, int a[])
 Assign zero to all elements of an array. Case of a int array. More...
 
void cs_array_int_set_value (cs_lnum_t size, int num, int a[])
 Assign the value "num" to all elements of an array. Case of a int array. More...
 
void cs_array_int_set_value_on_subset (cs_lnum_t n_elts, const cs_lnum_t elt_ids[], int num, int a[])
 Assign the value "num" to an array on a selected subset of elements. if elt_ids is null, then one recovers the function cs_array_int_set_value. More...
 
void cs_array_real_copy_subset (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 subset of elements on which working is defined by "elt_ids". The way to apply the subset is defined with the parameter "mode" as follows: More...
 
void cs_array_real_copy (cs_lnum_t size, const cs_real_t src[], cs_real_t dest[])
 Copy real values from an array to another of the same dimensions. More...
 
void cs_array_real_scale (cs_lnum_t n_elts, int stride, const cs_lnum_t *elt_ids, cs_real_t scaling_factor, cs_real_t dest[])
 Multiply each value by a scaling factor s.t. dest *= scaling_factor If elt_ids is non-null, one applies an indirection. A stride can also be applied. One assumes an interlaced array. More...
 
void cs_array_real_padd (cs_lnum_t n_elts, const cs_real_t l_add[], cs_real_t r[])
 Add in place an array s.t. r += l_add. More...
 
void cs_array_real_set_value (cs_lnum_t n_elts, int stride, const cs_real_t ref_val[], cs_real_t a[])
 Assign a constant value of dim "stride" to an interlaced array sharing the same stride. More...
 
void cs_array_real_set_wvalue (cs_lnum_t n_elts, int stride, const cs_real_t ref_val[], const cs_real_t weight[], cs_real_t a[])
 Assign a weighted constant value of dim "stride" to an interlaced array sharing the same stride. Apply a weight for each element. This weight is constant for each component of an element. More...
 
void cs_array_real_set_value_on_subset (cs_lnum_t n_elts, int stride, const cs_lnum_t elt_ids[], const cs_real_t ref_val[], cs_real_t a[])
 Assign a constant value of dim "stride" to an interlaced array sharing the same stride. Only a subset of elements are considered. If elt_ids is null, then one recovers the function cs_array_real_set_value. More...
 
void cs_array_real_set_wvalue_on_subset (cs_lnum_t n_elts, int stride, const cs_lnum_t elt_ids[], const cs_real_t ref_val[], const cs_real_t weight[], cs_real_t a[])
 Assign a weighted constant value of dim "stride" to an interlaced array sharing the same stride. Only a subset of elements are considered. If elt_ids is null, then one recovers the function cs_array_real_set_wvalue Apply a weight for each element. This weight is constant for each component of an element. 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_wscalar (cs_lnum_t n_elts, cs_real_t ref_val, const cs_real_t weight[], cs_real_t a[])
 Assign a weighted constant scalar value to an array. The weight array has the same size as the array "a". 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 is null, then one recovers the function cs_array_real_set_scalar. More...
 
void cs_array_real_set_wscalar_on_subset (cs_lnum_t n_elts, const cs_lnum_t elt_ids[], cs_real_t ref_val, const cs_real_t weight[], cs_real_t a[])
 Assign a weighted constant scalar value to an array on a selected subset of elements. If elt_ids is null, then one recovers the function cs_array_real_set_wscalar. 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_wvector (cs_lnum_t n_elts, const cs_real_t ref_val[3], const cs_real_t weight[], cs_real_t a[])
 Assign a weighted constant vector value to an interlaced array (of stride 3). The array of weights has the same size as the array "a". 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 is null, then one recovers the function cs_array_real_set_vector. More...
 
void cs_array_real_set_wvector_on_subset (cs_lnum_t n_elts, const cs_lnum_t elt_ids[], const cs_real_t ref_val[3], const cs_real_t weight[], cs_real_t a[])
 Assign a weighted constant vector value to an interlaced array (of stride 3). The subset selection is given by elt_ids. If null, then one recovers the function cs_array_real_set_wvector The array of weights has the same size as the array "a". 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 is 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...
 

Macro Definition Documentation

◆ CS_ARRAY_SUBSET_IN

#define CS_ARRAY_SUBSET_IN   0

◆ CS_ARRAY_SUBSET_INOUT

#define CS_ARRAY_SUBSET_INOUT   2

◆ CS_ARRAY_SUBSET_NULL

#define CS_ARRAY_SUBSET_NULL   -1

◆ CS_ARRAY_SUBSET_OUT

#define CS_ARRAY_SUBSET_OUT   1

Typedef Documentation

◆ cs_array

◆ cs_array_2d

using cs_array_2d = cs::array<T,2,L>

◆ cs_array_3d

using cs_array_3d = cs::array<T,3,L>

◆ cs_array_4d

using cs_array_4d = cs::array<T,4,L>

◆ cs_mdarray

using cs_mdarray = cs::array<T,N,L>

◆ cs_mdarray_l

◆ cs_mdarray_r

Function Documentation

◆ cs_array_bool_fill_false()

void cs_array_bool_fill_false ( cs_lnum_t  size,
bool  a[] 
)

Assign false to all elements of an array. Case of an array of booleans.

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

◆ cs_array_bool_fill_true()

void cs_array_bool_fill_true ( cs_lnum_t  size,
bool  a[] 
)

Assign true to all elements of an array. Case of an array of booleans.

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

◆ cs_array_copy()

void cs_array_copy ( const cs_lnum_t  size,
const T *  src,
T *  dest 
)

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

Template parmeters. T type name

Parameters
[in]sizenumber of elements * dimension
[in]srcsource array values
[out]destdestination array values

◆ cs_array_difference()

void cs_array_difference ( cs_lnum_t  size,
const T *  x,
const T *  y,
T *  diff 
)

Compute the difference diff = x - y. All arrays have the same dimension.

Template parmeters. T type name

Parameters
[in]sizenumber of elements * dimension
[in]xx array values
[in]yy array values
[out]diffdifference array values

◆ cs_array_flag_fill_zero()

void cs_array_flag_fill_zero ( cs_lnum_t  size,
cs_flag_t  a[] 
)

Assign zero to all elements of an array. Case of a cs_flag_t array.

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

◆ cs_array_int_fill_zero()

void cs_array_int_fill_zero ( cs_lnum_t  size,
int  a[] 
)

Assign zero to all elements of an array. Case of a int array.

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

◆ cs_array_int_set_value()

void cs_array_int_set_value ( cs_lnum_t  size,
int  num,
int  a[] 
)

Assign the value "num" to all elements of an array. Case of a int array.

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

◆ cs_array_int_set_value_on_subset()

void cs_array_int_set_value_on_subset ( cs_lnum_t  n_elts,
const cs_lnum_t  elt_ids[],
int  num,
int  a[] 
)

Assign the value "num" to an array on a selected subset of elements. if elt_ids is null, then one recovers the function cs_array_int_set_value.

Parameters
[in]n_eltsnumber of elements
[in]elt_idslist of ids in the subset or null (size: n_elts)
[in]numvalue to set
[in,out]aarray to set

◆ cs_array_lnum_copy()

void cs_array_lnum_copy ( cs_lnum_t  size,
const cs_lnum_t  src[],
cs_lnum_t  dest[] 
)

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

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

◆ cs_array_lnum_fill_zero()

void cs_array_lnum_fill_zero ( cs_lnum_t  size,
cs_lnum_t  a[] 
)

Assign zero to all elements of an array. Case of a cs_lnum_t array.

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

◆ cs_array_lnum_set_value()

void cs_array_lnum_set_value ( cs_lnum_t  size,
cs_lnum_t  num,
cs_lnum_t  a[] 
)

Assign the value "num" to all elements of an array. Case of a cs_lnum_t array.

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

◆ cs_array_lnum_set_value_on_subset()

void cs_array_lnum_set_value_on_subset ( cs_lnum_t  n_elts,
const cs_lnum_t  elt_ids[],
cs_lnum_t  num,
cs_lnum_t  a[] 
)

Assign the value "num" to an array on a selected subset of elements. if elt_ids is null, then one recovers the function cs_array_lnum_set_value.

Parameters
[in]n_eltsnumber of elements
[in]elt_idslist of ids in the subset or null (size: n_elts)
[in]numvalue to set
[in,out]aarray to set

◆ cs_array_real_copy()

void cs_array_real_copy ( cs_lnum_t  size,
const cs_real_t  src[],
cs_real_t  dest[] 
)

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

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

◆ cs_array_real_copy_subset()

void cs_array_real_copy_subset ( 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 subset of elements on which working is defined by "elt_ids". The way to apply the subset is defined with the parameter "mode" as follows:

  • Only the "ref" array if mode = 0 (CS_ARRAY_SUBSET_IN)
  • Only the "dest" array if mode = 1 (CS_ARRAY_SUBSET_OUT)
  • Both "ref" and "dest" arrays if mode = 2 (CS_ARRAY_SUBSET_INOUT)

It elt_ids is null or mode < 0 (CS_ARRAY_SUBSET_NULL), 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]modeapply the subset ids to which array(s)
[in]elt_idslist of ids in the subset or null (size: n_elts)
[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_padd()

void cs_array_real_padd ( cs_lnum_t  n_elts,
const cs_real_t  l_add[],
cs_real_t  r[] 
)

Add in place an array s.t. r += l_add.

Parameters
[in]n_eltsnumber of elements
[in]l_addarray to add
[out]rdestination array values

◆ cs_array_real_scale()

void cs_array_real_scale ( cs_lnum_t  n_elts,
int  stride,
const cs_lnum_t elt_ids,
cs_real_t  scaling_factor,
cs_real_t  dest[] 
)

Multiply each value by a scaling factor s.t. dest *= scaling_factor If elt_ids is non-null, one applies an indirection. A stride can also be applied. One assumes an interlaced array.

Parameters
[in]n_eltsnumber of elements
[in]stridenumber of values for each element
[in]elt_idslist of ids in the subset or null (size: n_elts)
[in]scaling_factorvalue of the scaling factor
[out]destdestination array values

◆ 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 is null, then one recovers the function cs_array_real_set_scalar.

Parameters
[in]n_eltsnumber of elements
[in]elt_idslist of ids in the subset or null (size: n_elts)
[in]ref_valvalue 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 is 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 nullptr
[in]ref_tenstensor to assign
[in,out]aarray to set

◆ cs_array_real_set_value()

void cs_array_real_set_value ( cs_lnum_t  n_elts,
int  stride,
const cs_real_t  ref_val[],
cs_real_t  a[] 
)

Assign a constant value of dim "stride" to an interlaced array sharing the same stride.

Parameters
[in]n_eltsnumber of elements
[in]stridenumber of values for each element
[in]ref_vallist of values to assign (size: stride)
[in,out]aarray to set (size: n_elts*stride)

◆ cs_array_real_set_value_on_subset()

void cs_array_real_set_value_on_subset ( cs_lnum_t  n_elts,
int  stride,
const cs_lnum_t  elt_ids[],
const cs_real_t  ref_val[],
cs_real_t  a[] 
)

Assign a constant value of dim "stride" to an interlaced array sharing the same stride. Only a subset of elements are considered. If elt_ids is null, then one recovers the function cs_array_real_set_value.

Parameters
[in]n_eltsnumber of elements
[in]stridenumber of values for each element
[in]elt_idslist of ids in the subset or null (size: n_elts)
[in]ref_vallist of values to assign (size: stride)
[in,out]aarray to set (size >= n_elts * stride)

◆ 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 is null, then one recovers the function cs_array_real_set_vector.

Parameters
[in]n_eltsnumber of elements
[in]elt_idslist of ids in the subset or null (size: n_elts)
[in]ref_valvector to assign
[in,out]aarray to set

◆ cs_array_real_set_wscalar()

void cs_array_real_set_wscalar ( cs_lnum_t  n_elts,
cs_real_t  ref_val,
const cs_real_t  weight[],
cs_real_t  a[] 
)

Assign a weighted constant scalar value to an array. The weight array has the same size as the array "a".

Parameters
[in]n_eltsnumber of elements
[in]ref_valvalue to assign
[in]weightvalues of the weight to apply
[in,out]aarray to set

◆ cs_array_real_set_wscalar_on_subset()

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

Assign a weighted constant scalar value to an array on a selected subset of elements. If elt_ids is null, then one recovers the function cs_array_real_set_wscalar.

Parameters
[in]n_eltsnumber of elements
[in]elt_idslist of ids in the subset or null (size: n_elts)
[in]ref_valvalue to assign
[in]weightvalues of weights to apply
[in,out]aarray to set

◆ cs_array_real_set_wvalue()

void cs_array_real_set_wvalue ( cs_lnum_t  n_elts,
int  stride,
const cs_real_t  ref_val[],
const cs_real_t  weight[],
cs_real_t  a[] 
)

Assign a weighted constant value of dim "stride" to an interlaced array sharing the same stride. Apply a weight for each element. This weight is constant for each component of an element.

Parameters
[in]n_eltsnumber of elements
[in]stridenumber of values for each element
[in]ref_vallist of values to assign (size: stride)
[in]weightvalues of the weight to apply (size: n_elts)
[in,out]aarray to set (size: n_elts*stride)

◆ cs_array_real_set_wvalue_on_subset()

void cs_array_real_set_wvalue_on_subset ( cs_lnum_t  n_elts,
int  stride,
const cs_lnum_t  elt_ids[],
const cs_real_t  ref_val[],
const cs_real_t  weight[],
cs_real_t  a[] 
)

Assign a weighted constant value of dim "stride" to an interlaced array sharing the same stride. Only a subset of elements are considered. If elt_ids is null, then one recovers the function cs_array_real_set_wvalue Apply a weight for each element. This weight is constant for each component of an element.

Parameters
[in]n_eltsnumber of elements
[in]stridenumber of values for each element
[in]elt_idslist of ids in the subset or null (size: n_elts)
[in]ref_vallist of values to assign (size: stride)
[in]weightvalues of the weight to apply (size >= n_elts)
[in,out]aarray to set (size >= n_elts*stride)

◆ cs_array_real_set_wvector()

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

Assign a weighted constant vector value to an interlaced array (of stride 3). The array of weights has the same size as the array "a".

Parameters
[in]n_eltsnumber of elements
[in]ref_valvector to assign
[in]weightvalues of the weight to apply
[in,out]aarray to set

◆ cs_array_real_set_wvector_on_subset()

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

Assign a weighted constant vector value to an interlaced array (of stride 3). The subset selection is given by elt_ids. If null, then one recovers the function cs_array_real_set_wvector The array of weights has the same size as the array "a".

Parameters
[in]n_eltsnumber of elements
[in]elt_idslist of ids in the subset or null (size: n_elts)
[in]ref_valvector to assign
[in]weightvalues of the weight to apply
[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)

◆ cs_arrays_set_value() [1/4]

void cs_arrays_set_value ( const cs_lnum_t  n_elts,
const T *  ref_val,
Arrays &&...  arrays 
)

Assign values to all elements of multiple arrays. ref_val is input as a pointer or an array.

Template parmeters. T type name stride 1 for scalars, 3 for vectors, 6 for symetric tensors Arrays varadiac parameters pack

Function parameters:

Parameters
[in]n_eltstotal number of elements to set
[in]ref_valvalue to assign
[out]arraysarrays to set

◆ cs_arrays_set_value() [2/4]

void cs_arrays_set_value ( const cs_lnum_t  n_elts,
const T  ref_val,
Arrays &&...  arrays 
)

Assign values to all elements of multiple arrays. ref_val is input as a scalar.

Template parmeters. T type name stride 1 for scalars, 3 for vectors, 6 for symetric tensors Arrays varadiac parameters pack

Function parameters:

Parameters
[in]n_eltstotal number of elements to set
[in]ref_valvalue to assign
[out]arraysarrays to set

◆ cs_arrays_set_value() [3/4]

void cs_arrays_set_value ( cs_dispatch_context ctx,
const cs_lnum_t  n_elts,
const T *  ref_val,
Arrays &&...  arrays 
)

Assign values to all elements of multiple arrays. ref_val is input as a pointer or an array.

In the case of asynchronous task launches (such as on GPUs), this function returns immediately after scheduling the assignement. To guarantee the operation is finished, use ctx.wait().

Template parmeters. T type name stride 1 for scalars, 3 for vectors, 6 for symetric tensors Arrays varadiac parameters pack

Parameters
[in,out]ctxreference to dispatch context
[in]n_eltstotal number of elements to set
[in]ref_valvalue to assign
[out]arraysarrays to set

◆ cs_arrays_set_value() [4/4]

void cs_arrays_set_value ( cs_dispatch_context ctx,
const cs_lnum_t  n_elts,
const T  ref_val,
Arrays &&...  arrays 
)

Assign values to all elements of multiple arrays. ref_val is input as a scalar.

In the case of asynchronous task launches (such as on GPUs), this function returns immediately after scheduling the assignement. To guarantee the operation is finished, use ctx.wait().

Template parmeters. T type name stride 1 for scalars, 3 for vectors, 6 for symetric tensors Arrays varadiac parameters pack

Parameters
[in,out]ctxreference to dispatch context
[in]n_eltstotal number of elements to set
[in]ref_valvalue to assign
[out]arraysarrays to set

◆ cs_arrays_set_value_on_subset() [1/2]

void cs_arrays_set_value_on_subset ( const cs_lnum_t  n_elts,
const cs_lnum_t elt_ids,
const T *  ref_val,
Arrays &&...  arrays 
)

Assign values on a selected subset of elements to multiple arrays. ref_val is input as a pointer or an array.

Template parmeters. T type name stride 1 for scalars, 3 for vectors, 6 for symetric tensors Arrays varadiac parameters pack

Function parameters:

Parameters
[in]n_eltstotal number of elements to set
[in]elt_idslist of ids in the subset or null (size: n_elts)
[in]ref_valvalue to assign
[out]arraysarrays to set

◆ cs_arrays_set_value_on_subset() [2/2]

void cs_arrays_set_value_on_subset ( const cs_lnum_t  n_elts,
const cs_lnum_t elt_ids,
const T  ref_val,
Arrays &&...  arrays 
)

Assign values on a selected subset of elements to multiple arrays. ref_val is input as a scalar.

Template parmeters. T type name stride 1 for scalars, 3 for vectors, 6 for symetric tensors Arrays varadiac parameters pack

Function parameters:

Parameters
[in]n_eltstotal number of elements to set
[in]elt_idslist of ids in the subset or null (size: n_elts)
[in]ref_valvalue to assign
[out]arraysarrays to set

◆ cs_arrays_set_zero()

void cs_arrays_set_zero ( cs_dispatch_context ctx,
const cs_lnum_t  n_elts,
Arrays &&...  arrays 
)

Assign zero value to all elements of multiple arrays.

In the case of asynchronous task launches (such as on GPUs), this function returns immediately after scheduling the assignement. To guarantee the operation is finished, use ctx.wait().

Template parmeters. T type name stride 1 for scalars, 3 for vectors, 6 for symetric tensors Arrays varadiac parameters pack

Parameters
[in,out]ctxreference to dispatch context
[in]n_eltstotal number of elements to set
[out]arraysarrays to set