Specifying the intent of subroutine arguments is good practice for a number of reasons (it allows the compiler to flag up when we're modifying arguments which we said we didn't want to change, it can allow better compiler optimisation, required to declare routines pure etc.).
Currently there are a number of routines in which we don't specify the intent. It is likely to take quite a while to track them all down (as I can't find a simple way to get the compiler to flag this up, though some compilers may provide this -- if anyone knows how please let me know) and as such I'd suggest this should be an ongoing activity, i.e. if you write new code please specify the intent of all arguments and if you come across existing routines which don't have specified intent then please think about adding this. I've created a branch [r3128] (from trunk [r3127]) to try to address this.
As this is not really a new feature and is something that is ongoing we may want to think about doing this directly in trunk in the future?
Commit: <Commit _id='51b89c172718462f49a95b40:3128'
tree_id='179789530252de35a05a0e1ab41331dad0eb5012'
committed=I{'date': datetime.datetime(2014, 12, 3, 12, 21,
57, 629000), 'email': '', 'name': 'ddickinson'}
authored=I{'date': datetime.datetime(2014, 12, 3, 12, 21,
57, 629000), 'email': '', 'name': 'ddickinson'}
message='Creating a branch for specifying the intent of
subroutine arguments.'
parent_ids=I['51b89c172718462f49a95b40:3127']
child_ids=I['51b89c172718462f49a95b40:3129']
repo_ids=I[ObjectId('51b89c172718462f49a95b40')]>
Commit: <Commit _id='51b89c172718462f49a95b40:3127'
tree_id='054cbf53d49a742325059b3b49b65d7057de6534'
committed=I{'date': datetime.datetime(2014, 12, 3, 12, 5,
50, 581000), 'email': '', 'name': 'edmundhighcock'}
authored=I{'date': datetime.datetime(2014, 12, 3, 12, 5,
50, 581000), 'email': '', 'name': 'edmundhighcock'}
message='--Added the variable user_comments to the
namelist parameters. This is a string which can be used to
add a description of the run. It is added as metadata to
the netcdf file'
parent_ids=I['51b89c172718462f49a95b40:3126']
child_ids=I['51b89c172718462f49a95b40:3128']
repo_ids=I[ObjectId('51b89c172718462f49a95b40')]>
[r3129] introduces a number of intent statements throughout the files in the main directory (i.e. ignoring utils/Aux/geo etc.).
During this process I spotted (and fixed) a potential bug in
collisions.fpp
in the routinesolfp_ediffuse_standard_layout
. Here the dist fn. was declared asintent(out)
but was being used to populate other arrays. I believe the Fortran standard does not require the values of anintent(out)
variable to be populated on entry to the routine.Related
Commit: <Commit _id='51b89c172718462f49a95b40:3129' tree_id='9e2f36432940eb134e57f7c9efc21e0f1251bf4d' committed=I{'date': datetime.datetime(2014, 12, 3, 16, 43, 45, 539000), 'email': '', 'name': 'ddickinson'} authored=I{'date': datetime.datetime(2014, 12, 3, 16, 43, 45, 539000), 'email': '', 'name': 'ddickinson'} message='Adding a number of missing intent statements throughout the code.' parent_ids=I['51b89c172718462f49a95b40:3128'] child_ids=I['51b89c172718462f49a95b40:3130'] repo_ids=I[ObjectId('51b89c172718462f49a95b40')]>
[r3135] addresses a number of intent statements throughout the modules provided in the
geo
folder (it ignores programs located here, which should probably be moved to Aux).Remaining areas to look at are the test directories (
benchmarks
,unit_tests
etc.), the new diagnostics and the external directory (utils
).Related
Commit: <Commit _id='51b89c172718462f49a95b40:3135' tree_id='f0b93b5dc03b5e7a2224154c7795c91a4cf8dbfb' committed=I{'date': datetime.datetime(2014, 12, 4, 13, 37, 44, 508000), 'email': '', 'name': 'ddickinson'} authored=I{'date': datetime.datetime(2014, 12, 4, 13, 37, 44, 508000), 'email': '', 'name': 'ddickinson'} message='Adding intent statements to most of the geo/ routines. Updates [features:#10]' parent_ids=I['51b89c172718462f49a95b40:3134'] child_ids=I['51b89c172718462f49a95b40:3136'] repo_ids=I[ObjectId('51b89c172718462f49a95b40')]>
Last edit: David Dickinson 2014-12-04
[r3136] deals with the majority of the utils directory. I've not yet done redistribute or mp. I've not intention of doing mds or pgplot related files (are these used anywhere?).
Related
Commit: <Commit _id='51b89c172718462f49a95b40:3136' tree_id='cda5bca1f48458f953cdc67c3cee65bd48197cf1' committed=I{'date': datetime.datetime(2014, 12, 5, 15, 25, 19, 417000), 'email': '', 'name': 'ddickinson'} authored=I{'date': datetime.datetime(2014, 12, 5, 15, 25, 19, 417000), 'email': '', 'name': 'ddickinson'} message='Minor tweaks, mostly to ensure all routines specify the intent of their arguments. Not yet done redistribute or mp. Updates [features:#10]' parent_ids=I['51b89c172718462f49a95b40:3135'] child_ids=I['51b89c172718462f49a95b40:3137'] repo_ids=I[ObjectId('51b89c172718462f49a95b40')]>
[r3140] corrects an error in
gk_complex_root
, apologies.Related
Commit: <Commit _id='51b89c172718462f49a95b40:3140' tree_id='3b76ef7c6f07a831adecd23466c6b45b8da3826d' committed=I{'date': datetime.datetime(2014, 12, 9, 8, 15, 14, 136000), 'email': '', 'name': 'rnumata'} authored=I{'date': datetime.datetime(2014, 12, 9, 8, 15, 14, 136000), 'email': '', 'name': 'rnumata'} message='* bug fix in gk_complex_root:\n\tProcedure attribute conflicts with INTENT attribute.\n\tmissing declaration.\n* bug fix in job_manage\n\tmpi_wtime cannot be used with MPIINC.\n' parent_ids=I['51b89c172718462f49a95b40:3139'] child_ids=I['51b89c172718462f49a95b40:3141'] repo_ids=I[ObjectId('51b89c172718462f49a95b40')]>