programmer's documentation
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
src
base
cs_field_pointer.h
Go to the documentation of this file.
1
#ifndef __CS_FIELD_POINTER_H__
2
#define __CS_FIELD_POINTER_H__
3
4
/*============================================================================
5
* Field pointers and ids for standard and model fields
6
*============================================================================*/
7
8
/*
9
This file is part of Code_Saturne, a general-purpose CFD tool.
10
11
Copyright (C) 1998-2013 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
38
BEGIN_C_DECLS
39
40
/*=============================================================================
41
* Macro definitions
42
*============================================================================*/
43
44
/* Macro used for scoping of field pointer enums */
45
46
#define CS_ENUMF_(e) CS_FIELD_POINTER_ ## e
47
48
/* Macro used to return field a field pointer by its enumerated value */
49
50
#define CS_F_(e) cs_glob_field_pointers[CS_FIELD_POINTER_ ## e].f
51
52
#define CS_FI_(e, i) cs_glob_field_pointers[CS_FIELD_POINTER_ ## e].a->p[i]
53
54
/*============================================================================
55
* Type definitions
56
*============================================================================*/
57
60
typedef
enum
{
61
62
CS_ENUMF_
(p),
63
CS_ENUMF_
(u),
65
CS_ENUMF_
(rho),
66
CS_ENUMF_
(rho_b),
68
/* End of attributes */
69
70
CS_FIELD_N_POINTERS
71
72
}
cs_field_pointer_id_t
;
73
76
struct
cs_field_pointer_array_t
{
77
int
n
;
78
cs_field_t
*
p
[];
79
};
80
83
union
cs_field_pointer_val_t
{
84
cs_field_t
*
f
;
85
struct
cs_field_pointer_array_t
*
a
;
86
};
87
88
/*============================================================================
89
* Global variables
90
*============================================================================*/
91
92
/* Pointers */
93
94
extern
union
cs_field_pointer_val_t
*
cs_glob_field_pointers
;
95
96
/*=============================================================================
97
* Public function prototypes
98
*============================================================================*/
99
100
/*----------------------------------------------------------------------------
101
* Free all field pointer data.
102
*----------------------------------------------------------------------------*/
103
104
void
105
cs_field_pointer_destroy_all
(
void
);
106
107
/*----------------------------------------------------------------------------
108
* Map a simple field to an enumerated pointer.
109
*
110
* The associated field pointer may then be retreived using \ref CS_F_(e).
111
*
112
* parameters:
113
* e <-- field enumerator value
114
* f <-- pointer to field structure
115
*----------------------------------------------------------------------------*/
116
117
void
118
cs_field_pointer_map
(
cs_field_pointer_id_t
e,
119
cs_field_t
*
f
);
120
121
/*----------------------------------------------------------------------------
122
* Map a field to an (enumerated pointer, index) couple.
123
*
124
* This sort of mapping may be used for sets of fields whose size
125
* is not known in advance.
126
*
127
* The associated field pointer may then be retreived using \ref CS_F_(e, i).
128
*
129
* parameters:
130
* e <-- field enumerator value
131
* index <-- field enumerator index
132
* f <-- pointer to field structure
133
*----------------------------------------------------------------------------*/
134
135
void
136
cs_field_pointer_map_indexed
(
cs_field_pointer_id_t
e,
137
int
index,
138
cs_field_t
*
f
);
139
140
/*----------------------------------------------------------------------------*/
144
/*----------------------------------------------------------------------------*/
145
146
void
147
cs_field_pointer_map_base
(
void
);
148
149
/*----------------------------------------------------------------------------*/
150
151
END_C_DECLS
152
153
#endif
/* __CS_FIELD_POINTER_H__ */
Generated on Thu Feb 27 2014 19:21:34 by
1.8.3.1