9.1
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< 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_alloc_mode_t get_vals_alloc_mode (const int time_id=0) const
 Get the allocation mode of the values array. More...
 
void update_size (void)
 Resize field values automatically (vals, val, val_pre) based on the corresponding mesh_location. 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)
 Return a integer value for a given key associated with a field. More...
 
int get_key_int (const char *key)
 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)
 Return a floating point value for a given key associated with a field. More...
 
double get_key_double (const char *key)
 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)
 Return a character string for a given key associated with a field. More...
 
const char * get_key_str (const char *key)
 Return a character string 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
 
cs_array_2d< cs_real_t > ** _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_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_key_double() [1/2]

double get_key_double ( const char *  key)

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)

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)

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)

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)

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)

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_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.

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.

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.

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

◆ 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

◆ update_size()

void update_size ( void  )

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

Member Data Documentation

◆ _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

◆ 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: