MaxvdKolk / govtk

Write VTK XML files from Go.
MIT License
5 stars 0 forks source link

Repeated code writing to payload #2

Closed MaxvdKolk closed 4 years ago

MaxvdKolk commented 4 years ago

There is quite a bit of repeated code to write into the payload structs. The idea is simple; write slice of ints or floats into the buffer, followed by an update of the block size. However, the functions to perform this are located at 3 places, which is not desired.

I think these methods can be placed within the payload struct and embedded in asciier, base64er, and the binaryer. If needed, we can extend their functionality?

MaxvdKolk commented 4 years ago

The repeated code is minimised by having a more general function call, with interface{}. Still need to make the calls such as PointData, CellData, and Data, have this interface as well. For now, these only take []float64.

Need to investigate how the code will look when propagating empty interfaces.

MaxvdKolk commented 4 years ago

Has been implemented.