allpix::FieldParser
Class to parse Allpix Squared field data from files. More…
#include <field_parser.h>
Public Functions
Name | |
---|---|
FieldParser(const FieldQuantity quantity) | |
~FieldParser() =default | |
FieldData< T > | getByFileName(const std::filesystem::path & file_name, const std::string & units =std::string()) Parse a file and retrieve the field data. |
Detailed Description
template <typename T =double>
class allpix::FieldParser;
Class to parse Allpix Squared field data from files.
This class can be used to deserialize and parse FieldData objects from files of different format. The FieldData objects read from file are cached, and a cache hit will be returned when trying to re-read a file with the same canonical path.
Public Functions Documentation
function FieldParser
inline explicit FieldParser(
const FieldQuantity quantity
)
Parameters:
- quantity Quantity of individual field points, vector (three values per point) or scalar (one value per point)
Construct a FieldParser
function ~FieldParser
~FieldParser() =default
function getByFileName
inline FieldData< T > getByFileName(
const std::filesystem::path & file_name,
const std::string & units =std::string()
)
Parse a file and retrieve the field data.
Parameters:
- file_name File name (as canonical path) of the input file to be parsed
- units Optional units to convert the field from after reading from file. 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
Return: Field data object read from file or internal cache
The type of the field data file to be read is deducted automatically from the file content
Updated on 2025-02-27 at 14:14:46 +0000