Zoltan2
Loading...
Searching...
No Matches
Zoltan2::IntegerRangeListValidator< Integral > Class Template Reference

A ParameterList validator for integer range lists. More...

#include <Zoltan2_IntegerRangeList.hpp>

Inherits Teuchos::ParameterEntryValidator.

Public Member Functions

 IntegerRangeListValidator (bool unsorted=false)
 Constructor: any Integral is valid.
 IntegerRangeListValidator (Integral validMin, Integral validMax, bool unsorted=false)
 Constructor: only Integrals in the specified range are valid.
const std::string getXMLTypeName () const
void printDoc (std::string const &docString, std::ostream &out) const
ValidStringsList validStringValues () const
void validate (Teuchos::ParameterEntry const &entry, std::string const &paramName, std::string const &sublistName) const
void validateAndModify (std::string const &paramName, std::string const &sublistName, Teuchos::ParameterEntry *entry) const
Integral getAllowedMinimum () const
 Return the minimum value permitted in the list.
Integral getAllowedMaximum () const
 Return the maximum value permitted in the list.
bool inputListWillBeSorted () const
 Return whether the list is sorted or not.

Detailed Description

template<typename Integral>
class Zoltan2::IntegerRangeListValidator< Integral >

A ParameterList validator for integer range lists.

An integer range list is a concise way to provide a list of integers. It is set as a string. Valid values are:

  • an integer
  • a range of integers given as two integers separated by a dash
  • the word "all"
  • any comma separated list of the above three

Examples:

  • "1,5,12,30-39,101"
  • "all"

A constructor flag determines how the list is processed at validateAndModify() time. Either the list is sorted and duplicates are removed, or the list remains as it was entered by the user. For example, if the list is to be modified:

 - "1,5,2,1" becomes "1,2,5"
 - "1-10,9-15" becomes 1-15"

Typical use cases for an integer range list are:

  • the list of processes that print status information
  • the list of fixed vertex IDs in a partitioning operation

At the call to validateAndModify(), the integer range list parameter value is changed from a string to an Array<Integral> which encodes the meaning of the string. (The last value in the array specifies whether the values are listed, whether the user requested "all", or whether the first and last value of a range is provided.)

Helper functions for interpreting the integer range list after it has been validated are:

  • IsInRangeList(const Integral val, const Teuchos::Array<Integral> &valList, bool sorted=true)

The template parameter is the data type of the values in the list.

Definition at line 358 of file Zoltan2_IntegerRangeList.hpp.

Constructor & Destructor Documentation

◆ IntegerRangeListValidator() [1/2]

template<typename Integral>
Zoltan2::IntegerRangeListValidator< Integral >::IntegerRangeListValidator ( bool unsorted = false)

Constructor: any Integral is valid.

Parameters
unsortednormally the input integers will be sorted and duplicates will be removed. If this is not the desired behavior, then set unsorted to true.

Definition at line 501 of file Zoltan2_IntegerRangeList.hpp.

◆ IntegerRangeListValidator() [2/2]

template<typename Integral>
Zoltan2::IntegerRangeListValidator< Integral >::IntegerRangeListValidator ( Integral validMin,
Integral validMax,
bool unsorted = false )

Constructor: only Integrals in the specified range are valid.

Parameters
validMinall values implied by the integer range list must be bounded by this minimum.
validMaxall values implied by the integer range list must be bounded by this maximum.
unsortednormally the input integers will be sorted and duplicates will be removed.. If this is not the desired behavior, then set unsorted to true.

Definition at line 507 of file Zoltan2_IntegerRangeList.hpp.

Member Function Documentation

◆ getXMLTypeName()

template<typename Integral>
const std::string Zoltan2::IntegerRangeListValidator< Integral >::getXMLTypeName ( ) const

Definition at line 518 of file Zoltan2_IntegerRangeList.hpp.

◆ printDoc()

template<typename Integral>
void Zoltan2::IntegerRangeListValidator< Integral >::printDoc ( std::string const & docString,
std::ostream & out ) const

Definition at line 526 of file Zoltan2_IntegerRangeList.hpp.

◆ validStringValues()

template<typename Integral>
ValidStringsList Zoltan2::IntegerRangeListValidator< Integral >::validStringValues ( ) const

Definition at line 542 of file Zoltan2_IntegerRangeList.hpp.

◆ validate()

template<typename Integral>
void Zoltan2::IntegerRangeListValidator< Integral >::validate ( Teuchos::ParameterEntry const & entry,
std::string const & paramName,
std::string const & sublistName ) const

Definition at line 548 of file Zoltan2_IntegerRangeList.hpp.

◆ validateAndModify()

template<typename Integral>
void Zoltan2::IntegerRangeListValidator< Integral >::validateAndModify ( std::string const & paramName,
std::string const & sublistName,
Teuchos::ParameterEntry * entry ) const

Definition at line 601 of file Zoltan2_IntegerRangeList.hpp.

◆ getAllowedMinimum()

template<typename Integral>
Integral Zoltan2::IntegerRangeListValidator< Integral >::getAllowedMinimum ( ) const
inline

Return the minimum value permitted in the list.

If getAllowedMinimum() > getAllowedMaximum(), then there are no limits on the integer values in the list.

Definition at line 421 of file Zoltan2_IntegerRangeList.hpp.

◆ getAllowedMaximum()

template<typename Integral>
Integral Zoltan2::IntegerRangeListValidator< Integral >::getAllowedMaximum ( ) const
inline

Return the maximum value permitted in the list.

If getAllowedMinimum() > getAllowedMaximum(), then there are no limits on the integer values in the list.

Definition at line 428 of file Zoltan2_IntegerRangeList.hpp.

◆ inputListWillBeSorted()

template<typename Integral>
bool Zoltan2::IntegerRangeListValidator< Integral >::inputListWillBeSorted ( ) const
inline

Return whether the list is sorted or not.

By default, when the parameter value (a list of integers and integer ranges), is processed it is sorted and duplicates are removed. A constructor argument can be set so that the list is not sorted and duplicates are not removed.

Definition at line 436 of file Zoltan2_IntegerRangeList.hpp.


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