optimad / bitpit

Open source library for scientific HPC
http://optimad.github.io/bitpit/
GNU Lesser General Public License v3.0
116 stars 33 forks source link

IO: STLReader::detectFormat returning FormatUnknown for STL case #402

Closed kgkara closed 1 year ago

kgkara commented 1 year ago

When calling STLReader::detectFormat, it returns STLBase::Format::FormatUnknown for the attached STL case: case.stl.txt Please remove the ".txt" extension to test it.

The input argument to the method is filename = "./geodata/case.stl"

The same file can be opened with paraview and other software.

andrea-iob commented 1 year ago

bitpit follows the guidelines of wikipedia for the detection of the file format, in this case this is the relevant part: "An ASCII STL file begins with the line "solid name", where name is an optional string (though if name is omitted there must still be a space after solid, for compatibility with some software)."

The attached file doesn't contain a space after the solid word.

After removing the requirement of an empty space after the solid word, the file is correctly detected as ASCII. The same happens if the space is added in the file.

I don't have a strong opinion on this. We can remove the requirement of the space character.