gavin971 / cvmix

Automatically exported from code.google.com/p/cvmix
0 stars 0 forks source link

Error checking in put / get statements #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
We should make sure the shape of any arrays being stored via cvmix_put are the 
same shape as the data type attribute they are being stored in.

Example:

1) This is good, because zt should be size nlev

allocate(depth(5))
cvmix_put(CVMix_vars, 'nlev',     5)
cvmix_put(CVMix_vars,   'zt', depth)

2) This is bad, but results in a seg-fault instead of a clean error

allocate(depth(8))
cvmix_put(CVMix_vars, 'nlev',     5)
cvmix_put(CVMix_vars,   'zt', depth)

3) This is also bad, and I think will also seg-fault... at the very least it 
will do something unexpected

allocate(depth(5))
cvmix_put(CVMix_vars, 'nlev',     8)
cvmix_put(CVMix_vars,   'zt', depth)

Original issue reported on code.google.com by mike.lev...@gmail.com on 7 Jun 2013 at 11:03

GoogleCodeExporter commented 9 years ago
moved to github

Original comment by mike.lev...@gmail.com on 9 Feb 2014 at 7:15