/[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 2301 - (hide annotations) (download) (as text)
Sat Aug 21 13:28:35 2010 UTC (13 years, 10 months ago) by jpye
File MIME type: text/x-csrc
File size: 803 byte(s)
Regen toluene model working, next water.
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     }
38 jpye 2301
39    
40     int fprops_num_fluids(){
41     return nfluids;
42     }
43    
44     const HelmholtzData *fprops_get_fluid(int i){
45     if(i >= 0 && i < nfluids){
46     return fluids[i];
47     }
48     return NULL;
49     }
50    
51    
52    

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