Change pointer-based arrays to allocatable arrays where possible
- Dominant language
- Fortran
- Stars
- 352
- Forks
- 361
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
Pointers are supposed to be worse for performance. We should assess the
impact of using pointers in all of our derived types, and (assuming this
has a significant impact) change the code to use allocatable arrays
instead of pointers.
* [ ] Assess impact of pointers on performance
* Put timers around some representative part of the code
* Check current timing
* Change all pointers to allocatable arrays in that part of the code
* May need to temporarily get rid of some other code that
requires pointers, such as adding the relevant fields to the
history field list)
* Note that the allocatable arrays will still need the target
attribute, because we do have a need to keep pointers to some
of these things (e.g., for history fields)
* Re-check timing
* [ ] Change infrastructure code that currently requires pointers to
no longer require pointers
* In cases where we need the ability to point to the passed-in
array, the dummy argument can have the "target" attribute rather
than the "pointer" attribute
* In many cases, the infrastructure code that accepted pointers also
made use of the lower bounds of the dummy variable - since
pointers maintain their lower bounds when passed to a subroutine,
whereas other arrays do not. In cases where the lower bound is
needed (and not 1), this will now need to be passed in explicitly.
* Note that we have plans to change all lower bounds for
gridcell, landunit, column, etc. indices to be 1. If we do
that first, this task will become easier - though we may still
need to pass in the lower bounds in a few cases for level
dimensions.
* [ ] Change arrays to allocatable with the pointer attribute
Contributor guide
Assessment
This issue has not been assessed yet.