WarpX
Public Member Functions | Private Attributes | List of all members
utils::parser::IntervalsParser Class Reference

This class is a parser for multiple slices of the form x,y,z,... where x, y and z are slices of the form i:j:k, as defined in the SliceParser class. This class contains a vector of SliceParsers. More...

#include <IntervalsParser.H>

Public Member Functions

 IntervalsParser ()=default
 Default constructor of the IntervalsParser class. More...
 
 IntervalsParser (const std::vector< std::string > &instr_vec)
 Constructor of the IntervalsParser class. More...
 
bool contains (int n) const
 A method that returns true if the input integer is contained in any of the slices contained by the IntervalsParser. More...
 
int nextContains (int n) const
 A method that returns the smallest integer strictly greater than n such that contains(n) is true. Returns std::numeric_limits<int>::max() if there is no such integer. More...
 
int previousContains (int n) const
 A method that returns the greatest integer strictly smaller than n such that contains(n) is true. Returns 0 if there is no such integer. More...
 
int previousContainsInclusive (int n) const
 A method that returns the greatest integer smaller than or equal to n such that contains(n) is true. Returns 0 if there is no such integer. More...
 
int localPeriod (int n) const
 A method the local period (in timesteps) of the IntervalsParser at timestep n. The period is defined by nextContains(n) - previousContainsInclusive(n) More...
 
bool isActivated () const
 A method that returns true if any of the slices contained by the IntervalsParser has a strictly positive period. More...
 

Private Attributes

std::vector< SliceParserm_slices
 
std::string m_separator = ","
 
bool m_activated = false
 

Detailed Description

This class is a parser for multiple slices of the form x,y,z,... where x, y and z are slices of the form i:j:k, as defined in the SliceParser class. This class contains a vector of SliceParsers.

Constructor & Destructor Documentation

◆ IntervalsParser() [1/2]

utils::parser::IntervalsParser::IntervalsParser ( )
default

Default constructor of the IntervalsParser class.

◆ IntervalsParser() [2/2]

utils::parser::IntervalsParser::IntervalsParser ( const std::vector< std::string > &  instr_vec)

Constructor of the IntervalsParser class.

Parameters
[in]instr_vecan input vector string, which when concatenated is of the form "x,y,z,...". This will call the constructor of SliceParser using x, y and z as input arguments.

Member Function Documentation

◆ contains()

bool utils::parser::IntervalsParser::contains ( int  n) const

A method that returns true if the input integer is contained in any of the slices contained by the IntervalsParser.

Parameters
[in]nthe input integer

◆ isActivated()

bool utils::parser::IntervalsParser::isActivated ( ) const

A method that returns true if any of the slices contained by the IntervalsParser has a strictly positive period.

◆ localPeriod()

int utils::parser::IntervalsParser::localPeriod ( int  n) const

A method the local period (in timesteps) of the IntervalsParser at timestep n. The period is defined by nextContains(n) - previousContainsInclusive(n)

Parameters
[in]nthe input integer

◆ nextContains()

int utils::parser::IntervalsParser::nextContains ( int  n) const

A method that returns the smallest integer strictly greater than n such that contains(n) is true. Returns std::numeric_limits<int>::max() if there is no such integer.

Parameters
[in]nthe input integer

◆ previousContains()

int utils::parser::IntervalsParser::previousContains ( int  n) const

A method that returns the greatest integer strictly smaller than n such that contains(n) is true. Returns 0 if there is no such integer.

Parameters
[in]nthe input integer

◆ previousContainsInclusive()

int utils::parser::IntervalsParser::previousContainsInclusive ( int  n) const

A method that returns the greatest integer smaller than or equal to n such that contains(n) is true. Returns 0 if there is no such integer.

Parameters
[in]nthe input integer

Member Data Documentation

◆ m_activated

bool utils::parser::IntervalsParser::m_activated = false
private

◆ m_separator

std::string utils::parser::IntervalsParser::m_separator = ","
private

◆ m_slices

std::vector<SliceParser> utils::parser::IntervalsParser::m_slices
private

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