Field descriptor. More...
#include <cs_field.h>
Collaboration diagram for cs_field_t:Public Member Functions | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| 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. 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_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) More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| 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. 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_t * | val |
| cs_real_t * | val_pre |
| cs_real_t * | grad |
| cs_field_bc_coeffs_t * | bc_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 |
Field descriptor.
Members of this field are publicly accessible, to allow for concise syntax, as it is expected to be used in many places.
| void clear | ( | const int | time_id = -1 | ) |
Clear data allocation.
| 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.
| [in] | key | key string |
| [in] | mask | mask |
| 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.
| [in] | key_id | key id |
| [in] | mask | mask |
| 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.
| 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.
| 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.
| 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.
| [in] | key | key string |
| 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.
| [in] | key_id | key id |
| 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.
| [in] | key | key string |
| 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.
| [in] | key_id | key id |
| 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.
| [in] | key | key string |
| 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.
| [in] | key_id | key id |
| 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.
| [in] | key | Key string |
| [out] | s | structure associated with key |
| 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.
| [in] | key_id | id of associated key |
| [out] | s | structure associated with key |
| 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.
| [in] | time_id | time value id to get. 0 for val, 1 for val_pre |
| 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.
| [in] | time_id | time value id to get. 0 for val, 1 for val_pre |
| 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.
| [in] | time_id | time value id to get. 0 for val, 1 for val_pre |
| 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.
| [in] | time_id | time value id to get. 0 for val, 1 for val_pre |
| 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.
| [in] | time_id | time value id to get. 0 for val, 1 for val_pre |
| 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.
| [in] | time_id | time value id to get. 0 for val, 1 for val_pre |
Return a 1D span view of field values. If the field is not a scalar a fatal error is provoked.
| [in] | time_id | time value id to get. 0 for val, 1 for val_pre |
| 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.
| [in] | time_id | time value id to get. 0 for val, 1 for val_pre |
| 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.
| [in] | time_id | time value id to get. 0 for val, 1 for val_pre |
| cs_alloc_mode_t get_vals_alloc_mode | ( | const int | time_id = 0 | ) | const |
Get the allocation mode of the values array.
| [in] | time_id | time value id to get. 0 for val, 1 for val_pre |
Return a 1D span view of field values. If the field is not a scalar a fatal error is provoked.
| [in] | time_id | time value id to get. 0 for val, 1 for val_pre |
| 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.
| [in] | time_id | time value id to get. 0 for val, 1 for val_pre |
| 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.
| [in] | time_id | time value id to get. 0 for val, 1 for val_pre |
|
inline |
| void initialize_sub_fields | ( | void | ) |
Initialize values related to sub-fields (indices mainly)
|
inline |
|
inline |
|
inline |
|
inline |
| void map_to_ns_data | ( | void | ) |
Map internal and public pointers to data series owner.
Map existing value arrays to field descriptor.
| [in] | val_new | pointer to array of values |
| [in] | val_pre_new | pointer to array of previous values, or nullptr |
| 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)
| [in] | time_id | time value id to get. 0 for val, 1 for val_pre |
|
inline |
|
inline |
|
inline |
|
inline |
| 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.
| [in] | key | key string |
| [in] | value | value |
| 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.
| [in] | key_id | key id |
| [in] | value | value |
| 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.
| [in] | key | key string |
| [in] | value | value |
| 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.
| [in] | key_id | key id |
| [in] | value | value |
| 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.
| [in] | key | key string |
| [in] | mask | mask |
| 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.
| [in] | key_id | key id |
| [in] | mask | mask |
| 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.
| [in] | key | key string |
| [in] | str | string associated with the key |
| 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.
| [in] | key_id | key id |
| [in] | str | string associated with the key |
|
inline |
|
inline |
| void update_public_pointers | ( | void | ) |
Update public pointers based on private members.
| void update_size | ( | const int | time_id = -1 | ) |
Resize field values automatically (vals, val, val_pre) based on the corresponding mesh_location.
| [in] | time_id | time_id to reshape, -1 for all (default) |
| void update_sub_fields_mapping | ( | void | ) | const |
Update data mapping for all sub-fields.
| 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.
| [in] | time_id | time value id to get. 0 for val, 1 for val_pre |
| cs_array_3d<cs_real_t>** _ns_vals |
| cs_array_2d<cs_real_t>** _vals |
| bc_coeffs |
Boundary condition coefficients, for variable type fields
| dim |
Field dimension (usually 1 for scalar, 3 for vector, or 6 for symmetric tensor)
| cs_real_t* grad |
| id |
Field id (based on order of field declaration, starting at 0)
| is_owner |
Ownership flag for values
| location_id |
Id of matching mesh location
| n_time_vals |
Number of time values
| name |
Canonical name
| int ns_idx |
| int ns_owner |
| int ns_size |
| type |
Field type flag (sum of field mask constants, defining if a field is a variable, a property, ...)
| val |
For each active location, pointer to matching values array
| val_pre |
For each active location, pointer to matching previous values array (only if n_time_vals > 1)
| 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