Refactor pack logic
Make the different cases more explicit by defining source and target.
This also allows to go from a batch that is packed on the host to packed on the device and vice versa.
- I have checked that my code follows the Octopus coding standards
- I have added tests for all the new features added in this request.