|
6 | 6 | #endif |
7 | 7 | #include "yt_type_array.h" |
8 | 8 |
|
9 | | -//------------------------------------------------------------------------------------------------------- |
10 | | -// Structure : yt_field |
11 | | -// Description : Data structure to store a field's label and its definition of data |
12 | | -// representation. |
13 | | -// |
14 | | -// Notes : 1. The data representation type will be initialized as "cell-centered". |
15 | | -// 2. The lifetime of field_name and field_type should cover the whole in |
16 | | -// situ process. |
17 | | -// 3. The lifetime of field_unit, field_name_alias, field_display_name |
18 | | -// should cover yt_commit. |
19 | | -// 3. "field_unit", "field_name_alias", "field_display_name", are set |
20 | | -// corresponding to yt |
21 | | -// ( "name", ("units", ["fields", "to", "alias"], "display_name")) |
22 | | -// |
23 | | -// Data Member : const char *field_name : Field name |
24 | | -// const char *field_type : Define type, for now, we have these |
25 | | -// types, |
26 | | -// (1) "cell-centered" |
27 | | -// (2) "face-centered" |
28 | | -// (3) "derived_func" |
29 | | -// yt_dtype field_dtype : Field type of the grid. |
30 | | -// bool contiguous_in_x : true ==> [z][y][x], x address |
31 | | -// alter-first, default value. |
32 | | -// false ==> [x][y][z], z address |
33 | | -// alter-first |
34 | | -// short field_ghost_cell[6] : Number of cell to ignore at the |
35 | | -// beginning and the end of each |
36 | | -// dimension. |
37 | | -// The dimensions are in the point of |
38 | | -// view of the field data, it has |
39 | | -// nothing to do with x, y, z |
40 | | -// coordinates. |
41 | | -// |
42 | | -// const char *field_unit : Set field_unit if needed. |
43 | | -// int num_field_name_alias : Set field to alias names, number of |
44 | | -// the aliases. const char **field_name_alias : Aliases. const char |
45 | | -// *field_display_name : Set display name on the figure, if not set, yt |
46 | | -// will use field |
47 | | -// name as display name. |
48 | | -// |
49 | | -// (func pointer) derived_func : pointer to function that has |
50 | | -// prototype |
51 | | -// void (const int, const long*, const |
52 | | -// char*, yt_array*). |
53 | | -// |
54 | | -// Method : yt_field : Constructor |
55 | | -//------------------------------------------------------------------------------------------------------- |
| 9 | +/** |
| 10 | + * \struct yt_field |
| 11 | + * \brief Data structure to store a field's label and its definition of data |
| 12 | + * representation. |
| 13 | + * \details |
| 14 | + * 1. `field_unit`, `field_name_alias`, `field_display_name`, are set corresponding to yt |
| 15 | + * frontend `( "name", ("units", ["fields", "to", "alias"], "display_name"))`. |
| 16 | + * |
| 17 | + * \rst |
| 18 | + * .. caution:: |
| 19 | + * The lifetime of ``field_name`` and ``field_type`` should cover the whole in |
| 20 | + * situ process. |
| 21 | + * |
| 22 | + * The lifetime of ``field_unit``, ``field_name_alias``, ``field_display_name`` |
| 23 | + * should cover \ref yt_commit. |
| 24 | + * \endrst |
| 25 | + */ |
56 | 26 | typedef struct yt_field { |
57 | | - const char* field_name; |
58 | | - const char* field_type; |
59 | | - yt_dtype field_dtype; |
60 | | - bool contiguous_in_x; |
61 | | - short field_ghost_cell[6]; |
62 | | - const char* field_unit; |
63 | | - int num_field_name_alias; |
64 | | - const char** field_name_alias; |
65 | | - const char* field_display_name; |
| 27 | + const char* field_name; /*!< Field name */ |
| 28 | + const char* field_type; /*!< Define type |
| 29 | + * (`"cell-centered"`, `"face-centered"`, |
| 30 | + * `"derived_func"`) */ |
| 31 | + yt_dtype field_dtype; /*!< Field data type */ |
| 32 | + bool contiguous_in_x; /*!< true for x address alter-first (`[z][y][x]`); |
| 33 | + * false for z address alter-first (`[x][y][z]`)*/ |
| 34 | + short field_ghost_cell[6]; /*!< Number of cell to ignore at the beginning and the |
| 35 | + * end of each dimension of a data pointer. */ |
| 36 | + const char* field_unit; /*!< Field unit */ |
| 37 | + int num_field_name_alias; /*!< Number of field name alias */ |
| 38 | + const char** field_name_alias; /*!< A list of field name alias */ |
| 39 | + const char* field_display_name; /*!< Field display name */ |
| 40 | + |
| 41 | + /** Derived function */ |
66 | 42 | void (*derived_func)(const int, const long*, const char*, yt_array*); |
67 | 43 |
|
68 | 44 | #ifdef __cplusplus |
69 | | - //======================================================================================================= |
70 | | - // Method : yt_field |
71 | | - // Description : Constructor of the structure "yt_field" |
72 | | - // |
73 | | - // Note : 1. Initialize field_type as "cell-centered" |
74 | | - // 2. Initialize field_unit as "". If it is not set by user, then yt will |
75 | | - // use the particle |
76 | | - // unit set at yt frontend. If there still isn't one, then it will use |
77 | | - // "". |
78 | | - // |
79 | | - // Parameter : None |
80 | | - // ====================================================================================================== |
81 | 45 | yt_field() { |
82 | 46 | field_name = nullptr; |
83 | 47 | field_type = "cell-centered"; |
|
0 commit comments