Doxygen 1.9.1
Toolkit for Adaptive Stochastic Modeling and Non-Intrusive ApproximatioN: Tasmanian v8.2 (development)
Templates for common I/O methods, simple binary/ascii switch provided for all templates
Collaboration diagram for Templates for common I/O methods, simple binary/ascii switch provided for all templates:

Files

file  tsgIOHelpers.hpp
 Templates to simply file I/O.
 

Classes

struct  TasGrid::IO::mode_ascii_type
 Type indicating ascii I/O mode. More...
 
struct  TasGrid::IO::mode_binary_type
 Type indicating binary I/O mode. More...
 

Enumerations

enum  TasGrid::IO::IOPad {
  TasGrid::IO::pad_none , TasGrid::IO::pad_rspace , TasGrid::IO::pad_lspace , TasGrid::IO::pad_line ,
  TasGrid::IO::pad_auto
}
 Indicate the type of padding to use, none, space, new-line, etc. More...
 

Functions

template<typename iomode , typename DataType , typename IndexStride , typename IndexNumStrips >
Data2D< DataType > TasGrid::IO::readData2D (std::istream &is, IndexStride stride, IndexNumStrips num_strips)
 Read the Data2D structure from the stream, assumes the given number of strips and stride. More...
 
std::map< std::string, TypeOneDRuleTasGrid::IO::getStringRuleMap ()
 Creates a map with std::string rule names (used by C/Python/CLI) mapped to TypeOneDRule enums.
 
TypeOneDRule TasGrid::IO::getRuleString (std::string const &name)
 Map the string rule name to the enumerate, used in ASCII I/O, command line and Python.
 
std::string TasGrid::IO::getRuleString (TypeOneDRule rule)
 Map the enumerate to a string, used in ASCII I/O, command line and Python.
 
std::vector< TypeOneDRuleTasGrid::IO::getIntRuleMap ()
 Creates a map with int (used by Fortran and binary I/O) mapped to TypeOneDRule enums.
 
TypeOneDRule TasGrid::IO::getRuleInt (int r)
 Map the int rule index to the enumerate, used in Fortran and binary IO.
 
int TasGrid::IO::getRuleInt (TypeOneDRule rule)
 Map the enumerate to an int, used in Fortran and binary IO.
 
std::map< std::string, TypeDepthTasGrid::IO::getStringToDepthMap ()
 Creates a map with std::string rule names (used by C/Python/CLI) mapped to TypeDepth enums.
 
TypeDepth TasGrid::IO::getDepthTypeString (std::string const &name)
 Map the string to the enumerate multi-index selection strategy, used in command line and Python.
 
TypeDepth TasGrid::IO::getDepthTypeInt (int t)
 Map the integer to the enumerate multi-index selection strategy, used in Fortran.
 
std::map< std::string, TypeRefinementTasGrid::IO::getStringToRefinementMap ()
 Creates a map with std::string rule names (used by C/Python/CLI) mapped to TypeRefinement enums.
 
TypeRefinement TasGrid::IO::getTypeRefinementString (std::string const &name)
 Map the string to the enumerate hierarchical refinement strategy, used in command line and Python.
 
TypeRefinement TasGrid::IO::getTypeRefinementInt (int refinement)
 Map the integer to the enumerate hierarchical refinement strategy, used by Fortran.
 
template<bool iomode, IOPad pad>
void TasGrid::IO::writeFlag (bool flag, std::ostream &os)
 Write the flag to file, ascii uses 0 and 1, binary uses characters y and n (counter intuitive, I know).
 
template<typename iomode >
bool TasGrid::IO::readFlag (std::istream &os)
 Read a flag, ascii uses 0 and 1, binary uses characters y and n (counter intuitive, I know).
 
template<bool iomode, IOPad pad, typename VecType >
void TasGrid::IO::writeVector (const std::vector< VecType > &x, std::ostream &os)
 Write the vector to the stream, the vector cannot be empty.
 
template<typename iomode , typename VecType >
void TasGrid::IO::readVector (std::istream &is, std::vector< VecType > &x)
 Read the vector from the stream, the size must already be set.
 
template<typename iomode , typename VecType , typename SizeType >
std::vector< VecType > TasGrid::IO::readVector (std::istream &is, SizeType num_entries)
 Read the vector with the specified size.
 
template<bool iomode, IOPad pad, typename... Vals>
void TasGrid::IO::writeNumbers (std::ostream &os, Vals... vals)
 Write a bunch of numbers with the same type.
 
template<typename iomode , typename Val >
Val TasGrid::IO::readNumber (std::istream &is)
 Read a single number, used to read ints (and potentially cast to size_t) or read a double.
 
template<bool iomode>
void TasGrid::IO::writeRule (TypeOneDRule rule, std::ostream &os)
 Write a rule.
 
template<typename iomode >
TypeOneDRule TasGrid::IO::readRule (std::istream &is)
 Read a rule.
 
TypeSamplingForm TasDREAM::IO::intToForm (int form)
 Converts an integer to TypeSamplingForm, synced with the Python interface. More...
 
std::map< std::string, TypeDistributionTasDREAM::IO::getStringRuleMap ()
 Returns the map from a string to a distribution type. More...
 
TypeDistribution TasDREAM::IO::getDistributionString (std::string const &name)
 Map the string distribution name to the enumerate, used by python. More...
 

Detailed Description

Enumeration Type Documentation

◆ IOPad

Indicate the type of padding to use, none, space, new-line, etc.

Ascii formats are human readable (for small data), but to achieve that new lines and spaces must be added in the right place using the IOPad enumerate.

Enumerator
pad_none 

Do not add padding.

pad_rspace 

Pad with space at the end.

pad_lspace 

Pad with space at the beginning.

pad_line 

Pad with new line.

pad_auto 

Pad with space if the flag is true, newline if false.

Function Documentation

◆ readData2D()

template<typename iomode , typename DataType , typename IndexStride , typename IndexNumStrips >
Data2D<DataType> TasGrid::IO::readData2D ( std::istream &  is,
IndexStride  stride,
IndexNumStrips  num_strips 
)

Read the Data2D structure from the stream, assumes the given number of strips and stride.

◆ intToForm()

TypeSamplingForm TasDREAM::IO::intToForm ( int  form)
inline

Converts an integer to TypeSamplingForm, synced with the Python interface.

◆ getStringRuleMap()

std::map<std::string, TypeDistribution> TasDREAM::IO::getStringRuleMap ( )
inline

Returns the map from a string to a distribution type.

◆ getDistributionString()

TypeDistribution TasDREAM::IO::getDistributionString ( std::string const &  name)
inline

Map the string distribution name to the enumerate, used by python.