allpix::FieldWriter

Class to write Allpix Squared field data to files. More…

#include <field_parser.h>

Public Functions

Name
FieldWriter(const FieldQuantity quantity)
Construct a FileWriter.
~FieldWriter() =default
void writeFile(const FieldData< T > & field_data, const std::filesystem::path & file_name, const FileType & file_type, const std::string & units =std::string())
Write the field to a file.

Detailed Description

template <typename T  =double>
class allpix::FieldWriter;

Class to write Allpix Squared field data to files.

This class can be used to serialize FieldData objects into files using different formats. Scalar as well as vector fields are supported.

Public Functions Documentation

function FieldWriter

inline explicit FieldWriter(
    const FieldQuantity quantity
)

Construct a FileWriter.

Parameters:

  • quantity Quantity of individual field points, vector (three values per point) or scalar (one value per point)

function ~FieldWriter

~FieldWriter() =default

function writeFile

inline void writeFile(
    const FieldData< T > & field_data,
    const std::filesystem::path & file_name,
    const FileType & file_type,
    const std::string & units =std::string()
)

Write the field to a file.

Parameters:

  • field_data Field data object to store
  • file_name File name (as canonical path) of the output file to be created
  • file_type Type of file (file format) to be produced
  • units Optional units to convert the field into before writing. Only used by some formats.

Exceptions:

  • std::runtime_error if the file format is unknown or invalid field dimensions are detected
  • std::filesystem::filesystem_error if the provided path does not exist

Updated on 2024-12-13 at 08:31:36 +0000