[gmx-developers] Where is do_func() defined in the code (for mdp read in, I think)

Mark Abraham Mark.Abraham at anu.edu.au
Fri Oct 31 06:42:01 CET 2008


chris.neale at utoronto.ca wrote:
> Hello,
> 
> I am working my way through the gromacs code with gmx-4.0 and I have a 
> question about how information is read in from the .mdp file.
> 
> I find do_inputrec() in tpxio.c, which calls do_int() or do_real(), etc. 
> These appear to be special cases of do_func() as defined in 
> include/gmxfio.h
> 
> However, I can not find the meat of do_func() anywhere in the src or 
> include directories.

do_func is a typedef. This is just a shorthand for some more complex type.

Here GROMACS seems to need to call a function to do a task, but the 
caller won't always know exactly which function. So the correct function 
to call gets stored in a variable, which needs a type so the compiler 
can pass the right information later. That type is created by the 
typedef. You could use the complex type here at the cost only of 
readability and maintainability.

Mark



More information about the gromacs.org_gmx-developers mailing list