gzipped gmad file

Issue #9 resolved
Stewart Boogert created an issue

Add support for large files gzstream? parser in c or C++ how to change the reading

Comments (4)

  1. Laurie Nevay

    We could use zlib. This provides a standard c++ interface to allow looping over files while still compressed. This would require a build dependency though - however, g4 has this so we should be fine. The parser method for reading lines would have to be switchable though.

    Perhaps this is not such a big requirement? The LHC model with all component definition and samplers and sequence (full model) is around 530kb. Even with more detailed description, it is unlikely to breach 1Mb.

    However, this may be extremely useful for magnetic field maps that are really quite big. If we have this mechanism / recipe, it'll be quite easy likely to shove into parser too.

  2. Laurie Nevay

    I agree this is impractical for input gmad files and not really required.

    I have strong interest in this however for field maps - they'll be much smaller and much quicker to load into memory by approximately and order of magnitude.

    I think we have access to zlib already through geant4 - will try.

  3. Laurie Nevay

    This is now implemented for reading in bunch files and fieldmaps (in the fieldmaps branch soon to be published). Thanks to Stewart & Jochem for this.

    We use externally provided gzstream library that gives provides classes derived from std::istream and std::ostream that can be used similarly throughout the code. The bunch file loading and field map loading classes are templated to use these and the appropriate one is used based on the file extension.

    A more extensive CMakeLists.txt has been written (as one wasn't provided for gzstream) that uses the G4zlib component or if not available uses the system zlib. BDISM can still be compiled without zlib support but preprocessor flags filter out the gzstream code and only one template is available. Error messages are printed and BDSIM exits if the user attempts to load a compressed file without zlib support on.

  4. Log in to comment