pass references instead of pointers, use const, do not use Real* arrays (#3472)