programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cs_field.h
Go to the documentation of this file.
1 #ifndef __CS_FIELD_H__
2 #define __CS_FIELD_H__
3 
4 /*============================================================================
5  * Field management.
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2014 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 /*----------------------------------------------------------------------------
31  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "cs_defs.h"
35 
36 /*----------------------------------------------------------------------------*/
37 
39 
40 /*=============================================================================
41  * Macro definitions
42  *============================================================================*/
43 
44 /*
45  * Field property type
46  */
47 
48 #define CS_FIELD_INTENSIVE (1 << 0)
49 #define CS_FIELD_EXTENSIVE (1 << 1)
50 
51 /* Field category */
52 
53 #define CS_FIELD_VARIABLE (1 << 2)
54 #define CS_FIELD_PROPERTY (1 << 3)
55 #define CS_FIELD_POSTPROCESS (1 << 4)
56 #define CS_FIELD_ACCUMULATOR (1 << 5)
57 
58 #define CS_FIELD_USER (1 << 6)
59 
60 /*============================================================================
61  * Type definitions
62  *============================================================================*/
63 
64 /* Field handling error types */
65 /*----------------------------*/
66 
67 typedef enum {
68 
74 
76 
77 /* Field boundary condition descriptor (for variables) */
78 /*-----------------------------------------------------*/
79 
80 typedef struct {
81 
82  int location_id; /* Id of matching location */
83 
84  cs_real_t *a; /* Explicit coefficient */
85  cs_real_t *b; /* Implicit coefficient */
86  cs_real_t *af; /* Explicit coefficient for flux */
87  cs_real_t *bf; /* Implicit coefficient for flux */
88  cs_real_t *ad; /* Explicit coefficient for divergence */
89  cs_real_t *bd; /* Implicit coefficient for divergence */
90  cs_real_t *ac; /* Explicit coefficient for convection */
91  cs_real_t *bc; /* Implicit coefficient for convection */
92 
94 
95 /* Field descriptor */
96 /*------------------*/
97 
98 typedef struct {
99 
100  const char *name; /* Canonical name */
101 
102  int id; /* Field id */
103  int type; /* Field type flag */
104 
105  int dim; /* Field dimension */
106  bool interleaved; /* is field interleaved ? */
107 
108  int location_id; /* Id of matching location */
109 
110  int n_time_vals; /* Number of time values */
111 
112  cs_real_t **vals; /* For each active location, pointer
113  to matching values arrays
114  vals[0][:] = val
115  vals[1][:] = val_pre
116  vals[p][:] = p ith previous field
117  p < n_time_vals */
118 
119 
120  cs_real_t *val; /* For each active location, pointer
121  to matching values array */
122 
123  cs_real_t *val_pre; /* For each active location, pointer
124  to matching previous values array
125  (if n_time_vals == 2) */
126 
127  cs_field_bc_coeffs_t *bc_coeffs; /* Boundary condition coefficients,
128  for variable type fields */
129 
130  bool is_owner; /* Ownership flag for values */
131 
132 } cs_field_t;
133 
134 /*----------------------------------------------------------------------------
135  * Function pointer for structure associated to field key
136  *
137  * parameters:
138  * t <-- pointer to structure
139  *----------------------------------------------------------------------------*/
140 
141 typedef void
142 (cs_field_log_key_struct_t) (const void *t);
143 
144 /*============================================================================
145  * Global variables
146  *============================================================================*/
147 
148 /* Names for components */
149 
150 extern const char *cs_glob_field_comp_name_3[];
151 extern const char *cs_glob_field_comp_name_6[];
152 extern const char *cs_glob_field_comp_name_9[];
153 
154 /*=============================================================================
155  * Public function prototypes
156  *============================================================================*/
157 
158 /*----------------------------------------------------------------------------
159  * Return the number of defined fields.
160  *
161  * returns:
162  * number of defined fields.
163  *----------------------------------------------------------------------------*/
164 
165 int
166 cs_field_n_fields(void);
167 
168 /*----------------------------------------------------------------------------
169  * Create a field descriptor.
170  *
171  * parameters:
172  * name <-- field name
173  * type_flag <-- mask of field property and category values
174  * location_id <-- id of associated location
175  * dim <-- field dimension (number of components)
176  * interleaved <-- indicate if values are interleaved
177  * (ignored if number of components < 2)
178  * has_previous <-- maintain values at the previous time step ?
179  *
180  * returns:
181  * pointer to new field.
182  *----------------------------------------------------------------------------*/
183 
184 cs_field_t *
185 cs_field_create(const char *name,
186  int type_flag,
187  int location_id,
188  int dim,
189  bool interleaved,
190  bool has_previous);
191 
192 /*----------------------------------------------------------------------------
193  * Change the number of time values managed by a field.
194  *
195  * The minimum will never be below 1, as the current time is always handled.
196  *
197  * parameters:
198  * f <-> pointer to field structure
199  * n_time_vals <-- number of time values to maintain
200  *----------------------------------------------------------------------------*/
201 
202 void
204  int n_time_vals);
205 
206 /*----------------------------------------------------------------------------
207  * Allocate arrays for field values.
208  *
209  * parameters:
210  * f <-- pointer to field structure
211  *----------------------------------------------------------------------------*/
212 
213 void
215 
216 /*----------------------------------------------------------------------------
217  * Map existing value arrays to field descriptor.
218  *
219  * parameters:
220  * f <-> pointer to field structure
221  * val <-- pointer to array of values
222  * val_pre <-- pointer to array of previous values, or NULL
223  *----------------------------------------------------------------------------*/
224 
225 void
227  cs_real_t *val,
228  cs_real_t *val_pre);
229 
230 /*----------------------------------------------------------------------------
231  * Allocate boundary condition coefficient arrays.
232  *
233  * For fields on location CS_MESH_LOCATION_CELLS, boundary conditions
234  * are located on CS_MESH_LOCATION_BOUNDARY_FACES.
235  *
236  * Boundary condition coefficients are not currently supported for other
237  * locations (though support could be added by mapping a boundary->location
238  * indirection array in the cs_mesh_location_t structure).
239  *
240  * For multidimensional fields, arrays are assumed to have the same
241  * interleaving behavior as the field, unless components are coupled.
242  *
243  * For multidimensional fields with coupled components, interleaving
244  * is the norm, and implicit b and bf coefficient arrays are arrays of
245  * block matrices, not vectors, so the number of entries for each boundary
246  * face is dim*dim instead of dim.
247  *
248  * parameters:
249  * f <-- pointer to field structure
250  * have_flux_bc <-- if true, flux BC coefficients (af and bf) are added
251  * have_mom_bc <-- if true, div BC coefficients (ad and bd) are added
252  * have_conv_bc <-- if true, convection BC coefficients (ac and bc) are added
253  *----------------------------------------------------------------------------*/
254 
255 void
257  bool have_flux_bc,
258  bool have_mom_bc,
259  bool have_conv_bc);
260 
261 /*----------------------------------------------------------------------------*/
262 /* Initialize boundary condition coefficients arrays.
263  *
264  * For fields on location CS_MESH_LOCATION_CELLS, boundary conditions
265  * are located on CS_MESH_LOCATION_BOUNDARY_FACES.
266  *
267  * Boundary condition coefficients are not currently supported for other
268  * locations (though support could be added by mapping a boundary->location
269  * indirection array in the cs_mesh_location_t structure).
270  *
271  * For multidimensional fields, arrays are assumed to have the same
272  * interleaving behavior as the field, unless components are coupled.
273  *
274  * For multidimensional fields with coupled components, interleaving
275  * is the norm, and implicit b and bf coefficient arrays are arrays of
276  * block matrices, not vectors, so the number of entries for each boundary
277  * face is dim*dim instead of dim.
278  *
279  * parameters:
280  * f <-> pointer to field structure
281  *----------------------------------------------------------------------------*/
282 
283 void
285 
286 /*----------------------------------------------------------------------------
287  * Copy current field values to previous values if applicable.
288  *
289  * For fields with only one time value, or values not allocated yet,
290  * this is a no-op.
291  *
292  * parameters:
293  * f <-> pointer to field structure
294  *----------------------------------------------------------------------------*/
295 
296 void
298 
299 /*----------------------------------------------------------------------------
300  * Destroy all defined fields.
301  *----------------------------------------------------------------------------*/
302 
303 void
305 
306 /*----------------------------------------------------------------------------
307  * Allocate arrays for all defined fields based on their location.
308  *
309  * Location sized must thus be known.
310  *
311  * Fields that do not own their data should all have been mapped at this
312  * stage, and are checked.
313  *----------------------------------------------------------------------------*/
314 
315 void
317 
318 /*----------------------------------------------------------------------------
319  * Return a pointer to a field based on its id.
320  *
321  * This function requires that a field of the given id is defined.
322  *
323  * parameters:
324  * id <-- field id
325  *
326  * returns:
327  * pointer to the field structure
328  *----------------------------------------------------------------------------*/
329 
330 cs_field_t *
331 cs_field_by_id(int id);
332 
333 /*----------------------------------------------------------------------------
334  * Return a pointer to a field based on its name.
335  *
336  * This function requires that a field of the given name is defined.
337  *
338  * parameters:
339  * name <-- field name
340  *
341  * returns:
342  * pointer to the field structure
343  *----------------------------------------------------------------------------*/
344 
345 cs_field_t *
346 cs_field_by_name(const char *name);
347 
348 /*----------------------------------------------------------------------------
349  * Return a pointer to a field based on its name if present.
350  *
351  * If no field of the given name is defined, NULL is returned.
352  *
353  * parameters:
354  * name <-- field name
355  *
356  * returns:
357  * pointer to the field structure, or NULL
358  *----------------------------------------------------------------------------*/
359 
360 cs_field_t *
361 cs_field_by_name_try(const char *name);
362 
363 /*----------------------------------------------------------------------------
364  * Return the id of a defined field based on its name.
365  *
366  * If no field with the given name exists, -1 is returned.
367  *
368  * parameters:
369  * name <-- field name
370  *
371  * returns:
372  * id the field, or -1 if not found
373  *----------------------------------------------------------------------------*/
374 
375 int
376 cs_field_id_by_name(const char *name);
377 
378 /*----------------------------------------------------------------------------
379  * Return the id of a defined field and an associated component
380  * based on a component name.
381  *
382  * If no field with the given name exists, -1 is returned.
383  *
384  * parameters:
385  * name <-- field or field+component name
386  * f_id --> field id, or -1 if no match was found
387  * c_id --> component id, or -1 for all components
388  *----------------------------------------------------------------------------*/
389 
390 void
391 cs_field_component_id_by_name(const char *name,
392  int *f_id,
393  int *c_id);
394 
395 /*----------------------------------------------------------------------------
396  * Return an id associated with a given key name.
397  *
398  * The key must have been defined previously.
399  *
400  * parameters:
401  * name <-- key name
402  *
403  * returns:
404  * id associated with key
405  *----------------------------------------------------------------------------*/
406 
407 int
408 cs_field_key_id(const char *name);
409 
410 /*----------------------------------------------------------------------------
411  * Return an id associated with a given key name if present.
412  *
413  * If the key has not been defined previously, -1 is returned.
414  *
415  * parameters:
416  * name <-- key name
417  *
418  * returns:
419  * id associated with key, or -1
420  *----------------------------------------------------------------------------*/
421 
422 int
423 cs_field_key_id_try(const char *name);
424 
425 /*----------------------------------------------------------------------------
426  * Define a key for an integer value by its name and return an associated id.
427  *
428  * If the key has already been defined, its previous default value is replaced
429  * by the current value, and its id is returned.
430  *
431  * parameters:
432  * name <-- key name
433  * default_value <-- default value associated with key
434  * type flag <-- mask associated with field types with which the
435  * key may be associated, or 0
436  *
437  * returns:
438  * id associated with key
439  *----------------------------------------------------------------------------*/
440 
441 int
442 cs_field_define_key_int(const char *name,
443  int default_value,
444  int type_flag);
445 
446 /*----------------------------------------------------------------------------
447  * Define a key for an floating point value by its name and return an
448  * associated id.
449  *
450  * If the key has already been defined, its previous default value is replaced
451  * by the current value, and its id is returned.
452  *
453  * parameters:
454  * name <-- key name
455  * default_value <-- default value associated with key
456  * type flag <-- mask associated with field types with which the
457  * key may be associated, or 0
458  *
459  * returns:
460  * id associated with key
461  *----------------------------------------------------------------------------*/
462 
463 int
464 cs_field_define_key_double(const char *name,
465  double default_value,
466  int type_flag);
467 
468 /*----------------------------------------------------------------------------
469  * Define a key for an string point value by its name and return an
470  * associated id.
471  *
472  * If the key has already been defined, its previous default value is replaced
473  * by the current value, and its id is returned.
474  *
475  * parameters:
476  * name <-- key name
477  * default_value <-- default value associated with key
478  * type flag <-- mask associated with field types with which the
479  * key may be associated, or 0
480  *
481  * returns:
482  * id associated with key
483  *----------------------------------------------------------------------------*/
484 
485 int
486 cs_field_define_key_str(const char *name,
487  const char *default_value,
488  int type_flag);
489 
490 /*----------------------------------------------------------------------------
491  * Define a key for a structure value by its name and return an
492  * associated id.
493  *
494  * If the key has already been defined, its previous default value is replaced
495  * by the current value, and its id is returned.
496  *
497  * parameters:
498  * name <-- key name
499  * default_value <-- pointer to default value associated with key
500  * log_funct <-- pointer to logging function
501  * size <-- sizeof structure
502  * type_flag <-- mask associated with field types with which
503  * the key may be associated, or 0
504  *
505  * returns:
506  * id associated with key
507  *----------------------------------------------------------------------------*/
508 
509 int
510 cs_field_define_key_struct(const char *name,
511  const void *default_value,
512  cs_field_log_key_struct_t *log_func,
513  size_t size,
514  int type_flag);
515 
516 /*----------------------------------------------------------------------------
517  * Define a sub key.
518  *
519  * The sub key is the same type as the parent key.
520  *
521  * For a given field, when querying a sub key's value and that value has not
522  * been set, the query will return the value of the parent key.
523  *
524  * parameters:
525  * name <-- key name
526  * parent_id <-- parent key id
527  *
528  * returns:
529  * id associated with key
530  *----------------------------------------------------------------------------*/
531 
532 int
533 cs_field_define_sub_key(const char *name,
534  int parent_id);
535 
536 /*----------------------------------------------------------------------------
537  * Destroy all defined field keys and associated values.
538  *----------------------------------------------------------------------------*/
539 
540 void
542 
543 /*----------------------------------------------------------------------------
544  * Get the type flag associated with a given key id.
545  *
546  * If the key has not been defined previously, -1 is returned.
547  *
548  * parameters:
549  * key_id <-- id of associated key
550  *
551  * returns:
552  * type flag associated with key, or -1
553  *----------------------------------------------------------------------------*/
554 
555 int
556 cs_field_key_flag(int key_id);
557 
558 /*----------------------------------------------------------------------------
559  * Query if a given key has been set for a field.
560  *
561  * If the key id is not valid, or the field category is not
562  * compatible, a fatal error is provoked.
563  *
564  * parameters:
565  * f <-- pointer to field structure
566  * key_id <-- id of associated key
567  *
568  * returns:
569  * true if the key has been set for this field, false otherwise
570  *----------------------------------------------------------------------------*/
571 
572 bool
574  int key_id);
575 
576 /*----------------------------------------------------------------------------
577  * Assign a integer value for a given key to a field.
578  *
579  * If the key id is not valid, CS_FIELD_INVALID_KEY_ID is returned.
580  * If the field category is not compatible with the key (as defined
581  * by its type flag), CS_FIELD_INVALID_CATEGORY is returned.
582  * If the data type does not match, CS_FIELD_INVALID_TYPE is returned.
583  *
584  * parameters:
585  * f <-- pointer to field structure
586  * key_id <-- id of associated key
587  * value <-- value associated with key
588  *
589  * returns:
590  * 0 in case of success, > 1 in case of error
591  *----------------------------------------------------------------------------*/
592 
593 int
595  int key_id,
596  int value);
597 
598 /*----------------------------------------------------------------------------
599  * Return a integer value for a given key associated with a field.
600  *
601  * If the key id is not valid, or the value type or field category is not
602  * compatible, a fatal error is provoked.
603  *
604  * parameters:
605  * f <-- pointer to field structure
606  * key_id <-- id of associated key
607  *
608  * returns:
609  * integer value associated with the key id for this field
610  *----------------------------------------------------------------------------*/
611 
612 int
614  int key_id);
615 
616 /*----------------------------------------------------------------------------
617  * Assign a floating point value for a given key to a field.
618  *
619  * If the key id is not valid, CS_FIELD_INVALID_KEY_ID is returned.
620  * If the field category is not compatible with the key (as defined
621  * by its type flag), CS_FIELD_INVALID_CATEGORY is returned.
622  * If the data type does not match, CS_FIELD_INVALID_TYPE is returned.
623  *
624  * parameters:
625  * f <-- pointer to field structure
626  * key_id <-- id of associated key
627  * value <-- value associated with key
628  *
629  * returns:
630  * 0 in case of success, > 1 in case of error
631  *----------------------------------------------------------------------------*/
632 
633 int
635  int key_id,
636  double value);
637 
638 /*----------------------------------------------------------------------------
639  * Return a floating point value for a given key associated with a field.
640  *
641  * If the key id is not valid, or the value type or field category is not
642  * compatible, a fatal error is provoked.
643  *
644  * parameters:
645  * f <-- pointer to field structure
646  * key_id <-- id of associated key
647  *
648  * returns:
649  * floating point value associated with the key id for this field
650  *----------------------------------------------------------------------------*/
651 
652 double
654  int key_id);
655 
656 /*----------------------------------------------------------------------------
657  * Assign a character string value for a given key to a field.
658  *
659  * If the key id is not valid, CS_FIELD_INVALID_KEY_ID is returned.
660  * If the field category is not compatible with the key (as defined
661  * by its type flag), CS_FIELD_INVALID_CATEGORY is returned.
662  * If the data type does not match, CS_FIELD_INVALID_TYPE is returned.
663  *
664  * parameters:
665  * f <-- pointer to field structure
666  * key_id <-- id of associated key
667  * str <-- string associated with key
668  *
669  * returns:
670  * 0 in case of success, > 1 in case of error
671  *----------------------------------------------------------------------------*/
672 
673 int
675  int key_id,
676  const char *str);
677 
678 /*----------------------------------------------------------------------------
679  * Return a string for a given key associated with a field.
680  *
681  * If the key id is not valid, or the value type or field category is not
682  * compatible, a fatal error is provoked.
683  *
684  * parameters:
685  * f <-- pointer to field structure
686  * key_id <-- id of associated key
687  *
688  * returns:
689  * pointer to character string associated with the key id for this field
690  *----------------------------------------------------------------------------*/
691 
692 const char *
694  int key_id);
695 
696 
697 /*----------------------------------------------------------------------------
698  * Assign a simple structure for a given key to a field.
699  *
700  * If the key id is not valid, CS_FIELD_INVALID_KEY_ID is returned.
701  * If the field category is not compatible with the key (as defined
702  * by its type flag), CS_FIELD_INVALID_CATEGORY is returned.
703  *
704  * parameters:
705  * f <-- pointer to field structure
706  * key_id <-- id of associated key
707  * s <-- structure associated with key
708  *
709  * returns:
710  * 0 in case of success, > 1 in case of error
711  *----------------------------------------------------------------------------*/
712 
713 int
715  int key_id,
716  void *s);
717 
718 /*----------------------------------------------------------------------------
719  * Return a structure for a given key associated with a field.
720  *
721  * If the key id is not valid, or the value type or field category is not
722  * compatible, a fatal error is provoked.
723  *
724  * parameters:
725  * f <-- pointer to field structure
726  * key_id <-- id of associated key
727  * s <-- structure associated with key
728  *
729  * returns:
730  * pointer to structure associated with the key id for this field
731  * (same as s)
732  *----------------------------------------------------------------------------*/
733 
734 const void *
736  int key_id,
737  void *s);
738 
739 /*----------------------------------------------------------------------------
740  * Print info relative to all field definitions to log file.
741  *----------------------------------------------------------------------------*/
742 
743 void
744 cs_field_log_defs(void);
745 
746 /*----------------------------------------------------------------------------
747  * Print info relative to a given field to log file.
748  *
749  * parameters:
750  * f <-- pointer to field structure
751  * log_keywords <-- log level for keywords (0: do not log,
752  * 1: log non-default values, 2: log all)
753  *----------------------------------------------------------------------------*/
754 
755 void
757  int log_keywords);
758 
759 /*----------------------------------------------------------------------------
760  * Print info relative to all defined fields to log file.
761  *
762  * parameters:
763  * log_keywords <-- log level for keywords (0: do not log,
764  * 1: log non-default values, 2: log all)
765  *----------------------------------------------------------------------------*/
766 
767 void
768 cs_field_log_fields(int log_keywords);
769 
770 /*----------------------------------------------------------------------------
771  * Print info relative to all key definitions to log file.
772  *----------------------------------------------------------------------------*/
773 
774 void
776 
777 /*----------------------------------------------------------------------------
778  * Print info relative to a given field key to log file.
779  *
780  * parameters:
781  * int key_id <-- id of associated key
782  * log_defaults <-- if true, log default field values in addition to
783  * defined field values
784  *----------------------------------------------------------------------------*/
785 
786 void
787 cs_field_log_key_vals(int key_id,
788  bool log_defaults);
789 
790 /*----------------------------------------------------------------------------
791  * Print info relative to all given field keys to log file.
792  *
793  * parameters:
794  * log_defaults <-- if true, log default field values in addition to
795  * defined field values
796  *----------------------------------------------------------------------------*/
797 
798 void
799 cs_field_log_all_key_vals(bool log_defaults);
800 
801 /*----------------------------------------------------------------------------
802  * Define base keys.
803  *
804  * Keys defined by this function are:
805  * "label" (string)
806  * "log" (integer)
807  * "post_vis" (integer)
808  * "post_probes" (integer)
809  * "coupled" (integer, restricted to CS_FIELD_VARIABLE)
810  * "moment_id" (integer, restricted to
811  * CS_FIELD_ACCUMULATOR | CS_FIELD_POSTPROCESS);
812  *
813  * A recommened practice for different submodules would be to use
814  * "cs_<module>_key_init() functions to define keys specific to those modules.
815  *----------------------------------------------------------------------------*/
816 
817 void
819 
820 /*----------------------------------------------------------------------------
821  * Return a label associated with a field.
822  *
823  * If the "label" key has been set for this field, its associated string
824  * is returned. Otherwise, the field's name is returned.
825  *
826  * parameters:
827  * f <-- pointer to field structure
828  *
829  * returns:
830  * pointer to character string associated with label for this field
831  *----------------------------------------------------------------------------*/
832 
833 const char *
835 
836 /*----------------------------------------------------------------------------*/
837 
839 
840 #endif /* __CS_FIELD_H__ */
int cs_field_get_key_int(const cs_field_t *f, int key_id)
Return a integer value for a given key associated with a field.
Definition: cs_field.c:2480
const char * cs_field_get_key_str(const cs_field_t *f, int key_id)
Return a string for a given key associated with a field.
Definition: cs_field.c:2702
int cs_field_set_key_int(cs_field_t *f, int key_id, int value)
Assign a integer value for a given key to a field.
Definition: cs_field.c:2438
cs_field_bc_coeffs_t * bc_coeffs
Definition: cs_field.h:127
int cs_field_key_id(const char *name)
Return an id associated with a given key name.
Definition: cs_field.c:2073
void cs_field_init_bc_coeffs(cs_field_t *f)
Initialize boundary condition coefficients arrays.
Definition: cs_field.c:1609
cs_real_t * b
Definition: cs_field.h:85
int location_id
Definition: cs_field.h:108
Field descriptor.
Definition: cs_field.h:98
const char * cs_glob_field_comp_name_6[]
void cs_field_log_defs(void)
Print info relative to all field definitions to log file.
Definition: cs_field.c:2874
int cs_field_define_key_str(const char *name, const char *default_value, int type_flag)
Define a key for a string value by its name and return an associated id.
Definition: cs_field.c:2200
int cs_field_key_flag(int key_id)
Get the type flag associated with a given key id.
Definition: cs_field.c:2354
int dim
Definition: cs_field.h:105
const char * cs_glob_field_comp_name_3[]
void cs_field_map_values(cs_field_t *f, cs_real_t *val, cs_real_t *val_pre)
Map existing value arrays to field descriptor.
Definition: cs_field.c:1430
const void * cs_field_get_key_struct(const cs_field_t *f, int key_id, void *s)
Return a structure for a given key associated with a field.
Definition: cs_field.c:2815
#define BEGIN_C_DECLS
Definition: cs_defs.h:405
cs_field_t * cs_field_create(const char *name, int type_flag, int location_id, int dim, bool interleaved, bool has_previous)
Create a field descriptor.
Definition: cs_field.c:1310
bool cs_field_is_key_set(const cs_field_t *f, int key_id)
Query if a given key has been set for a field.
Definition: cs_field.c:2381
cs_real_t * val_pre
Definition: cs_field.h:123
void cs_field_allocate_values(cs_field_t *f)
Allocate arrays for field values.
Definition: cs_field.c:1395
int cs_field_define_key_struct(const char *name, const void *default_value, cs_field_log_key_struct_t *log_func, size_t size, int type_flag)
Define a key for a structure value by its name and return an associated id.
Definition: cs_field.c:2249
Definition: cs_field.h:69
void cs_field_log_all_key_vals(bool log_defaults)
Print info relative to all given field keys to log file.
Definition: cs_field.c:3454
int cs_field_define_sub_key(const char *name, int parent_id)
Define a sub key.
Definition: cs_field.c:2297
void cs_field_allocate_or_map_all(void)
Allocate arrays for all defined fields based on their location.
Definition: cs_field.c:1859
int cs_field_key_id_try(const char *name)
Return an id associated with a given key name if present.
Definition: cs_field.c:2100
cs_real_t * val
Definition: cs_field.h:120
const char * cs_glob_field_comp_name_9[]
void cs_field_define_keys_base(void)
Define base keys.
Definition: cs_field.c:3486
int cs_field_set_key_double(cs_field_t *f, int key_id, double value)
Assign a floating point value for a given key to a field.
Definition: cs_field.c:2547
void( cs_field_log_key_struct_t)(const void *t)
Definition: cs_field.h:142
Field boundary condition descriptor (for variables)
Definition: cs_field.h:80
void cs_field_component_id_by_name(const char *name, int *f_id, int *c_id)
Return the id of a defined field and an associated component based on a component name...
Definition: cs_field.c:1984
void cs_field_destroy_all(void)
Destroy all defined fields.
Definition: cs_field.c:1804
const char * name
Definition: cs_field.h:100
Definition: cs_field.h:73
void cs_field_log_key_vals(int key_id, bool log_defaults)
Print info relative to a given field key to log file.
Definition: cs_field.c:3330
cs_real_t * bd
Definition: cs_field.h:89
cs_real_t ** vals
Definition: cs_field.h:112
Definition: cs_field.h:70
cs_real_t * bf
Definition: cs_field.h:87
int type
Definition: cs_field.h:103
int cs_field_set_key_str(cs_field_t *f, int key_id, const char *str)
Assign a character string for a given key to a field.
Definition: cs_field.c:2656
Definition: cs_field.h:71
int cs_field_id_by_name(const char *name)
Return the id of a defined field based on its name.
Definition: cs_field.c:1963
int id
Definition: cs_field.h:102
cs_real_t * ad
Definition: cs_field.h:88
void cs_field_destroy_all_keys(void)
Destroy all defined field keys and associated values.
Definition: cs_field.c:2322
int cs_field_define_key_double(const char *name, double default_value, int type_flag)
Define a key for an floating point value by its name and return an associated id. ...
Definition: cs_field.c:2164
cs_real_t * bc
Definition: cs_field.h:91
cs_field_t * cs_field_by_name(const char *name)
Return a pointer to a field based on its name.
Definition: cs_field.c:1914
int n_time_vals
Definition: cs_field.h:110
int cs_field_n_fields(void)
Return the number of defined fields.
Definition: cs_field.c:1288
bool interleaved
Definition: cs_field.h:106
const char * cs_field_get_label(const cs_field_t *f)
Return a label associated with a field.
Definition: cs_field.c:3513
#define END_C_DECLS
Definition: cs_defs.h:406
double cs_real_t
Definition: cs_defs.h:296
cs_real_t * ac
Definition: cs_field.h:90
int cs_field_set_key_struct(cs_field_t *f, int key_id, void *s)
Assign a simple structure for a given key to a field.
Definition: cs_field.c:2769
void cs_field_set_n_time_vals(cs_field_t *f, int n_time_vals)
Change the number of time values managed by a field.
Definition: cs_field.c:1340
void cs_field_log_key_defs(void)
Print info relative to all key definitions to log file.
Definition: cs_field.c:3212
cs_real_t * af
Definition: cs_field.h:86
int location_id
Definition: cs_field.h:82
void cs_field_log_fields(int log_keywords)
Print info relative to all defined fields to log file.
Definition: cs_field.c:3151
void cs_field_log_info(const cs_field_t *f, int log_keywords)
Print info relative to a given field to log file.
Definition: cs_field.c:3014
void cs_field_current_to_previous(cs_field_t *f)
Copy current field values to previous values if applicable.
Definition: cs_field.c:1746
cs_field_t * cs_field_by_name_try(const char *name)
Return a pointer to a field based on its name if present.
Definition: cs_field.c:1940
Definition: cs_field.h:72
bool is_owner
Definition: cs_field.h:130
cs_field_t * cs_field_by_id(int id)
Return a pointer to a field based on its id.
Definition: cs_field.c:1890
double cs_field_get_key_double(const cs_field_t *f, int key_id)
Return a floating point value for a given key associated with a field.
Definition: cs_field.c:2589
int cs_field_define_key_int(const char *name, int default_value, int type_flag)
Define a key for an integer value by its name and return an associated id.
Definition: cs_field.c:2128
cs_field_error_type_t
Definition: cs_field.h:67
cs_real_t * a
Definition: cs_field.h:84
void cs_field_allocate_bc_coeffs(cs_field_t *f, bool have_flux_bc, bool have_mom_bc, bool have_conv_bc)
Allocate boundary condition coefficients arrays.
Definition: cs_field.c:1480