Skip to content

New Field File Format APF & common FieldParser/FieldWriter

Simon Spannagel requested to merge fielddata_apf into master

This MR adds a new file format for (electric...) fields to be read. The new format, called APF (Allpix Squared Field) is a compact binary format with some header information, serialized and deserialized using the cereal library. While the total file size doesn't shrink that much owing to the double-precision floating point numbers used, the time for reading and writing of the field files is reduced by a factor 100 or more.

I took this opportunity to also rework the handling of these filed a bit and we now have a common FieldParser and FieldWriter class which can read and write either INIT or APF files. This means, also the TCAD Mesh Converter does not have to do its own parsing and writing of these files.

Since this requires access to units from different executables, I have put the definition of our units into a separate file.

Along with the format comes a set of small helper tools which allow you to e.g. convert from INIT to APF or the other way around. They can be found in the tools/apf_tools folder of the repository.

One issue is remaining: correct treatment of units. Right now, the requesting module has to specify the units it expects to be present in the file. The FieldParser then translates this into internal units when reading the file - at least for INIT. There is no nice way to implement this in the APF format, at least not in the current way I do this. So we have several options to go forward from here:

  • Make sure it also works properly for APF. This means either that FieldData has to know about units, which I would like to avoid. This class should always hold framework-internal-units raw field data.
  • Always write internal units to APF files. This means, when reading FileType::APF we ignore the units parameter provided to the FieldParser. Also not super nice but maybe the better option?

Ideas welcome.

Merge request reports