[FLASH-USERS] basic question regarding variable defintions

Slavin, Jonathan jslavin at cfa.harvard.edu
Mon Nov 13 15:30:40 EST 2017


Thanks Jason, and also Suoqing Ji for helpful answers.  It worked by just
adding
VARIABLE XYZ
to my Config file in the unit in question.

Note for others: by using the above statement then, in the Fortran routine,
statements that say
#ifdef XYZ_VAR
    do something
#endif
will be executed - the declaration in the Config file is XYZ whereas in the
Fortran code the ifdef test is on XYZ_VAR.  By putting that VARIABLE
statement in the Config file the Flash.h file gets a statement:
#define XYZ_VAR N
where N is some number in the sequence of variables stored in the solnData
array.

Jon

On Sat, Nov 11, 2017 at 4:25 PM, Jason Galyardt <jason.galyardt at gmail.com>
wrote:

> Hi Jon,
>
> For macros that are used exclusively in a single unit, the best way to do
> this (in my opinion) is to create a header file within that unit's
> directory structure, define that macro in the header file, and then
> #include that header in the appropriate source file within that unit.
>
> However, you seem to be looking at a solution array variable, which
> requires special care. These are all #defined in Flash.h automagically by
> the 'setup' command, using the Config files associated with the included
> FLASH units (Simulation, Grid, etc.). So, if you find that XYZ_VAR is not
> defined in Flash.h after you have run the 'setup' command, you should first
> look into whether you're missing a FLASH unit (or sub-unit) in your
> Simulation Config file. If you're sure that you're not missing the unit
> that defines and uses XYZ_VAR, you can define it in the appropriate Config
> file via a VARIABLE statement (here's an example
> <http://flash.uchicago.edu/site/flashcode/user_support/flash4_ug_4p4/node44.html>,
> and here's the syntax documentation
> <http://flash.uchicago.edu/site/flashcode/user_support/flash4_ug_4p4/node34.html>
> ).
>
> Cheers,
> Jason
>
>
> On Sat, Nov 11, 2017 at 3:55 PM, Slavin, Jonathan <jslavin at cfa.harvard.edu
> > wrote:
>
>> Hi,
>>
>> I'm trying to debug some user contributed code that I modified. In that
>> code there a line like:
>> #ifdef XYZ_VAR
>>     solnData(XYZ_VAR,x,y,z) = ...
>> #endif
>>
>> So my question is, how should one define some variable XYZ_VAR?  In the
>> Config file? It seems not like an ordinary variable definition since it's
>> associated with the definition of solnData.  Any help would be appreciated.
>>
>> Regards,
>> Jon
>>
>> --
>> ________________________________________________________
>> Jonathan D. Slavin                 Harvard-Smithsonian CfA
>> jslavin at cfa.harvard.edu       60 Garden Street, MS 83
>> phone: (617) 496-7981       Cambridge, MA 02138-1516
>> cell: (781) 363-0035             USA
>> ________________________________________________________
>>
>>
>


-- 
________________________________________________________
Jonathan D. Slavin                 Harvard-Smithsonian CfA
jslavin at cfa.harvard.edu       60 Garden Street, MS 83
phone: (617) 496-7981       Cambridge, MA 02138-1516
cell: (781) 363-0035             USA
________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://flash.rochester.edu/pipermail/flash-users/attachments/20171113/44a16920/attachment.htm>


More information about the flash-users mailing list