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

Diff of /trunk/models/johnpye/fprops/asc_fprops.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2662 by jpye, Thu Jan 17 00:15:12 2013 UTC revision 2663 by jpye, Fri Jan 18 01:06:06 2013 UTC
# Line 80  ExtBBoxFunc fprops_Tvsx_ph_calc; Line 80  ExtBBoxFunc fprops_Tvsx_ph_calc;
80  */  */
81    
82  /* place to store symbols needed for accessing ASCEND's instance tree */  /* place to store symbols needed for accessing ASCEND's instance tree */
83  static symchar *fprops_symbols[2];  static symchar *fprops_symbols[3];
84  #define COMPONENT_SYM fprops_symbols[0]  #define COMPONENT_SYM fprops_symbols[0]
85  #define TYPE_SYM fprops_symbols[1]  #define TYPE_SYM fprops_symbols[1]
86    #define SOURCE_SYM fprops_symbols[2]
87    
88  static const char *fprops_p_help = "Calculate pressure from temperature and density, using FPROPS";  static const char *fprops_p_help = "Calculate pressure from temperature and density, using FPROPS";
89  static const char *fprops_u_help = "Calculate specific internal energy from temperature and density, using FPROPS";  static const char *fprops_u_help = "Calculate specific internal energy from temperature and density, using FPROPS";
# Line 165  int asc_fprops_prepare(struct BBoxInterp Line 166  int asc_fprops_prepare(struct BBoxInterp
166         struct Instance *data,         struct Instance *data,
167         struct gl_list_t *arglist         struct gl_list_t *arglist
168  ){  ){
169      struct Instance *compinst, *typeinst;      struct Instance *compinst, *typeinst, *srcinst;
170      const char *comp, *type = NULL;      const char *comp, *type = NULL, *src = NULL;
171    
172      fprops_symbols[0] = AddSymbol("component");      fprops_symbols[0] = AddSymbol("component");
173      fprops_symbols[1] = AddSymbol("type");      fprops_symbols[1] = AddSymbol("type");
174        fprops_symbols[2] = AddSymbol("source");
175    
176      /* get the component name */      /* get the component name */
177      compinst = ChildByChar(data,COMPONENT_SYM);      compinst = ChildByChar(data,COMPONENT_SYM);
# Line 201  int asc_fprops_prepare(struct BBoxInterp Line 203  int asc_fprops_prepare(struct BBoxInterp
203          if(type && strlen(type)==0)type = NULL;          if(type && strlen(type)==0)type = NULL;
204      }      }
205    
206      bbox->user_data = (void *)fprops_fluid(comp,type);      /* get the source data string (FPROPS doesn't mind if none given) */
207        srcinst = ChildByChar(data,SOURCE_SYM);
208        if(srcinst){
209            if(InstanceKind(srcinst)!=SYMBOL_CONSTANT_INST){
210                ERROR_REPORTER_HERE(ASC_USER_ERROR,"DATA member 'source' must be a symbol_constant");
211                return 1;
212            }
213            src = SCP(SYMC_INST(srcinst)->value);
214            CONSOLE_DEBUG("SOURCE: %s",src?src:"(null)");
215            if(src && strlen(src)==0)src = NULL;
216        }
217    
218        bbox->user_data = (void *)fprops_fluid(comp,type,src);
219      if(bbox->user_data == NULL){      if(bbox->user_data == NULL){
220          ERROR_REPORTER_HERE(ASC_USER_ERROR,"Component name/type was not recognised. Check the source-code for for the supported species.");          ERROR_REPORTER_HERE(ASC_USER_ERROR,"Component name/type was not recognised. Check the source-code for for the supported species.");
221          return 1;          return 1;

Legend:
Removed from v.2662  
changed lines
  Added in v.2663

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