9.2
general documentation
cs_field_t Class Reference

Field descriptor. More...

#include <cs_field.h>

+ Collaboration diagram for cs_field_t:

Public Member Functions

cs_span_2d< cs_real_tview (const int time_id=0) const
 Return a 2D span view of field values (n_vals, dim), even if the field is a scalar, in which case dim = 1. More...
 
cs_span< cs_real_tget_vals_s (const int time_id=0) const
 Return a 1D span view of field values. If the field is not a scalar a fatal error is provoked. More...
 
cs_span_2d< cs_real_tget_vals_v (const int time_id=0) const
 Return a 2D span view of field values. If the field is not a vector a fatal error is provoked. More...
 
cs_span_2d< cs_real_tget_vals_t (const int time_id=0) const
 Return a 2D span view of field values. If the field is not a tensor a fatal error is provoked. More...
 
cs_span< cs_real_tget_val_s (const int time_id=0) const
 Return a 1D span view of field values. If the field is not a scalar a fatal error is provoked. More...
 
cs_span_2d< cs_real_tget_val_v (const int time_id=0) const
 Return a 2D span view of field values. If the field is not a vector a fatal error is provoked. More...
 
cs_span_2d< cs_real_tget_val_t (const int time_id=0) const
 Return a 2D span view of field values. If the field is not a tensor a fatal error is provoked. More...
 
cs_span_2d< cs_real_tget_grad_s () const
 Return a 2D span view of gradient values. If the field is not a scalar or if the gradient member is nullptr, a fatal error is provoked. More...
 
cs_span_3d< cs_real_tget_grad_v () const
 Return a 3D span view of gradient values. If the field is not a vector or if the gradient member is nullptr, a fatal error is provoked. More...
 
cs_span_3d< cs_real_tget_grad_t () const
 Return a 3D span view of gradient values. If the field is not a tensor or if the gradient member is nullptr, a fatal error is provoked. More...
 
cs_alloc_mode_t get_vals_alloc_mode (const int time_id=0) const
 Get the allocation mode of the values array. More...
 
cs_span_3d< cs_real_tns_view (const int time_id=0) const
 Return a 3D span view of field values. The view is of dimensions (ns_fields, n_vals, dim) More...
 
cs_span_2d< cs_real_tget_ns_vals_s (const int time_id=0) const
 Return a 1D span view of field values. If the field is not a scalar a fatal error is provoked. More...
 
cs_span_3d< cs_real_tget_ns_vals_v (const int time_id=0) const
 Return a 2D span view of field values. If the field is not a vector a fatal error is provoked. More...
 
cs_span_3d< cs_real_tget_ns_vals_t (const int time_id=0) const
 Return a 2D span view of field values. If the field is not a tensor a fatal error is provoked. More...
 
cs_span_2d< cs_real_tget_ns_val_s (const int time_id=0) const
 Return a 1D span view of field values. If the field is not a scalar a fatal error is provoked. More...
 
cs_span_3d< cs_real_tget_ns_val_v (const int time_id=0) const
 Return a 2D span view of field values. If the field is not a vector a fatal error is provoked. More...
 
cs_span_3d< cs_real_tget_ns_val_t (const int time_id=0) const
 Return a 2D span view of field values. If the field is not a tensor a fatal error is provoked. More...
 
void update_public_pointers (void)
 Update public pointers based on private members. More...
 
void update_size (const int time_id=-1)
 Resize field values automatically (vals, val, val_pre) based on the corresponding mesh_location. More...
 
void clear (const int time_id=-1)
 Clear data allocation. More...
 
void update_sub_fields_mapping (void) const
 Update data mapping for all sub-fields. More...
 
void map_values (cs_real_t *val_new, cs_real_t *val_pre_new)
 Map existing value arrays to field descriptor. More...
 
CS_F_HOST_DEVICE void set_ns_owner (int owner_id)
 
CS_F_HOST_DEVICE void set_ns_parameters (const int series_size, const int series_idx, const int series_owner)
 
CS_F_HOST_DEVICE bool is_series_owner () const
 
CS_F_HOST_DEVICE bool is_part_of_series () const
 
CS_F_HOST_DEVICE bool owner () const
 
CS_F_HOST_DEVICE int series_size () const
 
CS_F_HOST_DEVICE int series_owner () const
 
CS_F_HOST_DEVICE int series_id () const
 
CS_F_HOST_DEVICE bool has_sub_fields () const
 
CS_F_HOST_DEVICE bool is_sub_field () const
 
CS_F_HOST_DEVICE bool is_sub_field_of (const int owner_id) const
 
CS_F_HOST void initialize_sub_fields (void)
 Initialize values related to sub-fields (indices mainly) More...
 
CS_F_HOST void map_to_ns_data (void)
 Map internal and public pointers to data series owner. More...
 
int set_key_int (int key_id, int value)
 Assign a integer value for a given key to a field. More...
 
int set_key_int (const char *key, int value)
 Assign a integer value for a given key to a field. More...
 
int get_key_int (int key_id) const
 Return a integer value for a given key associated with a field. More...
 
int get_key_int (const char *key) const
 Return a integer value for a given key associated with a field. More...
 
int set_key_int_bits (int key_id, int mask)
 Set integer bits matching a mask to 1 for a given key for a field. More...
 
int set_key_int_bits (const char *key, int mask)
 Set integer bits matching a mask to 1 for a given key for a field. More...
 
int clear_key_int_bits (int key_id, int mask)
 Set integer bits matching a mask to 0 for a given key for a field. More...
 
int clear_key_int_bits (const char *key, int mask)
 Set integer bits matching a mask to 0 for a given key for a field. More...
 
int set_key_double (int key_id, double value)
 Assign a floating point value for a given key to a field. More...
 
int set_key_double (const char *key, double value)
 Assign a floating point value for a given key to a field. More...
 
double get_key_double (int key_id) const
 Return a floating point value for a given key associated with a field. More...
 
double get_key_double (const char *key) const
 Return a floating point value for a given key associated with a field. More...
 
int set_key_str (int key_id, const char *str)
 Assign a character string for a given key to a field. More...
 
int set_key_str (const char *key, const char *str)
 Assign a character string for a given key to a field. More...
 
const char * get_key_str (int key_id) const
 Return a character string for a given key associated with a field. More...
 
const char * get_key_str (const char *key) const
 Return a character string for a given key associated with a field. More...
 
const void * get_key_struct (const int key_id, void *s) const
 Return a structure for a given key associated with a field. More...
 
const void * get_key_struct (const char *key, void *s) const
 Return a structure for a given key associated with a field. More...
 

Public Attributes

const char * name
 
int id
 
int type
 
int dim
 
int location_id
 
int n_time_vals
 
cs_real_t ** vals
 
cs_real_tval
 
cs_real_tval_pre
 
cs_real_tgrad
 
cs_field_bc_coeffs_tbc_coeffs
 
bool is_owner
 
int ns_size
 
int ns_idx
 
int ns_owner
 
cs_array_2d< cs_real_t > ** _vals
 
cs_array_3d< cs_real_t > ** _ns_vals
 

Detailed Description

Field descriptor.

Members of this field are publicly accessible, to allow for concise syntax, as it is expected to be used in many places.

Member Function Documentation

◆ clear()

void clear ( const int  time_id = -1)

Clear data allocation.

◆ clear_key_int_bits() [1/2]

int clear_key_int_bits ( const char *  key,
int  mask 
)

Set integer bits matching a mask to 0 for a given key for a field.

If the key id is not valid, CS_FIELD_INVALID_KEY_ID is returned. If the field category is not compatible with the key (as defined by its type flag), CS_FIELD_INVALID_CATEGORY is returned. If the data type does not match, CS_FIELD_INVALID_TYPE is returned. If the key value has been locked, CS_FIELD_LOCKED is returned.

Returns
0 in case of success, > 1 in case of error
Parameters
[in]keykey string
[in]maskmask

◆ clear_key_int_bits() [2/2]

int clear_key_int_bits ( int  key_id,
int  mask 
)

Set integer bits matching a mask to 0 for a given key for a field.

If the key id is not valid, CS_FIELD_INVALID_KEY_ID is returned. If the field category is not compatible with the key (as defined by its type flag), CS_FIELD_INVALID_CATEGORY is returned. If the data type does not match, CS_FIELD_INVALID_TYPE is returned. If the key value has been locked, CS_FIELD_LOCKED is returned.

Returns
0 in case of success, > 1 in case of error
Parameters
[in]key_idkey id
[in]maskmask

◆ get_grad_s()

cs_span_2d< cs_real_t > get_grad_s ( ) const

Return a 2D span view of gradient values. If the field is not a scalar or if the gradient member is nullptr, a fatal error is provoked.

Returns
cs_span_2d<cs_real_t>(:,3) view of the gradient values.

◆ get_grad_t()

cs_span_3d< cs_real_t > get_grad_t ( ) const

Return a 3D span view of gradient values. If the field is not a tensor or if the gradient member is nullptr, a fatal error is provoked.

Returns
cs_span_3d<cs_real_t>(:,6,3) view of the gradient values.

◆ get_grad_v()

cs_span_3d< cs_real_t > get_grad_v ( ) const

Return a 3D span view of gradient values. If the field is not a vector or if the gradient member is nullptr, a fatal error is provoked.

Returns
cs_span_3d<cs_real_t>(:,3,3) view of the gradient values.

◆ get_key_double() [1/2]

double get_key_double ( const char *  key) const

Return a floating point value for a given key associated with a field.

If the key id is not valid, or the value type or field category is not compatible, a fatal error is provoked.

Returns
value associated with the key id for this field
Parameters
[in]keykey string

◆ get_key_double() [2/2]

double get_key_double ( int  key_id) const

Return a floating point value for a given key associated with a field.

If the key id is not valid, or the value type or field category is not compatible, a fatal error is provoked.

Returns
value associated with the key id for this field
Parameters
[in]key_idkey id

◆ get_key_int() [1/2]

int get_key_int ( const char *  key) const

Return a integer value for a given key associated with a field.

If the key id is not valid, or the value type or field category is not compatible, a fatal error is provoked.

Returns
value associated with the key id for this field
Parameters
[in]keykey string

◆ get_key_int() [2/2]

int get_key_int ( int  key_id) const

Return a integer value for a given key associated with a field.

If the key id is not valid, or the value type or field category is not compatible, a fatal error is provoked.

Returns
value associated with the key id for this field
Parameters
[in]key_idkey id

◆ get_key_str() [1/2]

const char * get_key_str ( const char *  key) const

Return a character string for a given key associated with a field.

If the key id is not valid, or the value type or field category is not compatible, a fatal error is provoked.

Returns
string associated with the key id for this field
Parameters
[in]keykey string

◆ get_key_str() [2/2]

const char * get_key_str ( int  key_id) const

Return a character string for a given key associated with a field.

If the key id is not valid, or the value type or field category is not compatible, a fatal error is provoked.

Returns
string associated with the key id for this field
Parameters
[in]key_idkey id

◆ get_key_struct() [1/2]

const void * get_key_struct ( const char *  key,
void *  s 
) const

Return a structure for a given key associated with a field.

If the key id is not valid, or the value type or field category is not compatible, a fatal error is provoked.

Returns
pointer to structure associated with the key id for this field (same as s)
Parameters
[in]keyKey string
[out]sstructure associated with key

◆ get_key_struct() [2/2]

const void * get_key_struct ( const int  key_id,
void *  s 
) const

Return a structure for a given key associated with a field.

If the key id is not valid, or the value type or field category is not compatible, a fatal error is provoked.

Returns
pointer to structure associated with the key id for this field (same as s)
Parameters
[in]key_idid of associated key
[out]sstructure associated with key

◆ get_ns_val_s()

cs_span_2d< cs_real_t > get_ns_val_s ( const int  time_id = 0) const

Return a 1D span view of field values. If the field is not a scalar a fatal error is provoked.

Returns
cs_span<cs_real_t> view of field values.
Parameters
[in]time_idtime value id to get. 0 for val, 1 for val_pre

◆ get_ns_val_t()

cs_span_3d< cs_real_t > get_ns_val_t ( const int  time_id = 0) const

Return a 2D span view of field values. If the field is not a tensor a fatal error is provoked.

Returns
cs_span_2d<cs_real_t>(:,6) view of field values.
Parameters
[in]time_idtime value id to get. 0 for val, 1 for val_pre

◆ get_ns_val_v()

cs_span_3d< cs_real_t > get_ns_val_v ( const int  time_id = 0) const

Return a 2D span view of field values. If the field is not a vector a fatal error is provoked.

Returns
cs_span_2d<cs_real_t>(:,3) view of field values.
Parameters
[in]time_idtime value id to get. 0 for val, 1 for val_pre

◆ get_ns_vals_s()

cs_span_2d< cs_real_t > get_ns_vals_s ( const int  time_id = 0) const

Return a 1D span view of field values. If the field is not a scalar a fatal error is provoked.

Deprecated:
Use get_ns_val_s instead
Returns
cs_span<cs_real_t> view of field values.
Parameters
[in]time_idtime value id to get. 0 for val, 1 for val_pre

◆ get_ns_vals_t()

cs_span_3d< cs_real_t > get_ns_vals_t ( const int  time_id = 0) const

Return a 2D span view of field values. If the field is not a tensor a fatal error is provoked.

Deprecated:
Use get_ns_val_t instead
Returns
cs_span_2d<cs_real_t>(:,6) view of field values.
Parameters
[in]time_idtime value id to get. 0 for val, 1 for val_pre

◆ get_ns_vals_v()

cs_span_3d< cs_real_t > get_ns_vals_v ( const int  time_id = 0) const

Return a 2D span view of field values. If the field is not a vector a fatal error is provoked.

Deprecated:
Use get_ns_val_v instead
Returns
cs_span_2d<cs_real_t>(:,3) view of field values.
Parameters
[in]time_idtime value id to get. 0 for val, 1 for val_pre

◆ get_val_s()

cs_span< cs_real_t > get_val_s ( const int  time_id = 0) const

Return a 1D span view of field values. If the field is not a scalar a fatal error is provoked.

Returns
cs_span<cs_real_t> view of field values.
Parameters
[in]time_idtime value id to get. 0 for val, 1 for val_pre

◆ get_val_t()

cs_span_2d< cs_real_t > get_val_t ( const int  time_id = 0) const

Return a 2D span view of field values. If the field is not a tensor a fatal error is provoked.

Returns
cs_span_2d<cs_real_t>(:,6) view of field values.
Parameters
[in]time_idtime value id to get. 0 for val, 1 for val_pre

◆ get_val_v()

cs_span_2d< cs_real_t > get_val_v ( const int  time_id = 0) const

Return a 2D span view of field values. If the field is not a vector a fatal error is provoked.

Returns
cs_span_2d<cs_real_t>(:,3) view of field values.
Parameters
[in]time_idtime value id to get. 0 for val, 1 for val_pre

◆ get_vals_alloc_mode()

cs_alloc_mode_t get_vals_alloc_mode ( const int  time_id = 0) const

Get the allocation mode of the values array.

Returns
cs_alloc_mode_t corresponding to the used allocation mode.
Parameters
[in]time_idtime value id to get. 0 for val, 1 for val_pre

◆ get_vals_s()

cs_span< cs_real_t > get_vals_s ( const int  time_id = 0) const

Return a 1D span view of field values. If the field is not a scalar a fatal error is provoked.

Deprecated:
Use get_val_s instead
Returns
cs_span<cs_real_t> view of field values.
Parameters
[in]time_idtime value id to get. 0 for val, 1 for val_pre

◆ get_vals_t()

cs_span_2d< cs_real_t > get_vals_t ( const int  time_id = 0) const

Return a 2D span view of field values. If the field is not a tensor a fatal error is provoked.

Deprecated:
Use get_val_t instead
Returns
cs_span_2d<cs_real_t>(:,6) view of field values.
Parameters
[in]time_idtime value id to get. 0 for val, 1 for val_pre

◆ get_vals_v()

cs_span_2d< cs_real_t > get_vals_v ( const int  time_id = 0) const

Return a 2D span view of field values. If the field is not a vector a fatal error is provoked.

Deprecated:
Use get_val_v instead
Returns
cs_span_2d<cs_real_t>(:,3) view of field values.
Parameters
[in]time_idtime value id to get. 0 for val, 1 for val_pre

◆ has_sub_fields()

CS_F_HOST_DEVICE bool has_sub_fields ( ) const
inline

◆ initialize_sub_fields()

void initialize_sub_fields ( void  )

Initialize values related to sub-fields (indices mainly)

◆ is_part_of_series()

CS_F_HOST_DEVICE bool is_part_of_series ( ) const
inline

◆ is_series_owner()

CS_F_HOST_DEVICE bool is_series_owner ( ) const
inline

◆ is_sub_field()

CS_F_HOST_DEVICE bool is_sub_field ( ) const
inline

◆ is_sub_field_of()

CS_F_HOST_DEVICE bool is_sub_field_of ( const int  owner_id) const
inline

◆ map_to_ns_data()

void map_to_ns_data ( void  )

Map internal and public pointers to data series owner.

◆ map_values()

void map_values ( cs_real_t val_new,
cs_real_t val_pre_new 
)

Map existing value arrays to field descriptor.

Parameters
[in]val_newpointer to array of values
[in]val_pre_newpointer to array of previous values, or nullptr

◆ ns_view()

cs_span_3d< cs_real_t > ns_view ( const int  time_id = 0) const

Return a 3D span view of field values. The view is of dimensions (ns_fields, n_vals, dim)

Returns
cs_span_3d<cs_real_t> view of ns field values.
Parameters
[in]time_idtime value id to get. 0 for val, 1 for val_pre

◆ owner()

CS_F_HOST_DEVICE bool owner ( ) const
inline

◆ series_id()

CS_F_HOST_DEVICE int series_id ( ) const
inline

◆ series_owner()

CS_F_HOST_DEVICE int series_owner ( ) const
inline

◆ series_size()

CS_F_HOST_DEVICE int series_size ( ) const
inline

◆ set_key_double() [1/2]

int set_key_double ( const char *  key,
double  value 
)

Assign a floating point value for a given key to a field.

If the key id is not valid, CS_FIELD_INVALID_KEY_ID is returned. If the field category is not compatible with the key (as defined by its type flag), CS_FIELD_INVALID_CATEGORY is returned. If the data type does not match, CS_FIELD_INVALID_TYPE is returned. If the key value has been locked, CS_FIELD_LOCKED is returned.

Returns
0 in case of success, > 1 in case of error
Parameters
[in]keykey string
[in]valuevalue

◆ set_key_double() [2/2]

int set_key_double ( int  key_id,
double  value 
)

Assign a floating point value for a given key to a field.

If the key id is not valid, CS_FIELD_INVALID_KEY_ID is returned. If the field category is not compatible with the key (as defined by its type flag), CS_FIELD_INVALID_CATEGORY is returned. If the data type does not match, CS_FIELD_INVALID_TYPE is returned. If the key value has been locked, CS_FIELD_LOCKED is returned.

Returns
0 in case of success, > 1 in case of error
Parameters
[in]key_idkey id
[in]valuevalue

◆ set_key_int() [1/2]

int set_key_int ( const char *  key,
int  value 
)

Assign a integer value for a given key to a field.

If the key id is not valid, CS_FIELD_INVALID_KEY_ID is returned. If the field category is not compatible with the key (as defined by its type flag), CS_FIELD_INVALID_CATEGORY is returned. If the data type does not match, CS_FIELD_INVALID_TYPE is returned. If the key value has been locked, CS_FIELD_LOCKED is returned.

Returns
0 in case of success, > 1 in case of error
Parameters
[in]keykey string
[in]valuevalue

◆ set_key_int() [2/2]

int set_key_int ( int  key_id,
int  value 
)

Assign a integer value for a given key to a field.

If the key id is not valid, CS_FIELD_INVALID_KEY_ID is returned. If the field category is not compatible with the key (as defined by its type flag), CS_FIELD_INVALID_CATEGORY is returned. If the data type does not match, CS_FIELD_INVALID_TYPE is returned. If the key value has been locked, CS_FIELD_LOCKED is returned.

Returns
0 in case of success, > 1 in case of error
Parameters
[in]key_idkey id
[in]valuevalue

◆ set_key_int_bits() [1/2]

int set_key_int_bits ( const char *  key,
int  mask 
)

Set integer bits matching a mask to 1 for a given key for a field.

If the key id is not valid, CS_FIELD_INVALID_KEY_ID is returned. If the field category is not compatible with the key (as defined by its type flag), CS_FIELD_INVALID_CATEGORY is returned. If the data type does not match, CS_FIELD_INVALID_TYPE is returned. If the key value has been locked, CS_FIELD_LOCKED is returned.

Returns
0 in case of success, > 1 in case of error
Parameters
[in]keykey string
[in]maskmask

◆ set_key_int_bits() [2/2]

int set_key_int_bits ( int  key_id,
int  mask 
)

Set integer bits matching a mask to 1 for a given key for a field.

If the key id is not valid, CS_FIELD_INVALID_KEY_ID is returned. If the field category is not compatible with the key (as defined by its type flag), CS_FIELD_INVALID_CATEGORY is returned. If the data type does not match, CS_FIELD_INVALID_TYPE is returned. If the key value has been locked, CS_FIELD_LOCKED is returned.

Returns
0 in case of success, > 1 in case of error
Parameters
[in]key_idkey id
[in]maskmask

◆ set_key_str() [1/2]

int set_key_str ( const char *  key,
const char *  str 
)

Assign a character string for a given key to a field.

If the key id is not valid, CS_FIELD_INVALID_KEY_ID is returned. If the field category is not compatible with the key (as defined by its type flag), CS_FIELD_INVALID_CATEGORY is returned. If the data type does not match, CS_FIELD_INVALID_TYPE is returned. If the key value has been locked, CS_FIELD_LOCKED is returned.

Returns
0 in case of success, > 1 in case of error
Parameters
[in]keykey string
[in]strstring associated with the key

◆ set_key_str() [2/2]

int set_key_str ( int  key_id,
const char *  str 
)

Assign a character string for a given key to a field.

If the key id is not valid, CS_FIELD_INVALID_KEY_ID is returned. If the field category is not compatible with the key (as defined by its type flag), CS_FIELD_INVALID_CATEGORY is returned. If the data type does not match, CS_FIELD_INVALID_TYPE is returned. If the key value has been locked, CS_FIELD_LOCKED is returned.

Returns
0 in case of success, > 1 in case of error
Parameters
[in]key_idkey id
[in]strstring associated with the key

◆ set_ns_owner()

CS_F_HOST_DEVICE void set_ns_owner ( int  owner_id)
inline

◆ set_ns_parameters()

CS_F_HOST_DEVICE void set_ns_parameters ( const int  series_size,
const int  series_idx,
const int  series_owner 
)
inline

◆ update_public_pointers()

void update_public_pointers ( void  )

Update public pointers based on private members.

◆ update_size()

void update_size ( const int  time_id = -1)

Resize field values automatically (vals, val, val_pre) based on the corresponding mesh_location.

Parameters
[in]time_idtime_id to reshape, -1 for all (default)

◆ update_sub_fields_mapping()

void update_sub_fields_mapping ( void  ) const

Update data mapping for all sub-fields.

◆ view()

cs_span_2d< cs_real_t > view ( const int  time_id = 0) const

Return a 2D span view of field values (n_vals, dim), even if the field is a scalar, in which case dim = 1.

Returns
cs_span_2d<cs_real_t> view of field values
Parameters
[in]time_idtime value id to get. 0 for val, 1 for val_pre

Member Data Documentation

◆ _ns_vals

cs_array_3d<cs_real_t>** _ns_vals

◆ _vals

◆ bc_coeffs

bc_coeffs

Boundary condition coefficients, for variable type fields

◆ dim

dim

Field dimension (usually 1 for scalar, 3 for vector, or 6 for symmetric tensor)

◆ grad

cs_real_t* grad

◆ id

id

Field id (based on order of field declaration, starting at 0)

◆ is_owner

is_owner

Ownership flag for values

◆ location_id

location_id

Id of matching mesh location

◆ n_time_vals

n_time_vals

Number of time values

◆ name

name

Canonical name

◆ ns_idx

int ns_idx

◆ ns_owner

int ns_owner

◆ ns_size

int ns_size

◆ type

type

Field type flag (sum of field mask constants, defining if a field is a variable, a property, ...)

◆ val

val

For each active location, pointer to matching values array

◆ val_pre

val_pre

For each active location, pointer to matching previous values array (only if n_time_vals > 1)

◆ vals

vals

vals[0][:] is a pointer to val vals[1][:] is a pointer to val_pre vals[p][:] is a pointer to p ith previous field values


The documentation for this class was generated from the following files: