Added utility function to encode complex types to be written to HDF5 file with the right complex field names.
Changed writing of complex types to set complex field names manually.