Minor optimizations

* No dynamic memory allocation in subCubeTerm, use on stack variables.
* Optimization for threadCount=1, direct subCubeTerm call.