SPH
Public Member Functions | Friends | List of all members
BinaryOutput Class Reference

Output saving data to binary data without loss of precision. More...

#include <Output.h>

Inheritance diagram for BinaryOutput:
IOutput Polymorphic

Public Member Functions

 BinaryOutput (const OutputFile &fileMask, const RunTypeEnum runTypeId=RunTypeEnum::SPH)
 
virtual Expected< Pathdump (const Storage &storage, const Statistics &stats) override
 Saves data from particle storage into the file. More...
 
- Public Member Functions inherited from IOutput
 IOutput (const OutputFile &fileMask)
 Constructs output given the file name of the output. More...
 
- Public Member Functions inherited from Polymorphic
virtual ~Polymorphic ()
 

Friends

class BinaryInput
 

Additional Inherited Members

- Protected Attributes inherited from IOutput
OutputFile paths
 

Detailed Description

Output saving data to binary data without loss of precision.

specification

File format can store values of type int64 (called Size hereafter), double (called Float hereafter), strings encoded as chars with terminating zero and padding (zero bytes). There are no other types currently used. All other types (Vectors, Tensors, enums, ...) are converted to Floats or Sizes. The file is divided as follows: header, quantity info, n x [material info, quantity data] where n is the number of materials.

Header is always 256 bytes, storing the following:

Quantity info (summary) follows the header. It consist of quantityCnt triples of values

After than there follows material info and quantity data for every stored material. The material info consist of materialCnt blocks with content:

Todo:
Possible todos & fixes:
  • arbitrary precision: store doubles as floats or halfs and size_t as uint32 or uint16, based on data in header
  • deserialized materials are created using Factory::getMaterial from loaded settings. This won't be correct if the material was created differently, i.e. if the material doesn't match the information in the settings it holds. This should be enforced somehow.

Definition at line 335 of file Output.h.

Constructor & Destructor Documentation

◆ BinaryOutput()

BinaryOutput::BinaryOutput ( const OutputFile fileMask,
const RunTypeEnum  runTypeId = RunTypeEnum::SPH 
)
explicit

Definition at line 508 of file Output.cpp.

Member Function Documentation

◆ dump()

Expected< Path > BinaryOutput::dump ( const Storage storage,
const Statistics stats 
)
overridevirtual

Saves data from particle storage into the file.

Returns the filename of the dump, generated from file mask given in constructor, or an error message in case writing the output file failed.

Implements IOutput.

Definition at line 512 of file Output.cpp.

Friends And Related Function Documentation

◆ BinaryInput

friend class BinaryInput
friend

Definition at line 336 of file Output.h.


The documentation for this class was generated from the following files: