/[ascend]/trunk/models/johnpye/fprops/fluids.c
ViewVC logotype

Annotation of /trunk/models/johnpye/fprops/fluids.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2299 - (hide annotations) (download) (as text)
Fri Aug 20 06:53:38 2010 UTC (13 years, 9 months ago) by jpye
File MIME type: text/x-csrc
File size: 640 byte(s)
Automatic generation of the fluids list completed now (hopefully).
1 jpye 2299 #include "fluids.h"
2     #include "fluids/fluids_list.h"
3    
4     #include <string.h>
5    
6     #define X
7     #define F(NAME) extern const HelmholtzData helmholtz_data_##NAME;
8     FLUIDS(F,X)
9     #undef X
10     #undef F
11    
12     /* create a list of all the fluids from fluids.h */
13     static const HelmholtzData *fluids[] ={
14     #define X ,
15     #define F(NAME) &helmholtz_data_##NAME
16     FLUIDS(F,X)
17     #undef X
18     #undef F
19     };
20    
21     /* count them */
22     static int nfluids = 0 +
23     #define X +
24     #define F(NAME) 1
25     FLUIDS(F,X);
26     #undef F
27     #undef X
28    
29     const HelmholtzData *fprops_fluid(const char *name){
30     int i;
31     for(i = 0; i < nfluids; ++i){
32     if(0==strcmp(name, fluids[i]->name)){
33     return fluids[i];
34     }
35     }
36     return NULL;
37     }

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22