[gmx-developers] A question about 'enum' datatype in Gromacs, ask for help

Erik Marklund erikm at xray.bmc.uu.se
Fri Mar 11 15:49:04 CET 2011


As for the second question, the files are NOT matched automatically, so 
whenever a developer extends an enum the corresponding const arrays in 
e.g. names.c must be updated manually.

Erik

Yukun Wang skrev 2011-03-11 15.25:
> Hi,
> I am recently reading the GMX src-code for some need. I notice there 
> are many 'enum' typy defination in the 'enums.h' file. They are just 
> like this:
>
> ...
> enum {
>   epbcXYZ, epbcNONE, epbcXY, epbcSCREW, epbcNR
> };
>
> enum {
>   etcNO, etcBERENDSEN, etcNOSEHOOVER, etcYES, etcANDERSEN, 
> etcANDERSENINTERVAL, etcVRESCALE, etcNR
> };
> ...
>
> However in the standard C, enum type should be defined like ' enum 
> enumtypename { Sum, Mon,...,Sat } enumname1 ' .
> For the GMX code above I don't understand how it is work?
>
> I also notice there is a note ' /* note: these enums should correspond 
> to the names in gmxlib/names.c */' ,
> ...
> const char *epbc_names[epbcNR+1]=
> {
>   "xyz", "no", "xy", "screw", NULL
> };
>
> const char *ens_names[ensNR+1]=
> {
>   "Grid","Simple", NULL
> };
> ...
> I just don't know how the two files are matched automatically. Is any 
> suggestion about this?
>
>
>
>


-- 
-----------------------------------------------
Erik Marklund, PhD student
Dept. of Cell and Molecular Biology, Uppsala University.
Husargatan 3, Box 596,    75124 Uppsala, Sweden
phone:    +46 18 471 4537        fax: +46 18 511 755
erikm at xray.bmc.uu.se    http://folding.bmc.uu.se/




More information about the gromacs.org_gmx-developers mailing list