Add utils function to flatten an iterable
Refactor extrusion host code generation
Merge pull request #234 from OP2/refactor-codegen



Small code refactoring to make mixed space code generation easier.