SpinParser  1.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TaskFileParser Class Reference

Task file parser routine. The object is bound to a single task file, which it initially reads and parses, and can thereafter write to. More...

#include <TaskFileParser.hpp>

Public Member Functions

 TaskFileParser (const std::string &taskFilePath, FrequencyDiscretization *&frequency, CutoffDiscretization *&cutoff, Lattice *&lattice, FrgCore *&frgCore, ComputationStatus &computationStatus)
 Construct a new TaskFileParser object and parse the specified task file. More...
 
void writeTaskFile (const ComputationStatus &computationStatus)
 Write calculation status to the task file. More...
 

Protected Member Functions

void _validateProperties (const boost::property_tree::ptree &tree, const std::string &node, const std::set< std::string > &requiredChildren, const std::set< std::string > &requiredAttributes, const std::set< std::string > &optionalChildren={}, const std::set< std::string > &optionalAttributes={}) const
 Ensure that a given property tree contains a specific node with only known required or optional elements. Throw an Exception::Type::InitializationError if the requirements are not fulfilled. More...
 
void _validateRequiredChildren (const boost::property_tree::ptree &tree, const std::string &node, const std::set< std::string > &requiredChildren, const std::string &treePath="") const
 Ensure that a given property tree contains a specific node and test that the node contains a list of required children. Throw an Exception::Type::InitializationError if the requirements are not fulfilled. More...
 
void _validateRequiredAttributes (const boost::property_tree::ptree &tree, const std::string &node, const std::set< std::string > &requiredAttributes, const std::string &treePath="") const
 Ensure that a given property tree contains a specific node and test that the node contains a list of required attributes. Throw an Exception::Type::InitializationError if the requirements are not fulfilled. More...
 
void _validateOptionalChildren (const boost::property_tree::ptree &tree, const std::string &node, const std::set< std::string > &optionalChildren, const std::string &treePath="") const
 Ensure that a given property tree contains a specific node and test that the node contains only children from a list of optional values. Throw an Exception::Type::InitializationError if the requirements are not fulfilled. More...
 
void _validateOptionalAttributes (const boost::property_tree::ptree &tree, const std::string &node, const std::set< std::string > &optionalAttributes, const std::string &treePath="") const
 Ensure that a given property tree contains a specific node and test that the node contains only attributes from a list of optional values. Throw an Exception::Type::InitializationError if the requirements are not fulfilled. More...
 

Protected Attributes

boost::property_tree::ptree _taskFile
 Internal property tree representation of the parsed task file.
 

Detailed Description

Task file parser routine. The object is bound to a single task file, which it initially reads and parses, and can thereafter write to.

Constructor & Destructor Documentation

◆ TaskFileParser()

TaskFileParser::TaskFileParser ( const std::string &  taskFilePath,
FrequencyDiscretization *&  frequency,
CutoffDiscretization *&  cutoff,
Lattice *&  lattice,
FrgCore *&  frgCore,
ComputationStatus computationStatus 
)

Construct a new TaskFileParser object and parse the specified task file.

During the parsing process, the TaskFileParser will allocate and initialize (with parameters as specified in the task file) FrequencyDiscretization, CutoffDiscretization, and Lattice objects; The pointers to those objects are stored in frequency, cutoff, and lattice, respectively. Furthermore, it allocates the FrgCore (including the FrgCore::measurements) specified in the task file and writes it to frgCore. The computation status associated with the task file is also returned.

Parameters
[in]taskFilePathPath to the task file to be parsed.
[out]frequencyNewly generated FrequencyDiscretization.
[out]cutoffNewly generated CutoffDiscretization.
[out]latticeNewly generated Lattice.
[out]frgCoreNewly generated FRG core.
[out]computationStatusComputation status of the task associated with the task file.

Member Function Documentation

◆ _validateOptionalAttributes()

void TaskFileParser::_validateOptionalAttributes ( const boost::property_tree::ptree &  tree,
const std::string &  node,
const std::set< std::string > &  optionalAttributes,
const std::string &  treePath = "" 
) const
protected

Ensure that a given property tree contains a specific node and test that the node contains only attributes from a list of optional values. Throw an Exception::Type::InitializationError if the requirements are not fulfilled.

Parameters
treeProperty tree to test.
nodeNode to test.
optionalAttributesList of optional attributes of the node.
treePathProperty path, which is prepended to the node name in a potential exception thrown.

◆ _validateOptionalChildren()

void TaskFileParser::_validateOptionalChildren ( const boost::property_tree::ptree &  tree,
const std::string &  node,
const std::set< std::string > &  optionalChildren,
const std::string &  treePath = "" 
) const
protected

Ensure that a given property tree contains a specific node and test that the node contains only children from a list of optional values. Throw an Exception::Type::InitializationError if the requirements are not fulfilled.

Parameters
treeProperty tree to test.
nodeNode to test.
optionalChildrenList of optional children of the node.
treePathProperty path, which is prepended to the node name in a potential exception thrown.

◆ _validateProperties()

void TaskFileParser::_validateProperties ( const boost::property_tree::ptree &  tree,
const std::string &  node,
const std::set< std::string > &  requiredChildren,
const std::set< std::string > &  requiredAttributes,
const std::set< std::string > &  optionalChildren = {},
const std::set< std::string > &  optionalAttributes = {} 
) const
protected

Ensure that a given property tree contains a specific node with only known required or optional elements. Throw an Exception::Type::InitializationError if the requirements are not fulfilled.

Parameters
treeProperty tree to test.
nodeNode to test.
requiredChildrenList of required children of the node.
requiredAttributesList of required attributes of the node.
optionalChildrenList of optional children of the node.
optionalAttributesList of optional attributes of the node.

◆ _validateRequiredAttributes()

void TaskFileParser::_validateRequiredAttributes ( const boost::property_tree::ptree &  tree,
const std::string &  node,
const std::set< std::string > &  requiredAttributes,
const std::string &  treePath = "" 
) const
protected

Ensure that a given property tree contains a specific node and test that the node contains a list of required attributes. Throw an Exception::Type::InitializationError if the requirements are not fulfilled.

Parameters
treeProperty tree to test.
nodeNode to test.
requiredAttributesList of required attributes of the node.
treePathProperty path, which is prepended to the node name in a potential exception thrown.

◆ _validateRequiredChildren()

void TaskFileParser::_validateRequiredChildren ( const boost::property_tree::ptree &  tree,
const std::string &  node,
const std::set< std::string > &  requiredChildren,
const std::string &  treePath = "" 
) const
protected

Ensure that a given property tree contains a specific node and test that the node contains a list of required children. Throw an Exception::Type::InitializationError if the requirements are not fulfilled.

Parameters
treeProperty tree to test.
nodeNode to test.
requiredChildrenList of required children of the node.
treePathProperty path, which is prepended to the node name in a potential exception thrown.

◆ writeTaskFile()

void TaskFileParser::writeTaskFile ( const ComputationStatus computationStatus)

Write calculation status to the task file.

Parameters
finalizeIf set to true, the task status will be set to 'finished'.
updateCheckpointIf set to true, the last checkpoint time will be set to the current time.

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