Skip to content

Automatically Deduce File Type for Field Data

Simon Spannagel requested to merge auto_filetype into master

This MR removes the previously available settings model = "init" and model = "apf" of the ElectricFieldReader module and replaces it with a new model named "mesh". The type of file to be read is automatically deducted from the content of the file by the FieldParser, similar to what GNU diff does:

diff determines whether a file is text or binary by checking the first few bytes in the file; the exact number of bytes is system dependent, but it is typically several thousand. If every byte in that part of the file is non-null, diff considers the file to be text; otherwise it considers the file to be binary.

https://www.gnu.org/software/diffutils/manual/html_node/Binary.html

This significantly improves user experience because no specific mode has to be set for the two different field data types supported. Also, it simplifies the code at several places where previously the file type was deduced from e.g. the file extension.

Backwards compatibility is guaranteed by overwriting outdated values of the model field with the new value.

Merge request reports