PlasCom2  1.0
XPACC Multi-physics simluation application
ix::util Namespace Reference

General support utilities. More...

Detailed Description

General support utilities.

Classes

struct  CmpPairs
 
class  ComLineObject
 Command line processing. More...
 
class  ConfigParameters
 
class  ConfigurationObject
 
class  MenuObject
 
class  Parameters
 
class  sizeextent
 Simple Block Structured Mesh object. More...
 
class  testmanager
 

Typedefs

typedef std::string::size_type strsize
 
typedef primitive::KeyValuePairObj< std::string, std::string > ParamType
 
typedef int Error
 Error type. More...
 

Functions

std::ostream & operator<< (std::ostream &Ostr, const util::ConfigurationObject &cob)
 Stream output operator for util::ConfigurationObject. More...
 
std::istream & operator>> (std::istream &Istr, util::ConfigurationObject &cob)
 Stream input operator for util::ConfigurationObject. More...
 
template<typename DataType >
bool IntervalOverlaps (const DataType &i1, const DataType &i2, const DataType &j1, const DataType &j2)
 
std::ostream & operator<< (std::ostream &outStream, const ix::util::sizeextent &sizeExtent)
 
std::istream & operator>> (std::istream &inStream, ix::util::sizeextent &sizeExtent)
 
std::ostream & operator<< (std::ostream &Ostr, const util::ParamType &param)
 
std::ostream & operator<< (std::ostream &oSt, const util::Parameters &pv)
 
std::istream & operator>> (std::istream &iSt, util::Parameters &pv)
 
template<typename Container >
bool LessThan (const Container &c1, const Container &c2)
 
template<typename Container >
void InvertContainer (const Container &c1, Container &c2)
 
template<typename ContainerType >
void DumpContents (std::ostream &Ostr, const ContainerType &c, std::string del="\)
 Dump container contents. More...
 
template<typename BufferDataType >
int PackBuffer (const BufferDataType *sourceBuffer, const std::vector< size_t > &sourceIndices, BufferDataType *targetBuffer, const std::vector< size_t > &targetIndices)
 Pack subset of target buffer from subset of source buffer. More...
 
template<typename ContainerType , typename T >
void CopyIntoContainer (ContainerType &cont, const T *src, size_t count)
 
template<typename OuterCont , typename OutCont , typename InnerCont , typename MapType >
void MapElements (OuterCont &src, OutCont &trg, MapType &m)
 
template<typename ListContainerType , typename ListType >
primitive::IndexType MaxNodeId (const ListContainerType &fc)
 Return the maximum of all elements of a multicontainer. More...
 
template<typename OuterCont , typename InnerCont , typename OutCont >
void Flatten (OuterCont &con, OutCont &ocon)
 Populate OutCont with a flat list of entries from a multicontainer. More...
 
template<typename OuterContType >
primitive::IndexType GetTotalSize (OuterContType &con)
 Return the total number of entries in a multicontainer. More...
 
template<typename OuterContType , typename InnerContType , typename RetCont , typename idxtype >
void MultiContainer2CSR (RetCont &xadj, RetCont &adj, OuterContType &source)
 
template<typename ListContainerType , typename ListType >
void CreateAdjacentNodeList (std::vector< std::list< primitive::IndexType > > &anodelist, ListContainerType &fc, primitive::IndexType nnodes=0)
 Given an array of adjacent node lists (like an array of face connectivities), this function will loop thru and create a list of unique adjacent nodes for each node with the nodes that are actually adjacent in the lists More...
 
template<typename ListContainerType , typename ListType >
void AdjEList (std::vector< std::list< primitive::IndexType > > &aelist, ListContainerType &dual_con, unsigned long nel=0)
 Given an array of adjacent node lists (like an array of face connectivities), this function will loop thru and create a list of unique adjacent nodes for each node Note that this is a little different from the AdjNodeList because in this version every node in each list is considered adjacent. More...
 
template<typename ConType , typename IConType >
primitive::IndexType NumberOfEdges (ConType &con)
 
template<typename ContainerType , typename Icont >
void FormGraph (const ContainerType &adjlist)
 
template<typename BufferDataType >
void ReportBufferStats (std::ostream &outStream, size_t numValues, const BufferDataType *dataBuffer)
 Reports min/max/mean/stddev for data in buffer. More...
 
template<typename Container >
bool HaveSameOrientation (Container &c1, Container &c2)
 Cyclic test. More...
 
template<typename Container >
bool HaveOppositeOrientation (Container &c1, Container &c2)
 Anti-cyclic test. More...
 
template<class T >
CmpPairs< T > CreateCmpPairs (const std::vector< T > &v)
 
template<class T >
void SortPermutation (const std::vector< T > &values, std::vector< unsigned int > &v)
 
std::string GetNextContent (std::istream &In)
 
void GetContentUntil (std::istream &In, std::string ret, const std::string &etag)
 
int NumLines (const std::string &instr)
 
int String2Buf (const std::string &instr, void **buf)
 
void Trim (std::string &instr, bool preserve_newline=false)
 Creates space delimited tokens in place. More...
 
const std::string Trimmed (const std::string &instr, bool preserve_newline=false)
 Returns space delimited tokens. More...
 
const std::string stripdirs (const std::string &pname)
 Strip absolute path. More...
 
void TokenizeString (std::vector< std::string > &tokens, const std::string &source)
 Tokenize string. More...
 
void TokenizeString (std::vector< std::string > &tokens, const std::string &source, const char delim)
 Tokenize string w/ delimiter. More...
 
template<typename NumType >
void ProcessRange (NumType &t1, NumType &t2, const std::string stinter)
 Process a range in the format "t1:t2". More...
 
int OpenFile (std::ifstream &Inf, const std::string &filename)
 File opener. More...
 
void Vectorize (std::vector< std::string > &retVal, const char **in)
 
void Vectorize (std::vector< std::string > &retVal, const char **in, int n)
 
void RenewStream (std::ostringstream &outStream)
 
void RenewStream (std::istringstream &inStream)
 
int CheckResults (int argc, char *argv[])
 Check numerical results utility. More...
 
std::istream & operator>> (std::istream &In, ComLineObject &cl)
 
std::ostream & operator<< (std::ostream &Out, const ComLineObject &cl)
 
int UtilTest (int argc, char *argv[])
 Drives the ix::util namespace's test object. More...
 

Typedef Documentation

◆ Error

typedef int Error

Error type.

Definition at line 27 of file primitive_utilities.H.

◆ ParamType

typedef primitive::KeyValuePairObj<std::string,std::string> ParamType

Definition at line 15 of file Parameters.H.

◆ strsize

typedef std::string::size_type strsize

Definition at line 16 of file Menu.H.

Function Documentation

◆ AdjEList()

void ix::util::AdjEList ( std::vector< std::list< primitive::IndexType > > &  aelist,
ListContainerType &  dual_con,
unsigned long  nel = 0 
)

Given an array of adjacent node lists (like an array of face connectivities), this function will loop thru and create a list of unique adjacent nodes for each node Note that this is a little different from the AdjNodeList because in this version every node in each list is considered adjacent.

Definition at line 250 of file primitive_utilities.H.

◆ CheckResults()

int ix::util::CheckResults ( int  argc,
char *  argv[] 
)

Check numerical results utility.

Parameters
argcinteger indicating how many words are in the command line.
argvstring words of the command line.
Returns
0 if test was successful, 1 if not.

This utility numerically checks the numbers on a line that matches a specified string. The lines in the file are assumed to have the following format:

UniqueString : <numerical entries>="">

This utility will perform the indicated test(s) on the numerical entires associated with the "UniqueString" identifier given as input. The result is a binary YES(1) or NO(0) which is output to stdout as:

TestName = 1||0

If the test passed(=YES), this utility returns a 0, otherwise it returns 1.

Definition at line 8 of file CheckResults.C.

References ComLineObject::GetOption(), CheckResultsComLine::Initialize(), ComLineObject::LongUsage(), ComLineObject::ProcessOptions(), ComLineObject::ProcessRange(), and x.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CopyIntoContainer()

void ix::util::CopyIntoContainer ( ContainerType &  cont,
const T *  src,
size_t  count 
)

Definition at line 121 of file primitive_utilities.H.

◆ CreateAdjacentNodeList()

void ix::util::CreateAdjacentNodeList ( std::vector< std::list< primitive::IndexType > > &  anodelist,
ListContainerType &  fc,
primitive::IndexType  nnodes = 0 
)

Given an array of adjacent node lists (like an array of face connectivities), this function will loop thru and create a list of unique adjacent nodes for each node with the nodes that are actually adjacent in the lists

Definition at line 214 of file primitive_utilities.H.

◆ CreateCmpPairs()

CmpPairs<T> ix::util::CreateCmpPairs ( const std::vector< T > &  v)

Definition at line 400 of file primitive_utilities.H.

Referenced by SortPermutation().

Here is the caller graph for this function:

◆ DumpContents()

void ix::util::DumpContents ( std::ostream &  Ostr,
const ContainerType &  c,
std::string  del = "\n" 
)

Dump container contents.

Dumps the contents of the container to the specified std::ostream object.

Definition at line 82 of file primitive_utilities.H.

Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::DumpErrors(), ProfilerObj::DumpEvents(), GlobalObj< StackType, ErrorType, ProfilerType >::DumpStack(), and ComLineObject::ErrorReport().

Here is the caller graph for this function:

◆ Flatten()

void ix::util::Flatten ( OuterCont &  con,
OutCont &  ocon 
)

Populate OutCont with a flat list of entries from a multicontainer.

Definition at line 164 of file primitive_utilities.H.

◆ FormGraph()

void ix::util::FormGraph ( const ContainerType &  adjlist)

Definition at line 300 of file primitive_utilities.H.

◆ GetContentUntil()

void GetContentUntil ( std::istream &  In,
std::string  ret,
const std::string &  etag 
)
inline

Definition at line 430 of file primitive_utilities.H.

Referenced by operator>>().

Here is the caller graph for this function:

◆ GetNextContent()

std::string GetNextContent ( std::istream &  In)
inline

Definition at line 415 of file primitive_utilities.H.

Referenced by operator>>(), and testmanager::Test__GetNextContent().

Here is the caller graph for this function:

◆ GetTotalSize()

primitive::IndexType ix::util::GetTotalSize ( OuterContType &  con)

Return the total number of entries in a multicontainer.

Definition at line 177 of file primitive_utilities.H.

◆ HaveOppositeOrientation()

bool ix::util::HaveOppositeOrientation ( Container &  c1,
Container &  c2 
)

Anti-cyclic test.

Typically, this is used to determine if two representations of the same face are oriented the same.

Definition at line 372 of file primitive_utilities.H.

◆ HaveSameOrientation()

bool ix::util::HaveSameOrientation ( Container &  c1,
Container &  c2 
)

Cyclic test.

Typically, this is used to determine if two representations of the same face are oriented the same.

Definition at line 344 of file primitive_utilities.H.

◆ IntervalOverlaps()

bool ix::util::IntervalOverlaps ( const DataType &  i1,
const DataType &  i2,
const DataType &  j1,
const DataType &  j2 
)

Definition at line 11 of file IndexUtil.H.

Referenced by sizeextent::Neighboring().

Here is the caller graph for this function:

◆ InvertContainer()

void ix::util::InvertContainer ( const Container &  c1,
Container &  c2 
)

Definition at line 66 of file primitive_utilities.H.

◆ LessThan()

bool ix::util::LessThan ( const Container &  c1,
const Container &  c2 
)

Definition at line 42 of file primitive_utilities.H.

◆ MapElements()

void ix::util::MapElements ( OuterCont &  src,
OutCont &  trg,
MapType &  m 
)

Definition at line 129 of file primitive_utilities.H.

◆ MaxNodeId()

primitive::IndexType ix::util::MaxNodeId ( const ListContainerType &  fc)

Return the maximum of all elements of a multicontainer.

Definition at line 145 of file primitive_utilities.H.

◆ MultiContainer2CSR()

void ix::util::MultiContainer2CSR ( RetCont &  xadj,
RetCont &  adj,
OuterContType &  source 
)

Definition at line 189 of file primitive_utilities.H.

◆ NumberOfEdges()

primitive::IndexType ix::util::NumberOfEdges ( ConType &  con)

Definition at line 279 of file primitive_utilities.H.

◆ NumLines()

int ix::util::NumLines ( const std::string &  instr)
inline

Definition at line 454 of file primitive_utilities.H.

Referenced by testmanager::Test__SystemInfo().

Here is the caller graph for this function:

◆ OpenFile()

int OpenFile ( std::ifstream &  Inf,
const std::string &  filename 
)
inline

File opener.

Definition at line 610 of file primitive_utilities.H.

◆ operator<<() [1/5]

std::ostream & operator<< ( std::ostream &  Ostr,
const util::ParamType param 
)

Definition at line 145 of file Parameters.C.

References KeyValuePairObj< K, V >::Key(), and KeyValuePairObj< K, V >::Value().

Here is the call graph for this function:

◆ operator<<() [2/5]

std::ostream & operator<< ( std::ostream &  Ostr,
const util::ConfigurationObject cob 
)

Stream output operator for util::ConfigurationObject.

Definition at line 124 of file Configuration.C.

References ConfigurationObject::_parameters, and ConfigurationObject::_sections.

◆ operator<<() [3/5]

std::ostream& ix::util::operator<< ( std::ostream &  Out,
const ComLineObject cl 
)

◆ operator<<() [4/5]

std::ostream & operator<< ( std::ostream &  oSt,
const util::Parameters pv 
)

Definition at line 132 of file Parameters.C.

References Parameters::WriteToStream().

Here is the call graph for this function:

◆ operator<<() [5/5]

std::ostream & operator<< ( std::ostream &  outStream,
const ix::util::sizeextent sizeExtent 
)

Definition at line 24 of file IndexUtil.C.

References sizeextent::ND().

Here is the call graph for this function:

◆ operator>>() [1/4]

std::istream& ix::util::operator>> ( std::istream &  In,
ComLineObject cl 
)

◆ operator>>() [2/4]

std::istream & operator>> ( std::istream &  Istr,
util::ConfigurationObject cob 
)

◆ operator>>() [3/4]

std::istream & operator>> ( std::istream &  iSt,
util::Parameters pv 
)

Definition at line 138 of file Parameters.C.

References Parameters::ReadFromStream().

Here is the call graph for this function:

◆ operator>>() [4/4]

std::istream & operator>> ( std::istream &  inStream,
ix::util::sizeextent sizeExtent 
)

Definition at line 35 of file IndexUtil.C.

References a, and sizeextent::Sync().

Here is the call graph for this function:

◆ PackBuffer()

int ix::util::PackBuffer ( const BufferDataType *  sourceBuffer,
const std::vector< size_t > &  sourceIndices,
BufferDataType *  targetBuffer,
const std::vector< size_t > &  targetIndices 
)

Pack subset of target buffer from subset of source buffer.

Copies data from source buffer at source indices specified by sourceIndices into target buffer location specified by targetIndices

Parameters
sourceBufferpointer to source data
sourceIndicesvector of source locations
targetBufferpointer to target buffer
targetIndicesvector of target locations
Returns
0 on success, 1 otherwise

Definition at line 107 of file primitive_utilities.H.

◆ ProcessRange()

void ix::util::ProcessRange ( NumType &  t1,
NumType &  t2,
const std::string  stinter 
)

Process a range in the format "t1:t2".

Definition at line 578 of file primitive_utilities.H.

References x.

◆ RenewStream() [1/2]

void ix::util::RenewStream ( std::ostringstream &  outStream)
inline

Definition at line 638 of file primitive_utilities.H.

Referenced by base::ClearMessages(), application::ConfigureApplication(), application::ConfigureDomains(), application::ConfigureSimulation(), plascom2::util::ConvertLegacyConfiguration(), navierstokes::CreateDictionaryConfiguration(), euler::util::InitializeProtoY4Test1(), pcpp::io::hdf5::LegacyFileInfo(), plascom2::util::PC2Compare(), pcpp::util::ProcessConfigurationFile(), rhs< GridT, StateT, OperatorT >::RHS(), application::RunApplication(), application::RunMaxwellSolver(), application::RunPlasCom2(), pcpp::comm::SetupCartesianTopology(), TestGrid_CartesianMetric(), TestGrid_CurvilinearMetric(), TestGrid_CurvilinearVGWavy(), TestGrid_PBS_IntegratedHalo(), TestGrid_RectilinearMetric(), TestHaloParallel(), TestHaloPeriodic(), TestHDF5GridIO(), TestHDF5HyperSlab(), TestHDF5PBSGridIO(), TestHDF5Read2DBlockStructuredGrid(), TestIntegrated_PFCurvilinear2DX(), TestIntegrated_PFCurvilinear2DY(), TestIntegrated_PFCurvilinear3DZ(), TestIntegrated_PFRectilinear2DX(), TestIntegrated_PFRectilinear2DY(), TestIntegrated_PFRectilinear3DZ(), TestIntegrated_Poiseuille2DX(), TestIntegrated_Poiseuille2DY(), TestIntegrated_Poiseuille3DZ(), TestIntegrated_ViscousShock2DX(), TestIntegrated_ViscousShock2DY(), TestIntegrated_ViscousShock3DZ(), TestIntegrated_VSCurvilinear2DX(), TestIntegrated_VSCurvilinear2DY(), TestIntegrated_VSCurvilinear3DZ(), TestIntegrated_VSRectilinear2DX(), TestIntegrated_VSRectilinear2DY(), TestIntegrated_VSRectilinear3DZ(), TestMaxwellRHSTimeIntegrate(), TestPCPPHDF5Read(), TestPlasCom2Input(), TestPlasCom2Output(), TestProbe(), TestRK4Advancer(), and TestRK4Advancer2().

◆ RenewStream() [2/2]

void ix::util::RenewStream ( std::istringstream &  inStream)
inline

Definition at line 644 of file primitive_utilities.H.

◆ ReportBufferStats()

void ix::util::ReportBufferStats ( std::ostream &  outStream,
size_t  numValues,
const BufferDataType *  dataBuffer 
)

Reports min/max/mean/stddev for data in buffer.

Definition at line 307 of file primitive_utilities.H.

◆ SortPermutation()

void ix::util::SortPermutation ( const std::vector< T > &  values,
std::vector< unsigned int > &  v 
)

Definition at line 404 of file primitive_utilities.H.

References CreateCmpPairs().

Referenced by base< GridT, StateT >::PartitionDomain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ String2Buf()

int String2Buf ( const std::string &  instr,
void **  buf 
)
inline

Definition at line 463 of file primitive_utilities.H.

Referenced by MobileParameters::Pack(), MobileObject::Pack(), and MobileString::Pack().

Here is the caller graph for this function:

◆ stripdirs()

const std::string stripdirs ( const std::string &  pname)
inline

Strip absolute path.

Strips the absolute path to recover the base file name or the executable file name.

Definition at line 526 of file primitive_utilities.H.

References x.

Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::GlobalObj(), ParallelGlobalObj< CommunicatorType, StackType, ErrorType, ProfilerType >::Init(), mpiglobal::mpiglobal(), ParallelGlobalObj< CommunicatorType, StackType, ErrorType, ProfilerType >::ParallelGlobalObj(), and ComLineObject::Record().

Here is the caller graph for this function:

◆ TokenizeString() [1/2]

void TokenizeString ( std::vector< std::string > &  tokens,
const std::string &  source 
)
inline

Tokenize string.

Breaks source string up into a vector of space delimited tokens

Definition at line 541 of file primitive_utilities.H.

Referenced by ConfigurationObject::AdvanceToNextSection(), ConfigurationObject::ExtractSection(), operator>>(), Parameters::ReadFromStream(), and ConfigurationObject::ReadSection().

Here is the caller graph for this function:

◆ TokenizeString() [2/2]

void TokenizeString ( std::vector< std::string > &  tokens,
const std::string &  source,
const char  delim 
)
inline

Tokenize string w/ delimiter.

Breaks source string up into a vector of tokens delimited by specified delimiter

Definition at line 556 of file primitive_utilities.H.

References x.

◆ Trim()

void Trim ( std::string &  instr,
bool  preserve_newline = false 
)
inline

Creates space delimited tokens in place.

Definition at line 478 of file primitive_utilities.H.

Referenced by ix::TestResults().

Here is the caller graph for this function:

◆ Trimmed()

const std::string Trimmed ( const std::string &  instr,
bool  preserve_newline = false 
)
inline

Returns space delimited tokens.

Definition at line 500 of file primitive_utilities.H.

◆ Vectorize() [1/2]

void Vectorize ( std::vector< std::string > &  retVal,
const char **  in 
)
inline

Definition at line 620 of file primitive_utilities.H.

◆ Vectorize() [2/2]

void Vectorize ( std::vector< std::string > &  retVal,
const char **  in,
int  n 
)
inline

Definition at line 628 of file primitive_utilities.H.