VAPOR3 3.9.4
Namespaces | Classes | Functions | Variables
Wasp Namespace Reference

Namespaces

namespace  FileUtils
 
namespace  TMSUtils
 

Classes

class  EasyThreads
 
class  MyBase
 Wasp base class. More...
 
class  MyPython
 
class  OptionParser
 
class  SmartBuf
 
class  Version
 

Functions

COMMON_API void Splitpath (std::string path, std::string &volume, std::string &dir, std::string &file, bool nofile)
 
COMMON_API double GetTime ()
 
COMMON_API int MkDirHier (const std::string &dir)
 
COMMON_API std::string GetEnvironmentalVariable (const std::string &name)
 
COMMON_API std::string GetAppPath (const string &app, const string &name, const vector< string > &paths, bool forwardSeparator=true)
 
COMMON_API int IsOdd (int x)
 
COMMON_API int IsPowerOfTwo (unsigned int x)
 Return true if power of two.
 
COMMON_API int Min (int a, int b)
 
COMMON_API int Max (int a, int b)
 
COMMON_API size_t Min (size_t a, size_t b)
 
COMMON_API size_t Max (size_t a, size_t b)
 
COMMON_API float Min (float a, float b)
 
COMMON_API float Max (float a, float b)
 
COMMON_API double Min (double a, double b)
 
COMMON_API double Max (double a, double b)
 
COMMON_API double LogBaseN (double x, double n)
 
COMMON_API int ILog2 (int n)
 
COMMON_API int StrCmpNoCase (const string &s, const string &t)
 Case-insensitive string comparison.
 
COMMON_API void StrRmWhiteSpace (string &s)
 Remove white space from a string.
 
COMMON_API void StrToWordVec (const string &s, vector< string > &v)
 Parse a string, returning a vector of words.
 
COMMON_API std::vector< std::string > & SplitString (const std::string &s, char delim, std::vector< std::string > &elems)
 
COMMON_API std::vector< size_t > & SplitString (const std::string &s, char delim, std::vector< size_t > &elems)
 
COMMON_API std::vector< int > & SplitString (const std::string &s, char delim, std::vector< int > &elems)
 
COMMON_API std::vector< float > & SplitString (const std::string &s, char delim, std::vector< float > &elems)
 
COMMON_API std::vector< double > & SplitString (const std::string &s, char delim, std::vector< double > &elems)
 
COMMON_API unsigned long long GetBits64 (unsigned long long targ, int pos, int n)
 
COMMON_API unsigned long long SetBits64 (unsigned long long targ, int pos, int n, unsigned long long src)
 
COMMON_API double ran1 (long *)
 
COMMON_API int CvtToInt (const char *from, void *to)
 
COMMON_API int CvtToFloat (const char *from, void *to)
 
COMMON_API int CvtToDouble (const char *from, void *to)
 
COMMON_API int CvtToChar (const char *from, void *to)
 
COMMON_API int CvtToBoolean (const char *from, void *to)
 
COMMON_API int CvtToString (const char *from, void *to)
 
COMMON_API int CvtToCPPStr (const char *from, void *to)
 
COMMON_API int CvtToDimension2D (const char *from, void *to)
 
COMMON_API int CvtToDimension3D (const char *from, void *to)
 
COMMON_API int CvtToStrVec (const char *from, void *to)
 
COMMON_API int CvtToIntVec (const char *from, void *to)
 
COMMON_API int CvtToSize_tVec (const char *from, void *to)
 
COMMON_API int CvtToFloatVec (const char *from, void *to)
 
COMMON_API int CvtToDoubleVec (const char *from, void *to)
 
COMMON_API int CvtToIntRange (const char *from, void *to)
 
COMMON_API TIME64_T MkTime64 (struct tm *t)
 
COMMON_API struct tm * LocalTime64_r (const TIME64_T *t, struct tm *p)
 
COMMON_API struct tm * GmTime64_r (const TIME64_T *t, struct tm *p)
 
COMMON_API std::string GetResourcePath (const std::string &name)
 
COMMON_API std::string GetSharePath (const std::string &name)
 
COMMON_API std::string GetPythonPath ()
 
COMMON_API std::string GetPythonVersion ()
 
COMMON_API std::string GetPythonDir ()
 
COMMON_API void RegisterResourceFinder (std::string(*cb)(const std::string &))
 
COMMON_API size_t LinearizeCoords (const size_t *coords, const size_t *dims, size_t n)
 
COMMON_API size_t LinearizeCoords (const std::vector< size_t > &coords, const std::vector< size_t > &dims)
 
COMMON_API size_t LinearizeCoords (const size_t *coords, const size_t *min, const size_t *max, size_t n)
 
COMMON_API size_t LinearizeCoords (const std::vector< size_t > &coords, const std::vector< size_t > &min, const std::vector< size_t > &max)
 
COMMON_API void IncrementCoords (const size_t *min, const size_t *max, size_t *counter, size_t n, int dim)
 
COMMON_API std::vector< size_t > IncrementCoords (const std::vector< size_t > &min, const std::vector< size_t > &max, std::vector< size_t > counter, int dim=0)
 
COMMON_API std::vector< size_t > Dims (const std::vector< size_t > &min, const std::vector< size_t > &max)
 
COMMON_API size_t VProduct (const size_t *a, size_t n)
 
COMMON_API size_t VProduct (const std::vector< size_t > &a)
 
COMMON_API void VectorizeCoords (size_t offset, const size_t *min, const size_t *max, size_t *coords, size_t n)
 
COMMON_API std::vector< size_t > VectorizeCoords (size_t offset, const std::vector< size_t > &min, const std::vector< size_t > &max)
 
COMMON_API void VectorizeCoords (size_t offset, const size_t *dims, size_t *coords, size_t n)
 
COMMON_API std::vector< size_t > VectorizeCoords (size_t offset, const std::vector< size_t > &dims)
 
COMMON_API void Transpose (const float *a, float *b, size_t p1, size_t m1, size_t s1, size_t p2, size_t m2, size_t s2)
 
COMMON_API void Transpose (const float *a, float *b, size_t s1, size_t s2)
 
COMMON_API bool BinarySearchRange (const std::vector< double > &sorted, double x, size_t &i)
 
COMMON_API bool NearlyEqual (float a, float b, float epsilon=std::numeric_limits< float >::epsilon(), float abs_th=std::numeric_limits< float >::epsilon())
 
COMMON_API void _VAssertFailed (const char *expr, const char *path, const unsigned int line)
 

Variables

const float ABOVE_GRID = 0.f
 
const float BELOW_GRID = 0.f
 

Function Documentation

◆ _VAssertFailed()

COMMON_API void Wasp::_VAssertFailed ( const char *  expr,
const char *  path,
const unsigned int  line 
)

◆ BinarySearchRange()

COMMON_API bool Wasp::BinarySearchRange ( const std::vector< double > &  sorted,
double  x,
size_t &  i 
)

◆ CvtToBoolean()

COMMON_API int Wasp::CvtToBoolean ( const char *  from,
void *  to 
)

◆ CvtToChar()

COMMON_API int Wasp::CvtToChar ( const char *  from,
void *  to 
)

◆ CvtToCPPStr()

COMMON_API int Wasp::CvtToCPPStr ( const char *  from,
void *  to 
)

◆ CvtToDimension2D()

COMMON_API int Wasp::CvtToDimension2D ( const char *  from,
void *  to 
)

◆ CvtToDimension3D()

COMMON_API int Wasp::CvtToDimension3D ( const char *  from,
void *  to 
)

◆ CvtToDouble()

COMMON_API int Wasp::CvtToDouble ( const char *  from,
void *  to 
)

◆ CvtToDoubleVec()

COMMON_API int Wasp::CvtToDoubleVec ( const char *  from,
void *  to 
)

◆ CvtToFloat()

COMMON_API int Wasp::CvtToFloat ( const char *  from,
void *  to 
)

◆ CvtToFloatVec()

COMMON_API int Wasp::CvtToFloatVec ( const char *  from,
void *  to 
)

◆ CvtToInt()

COMMON_API int Wasp::CvtToInt ( const char *  from,
void *  to 
)

◆ CvtToIntRange()

COMMON_API int Wasp::CvtToIntRange ( const char *  from,
void *  to 
)

◆ CvtToIntVec()

COMMON_API int Wasp::CvtToIntVec ( const char *  from,
void *  to 
)

◆ CvtToSize_tVec()

COMMON_API int Wasp::CvtToSize_tVec ( const char *  from,
void *  to 
)

◆ CvtToString()

COMMON_API int Wasp::CvtToString ( const char *  from,
void *  to 
)

◆ CvtToStrVec()

COMMON_API int Wasp::CvtToStrVec ( const char *  from,
void *  to 
)

◆ Dims()

COMMON_API std::vector< size_t > Wasp::Dims ( const std::vector< size_t > &  min,
const std::vector< size_t > &  max 
)

Return the dimesions of a subregion

return the dimensions of a subregion enclosed by min and max

◆ GetAppPath()

COMMON_API std::string Wasp::GetAppPath ( const string &  app,
const string &  name,
const vector< string > &  paths,
bool  forwardSeparator = true 
)

◆ GetBits64()

COMMON_API unsigned long long Wasp::GetBits64 ( unsigned long long  targ,
int  pos,
int  n 
)

Retrieve a sequence of bits

Extract n bits from targ starting at position pos counting from the left. E.g. GetBits64(I,4,3) will extract bits at bit position 4,3,2, right adjusted

Return values
returnsthe extracted bits
See also
GetBits64()

◆ GetEnvironmentalVariable()

COMMON_API std::string Wasp::GetEnvironmentalVariable ( const std::string &  name)

◆ GetPythonDir()

COMMON_API std::string Wasp::GetPythonDir ( )

Returns python home e.g. if python if installed in /home/lib/python2.7 this will return /home on Linux/Mac but it will return /home/lib/python2.7 on Windows

◆ GetPythonPath()

COMMON_API std::string Wasp::GetPythonPath ( )

Returns full python installation path e.g. /home/lib/python2.7

◆ GetPythonVersion()

COMMON_API std::string Wasp::GetPythonVersion ( )

Returns python version e.g. 3.6

◆ GetResourcePath()

COMMON_API std::string Wasp::GetResourcePath ( const std::string &  name)

◆ GetSharePath()

COMMON_API std::string Wasp::GetSharePath ( const std::string &  name)

◆ GetTime()

COMMON_API double Wasp::GetTime ( )

◆ GmTime64_r()

COMMON_API struct tm * Wasp::GmTime64_r ( const TIME64_T t,
struct tm *  p 
)

◆ ILog2()

COMMON_API int Wasp::ILog2 ( int  n)

◆ IncrementCoords() [1/2]

COMMON_API void Wasp::IncrementCoords ( const size_t *  min,
const size_t *  max,
size_t *  counter,
size_t  n,
int  dim 
)

Increment a coordinate vector by one

Increments counter along the dimension dim by one within the range of min to max. Overflow is possible, resulting in wraparound and setting counter back to min

◆ IncrementCoords() [2/2]

COMMON_API std::vector< size_t > Wasp::IncrementCoords ( const std::vector< size_t > &  min,
const std::vector< size_t > &  max,
std::vector< size_t >  counter,
int  dim = 0 
)

◆ IsOdd()

COMMON_API int Wasp::IsOdd ( int  x)
inline

Definition at line 268 of file MyBase.h.

◆ IsPowerOfTwo()

COMMON_API int Wasp::IsPowerOfTwo ( unsigned int  x)

Return true if power of two.

Returns a non-zero value if the input parameter is a power of two

Parameters
[in]xAn integer
Return values
status

◆ LinearizeCoords() [1/4]

COMMON_API size_t Wasp::LinearizeCoords ( const size_t *  coords,
const size_t *  dims,
size_t  n 
)

Linearize multi-dimensional coordinates

Convert multi-dimensional coordinates, coords, for a space with dimensions, dims, to a linear offset from the origin of dims

Parameters
[in]coordsA vector of integer coordinates into a an array with dimensions given by dims. The minimum coordinate value is zero. The maximum coordinate value is dims[i] - 1.
[in]dimsA vector defining the dimensions of an array. The size of dims must equal size of coords.
Return values
offsetThe offset from the first element of the array to the address specified by coords

◆ LinearizeCoords() [2/4]

COMMON_API size_t Wasp::LinearizeCoords ( const size_t *  coords,
const size_t *  min,
const size_t *  max,
size_t  n 
)

Linearize multi-dimensional coordinates

Convert multi-dimensional coordinates, coords, for a space with minimum and maximum coordinates given by min, and max, respectively.

Parameters
[in]coordsA vector of integer coordinates into a an array with boundaries defined by min and max. The minimum coordinate value is min[i] and the maximum is max[i].
[in]minMinimum valid coordinate value
[in]minMaximum valid coordinate value
Return values
offsetThe offset from the first element of the array to the address specified by coords

◆ LinearizeCoords() [3/4]

COMMON_API size_t Wasp::LinearizeCoords ( const std::vector< size_t > &  coords,
const std::vector< size_t > &  dims 
)

◆ LinearizeCoords() [4/4]

COMMON_API size_t Wasp::LinearizeCoords ( const std::vector< size_t > &  coords,
const std::vector< size_t > &  min,
const std::vector< size_t > &  max 
)

◆ LocalTime64_r()

COMMON_API struct tm * Wasp::LocalTime64_r ( const TIME64_T t,
struct tm *  p 
)

◆ LogBaseN()

COMMON_API double Wasp::LogBaseN ( double  x,
double  n 
)
inline

Definition at line 289 of file MyBase.h.

◆ Max() [1/4]

COMMON_API double Wasp::Max ( double  a,
double  b 
)
inline

Definition at line 287 of file MyBase.h.

◆ Max() [2/4]

COMMON_API float Wasp::Max ( float  a,
float  b 
)
inline

Definition at line 284 of file MyBase.h.

◆ Max() [3/4]

COMMON_API int Wasp::Max ( int  a,
int  b 
)
inline

Definition at line 278 of file MyBase.h.

◆ Max() [4/4]

COMMON_API size_t Wasp::Max ( size_t  a,
size_t  b 
)
inline

Definition at line 281 of file MyBase.h.

◆ Min() [1/4]

COMMON_API double Wasp::Min ( double  a,
double  b 
)
inline

Definition at line 286 of file MyBase.h.

◆ Min() [2/4]

COMMON_API float Wasp::Min ( float  a,
float  b 
)
inline

Definition at line 283 of file MyBase.h.

◆ Min() [3/4]

COMMON_API int Wasp::Min ( int  a,
int  b 
)
inline

Definition at line 277 of file MyBase.h.

◆ Min() [4/4]

COMMON_API size_t Wasp::Min ( size_t  a,
size_t  b 
)
inline

Definition at line 280 of file MyBase.h.

◆ MkDirHier()

COMMON_API int Wasp::MkDirHier ( const std::string &  dir)

◆ MkTime64()

COMMON_API TIME64_T Wasp::MkTime64 ( struct tm *  t)

◆ NearlyEqual()

COMMON_API bool Wasp::NearlyEqual ( float  a,
float  b,
float  epsilon = std::numeric_limits< float >::epsilon(),
float  abs_th = std::numeric_limits< float >::epsilon() 
)

Floating point comparison for near equality.

Perform a floating point comparison to see if two values are nearly equal;

For values close to zero the comparison is made directly againt abs_th.

For values not close to zero the comparison is made against epsilon multiplied by the magnitude of a + b.

See https://stackoverflow.com/questions/4915462/how-should-i-do-floating-point-comparison

◆ ran1()

COMMON_API double Wasp::ran1 ( long *  )

◆ RegisterResourceFinder()

COMMON_API void Wasp::RegisterResourceFinder ( std::string(*)(const std::string &)  cb)

Register an additional function which returns a path for a given resource. This function will be given precidence over the default resource search paths.

◆ SetBits64()

COMMON_API unsigned long long Wasp::SetBits64 ( unsigned long long  targ,
int  pos,
int  n,
unsigned long long  src 
)

Set a sequence of bits

Set n bits in targ starting at position pos counting from the left. The bits are obtained from src

Return values
returns\targ with the indicated bits set
See also
GetBits64()

◆ Splitpath()

COMMON_API void Wasp::Splitpath ( std::string  path,
std::string &  volume,
std::string &  dir,
std::string &  file,
bool  nofile 
)

◆ SplitString() [1/5]

COMMON_API std::vector< double > & Wasp::SplitString ( const std::string &  s,
char  delim,
std::vector< double > &  elems 
)

◆ SplitString() [2/5]

COMMON_API std::vector< float > & Wasp::SplitString ( const std::string &  s,
char  delim,
std::vector< float > &  elems 
)

◆ SplitString() [3/5]

COMMON_API std::vector< int > & Wasp::SplitString ( const std::string &  s,
char  delim,
std::vector< int > &  elems 
)

◆ SplitString() [4/5]

COMMON_API std::vector< size_t > & Wasp::SplitString ( const std::string &  s,
char  delim,
std::vector< size_t > &  elems 
)

◆ SplitString() [5/5]

COMMON_API std::vector< std::string > & Wasp::SplitString ( const std::string &  s,
char  delim,
std::vector< std::string > &  elems 
)

◆ StrCmpNoCase()

COMMON_API int Wasp::StrCmpNoCase ( const string &  s,
const string &  t 
)

Case-insensitive string comparison.

Performs a case-insensitive comparison of two C++ strings. Behaviour is otherwise identical to the C++ std::string.compare() method.

◆ StrRmWhiteSpace()

COMMON_API void Wasp::StrRmWhiteSpace ( string &  s)

Remove white space from a string.

Performs in-place removal of all white space from a string.

Parameters
[in,out]sThe string.

◆ StrToWordVec()

COMMON_API void Wasp::StrToWordVec ( const string &  s,
vector< string > &  v 
)

Parse a string, returning a vector of words.

Parses a string containing a white-space delimited collection of words. The words are in order of occurence and returned as a vector of strings with all white space removed.

Parameters
[in]sThe input string.
[out]vThe output vector.

◆ Transpose() [1/2]

COMMON_API void Wasp::Transpose ( const float *  a,
float *  b,
size_t  p1,
size_t  m1,
size_t  s1,
size_t  p2,
size_t  m2,
size_t  s2 
)

◆ Transpose() [2/2]

COMMON_API void Wasp::Transpose ( const float *  a,
float *  b,
size_t  s1,
size_t  s2 
)

◆ VectorizeCoords() [1/4]

COMMON_API void Wasp::VectorizeCoords ( size_t  offset,
const size_t *  dims,
size_t *  coords,
size_t  n 
)

Vectorize a coordinate offset. Inverse of VectorizeLinearize

◆ VectorizeCoords() [2/4]

COMMON_API void Wasp::VectorizeCoords ( size_t  offset,
const size_t *  min,
const size_t *  max,
size_t *  coords,
size_t  n 
)

Vectorize a coordinate offset. Inverse of VectorizeLinearize

◆ VectorizeCoords() [3/4]

COMMON_API std::vector< size_t > Wasp::VectorizeCoords ( size_t  offset,
const std::vector< size_t > &  dims 
)

◆ VectorizeCoords() [4/4]

COMMON_API std::vector< size_t > Wasp::VectorizeCoords ( size_t  offset,
const std::vector< size_t > &  min,
const std::vector< size_t > &  max 
)

◆ VProduct() [1/2]

COMMON_API size_t Wasp::VProduct ( const size_t *  a,
size_t  n 
)

Return the scalar product of the elements of a vector

◆ VProduct() [2/2]

COMMON_API size_t Wasp::VProduct ( const std::vector< size_t > &  a)

Variable Documentation

◆ ABOVE_GRID

const float Wasp::ABOVE_GRID = 0.f

A collection of general purpose utilities - things that probably should be in the STL but aren't.

Definition at line 59 of file MyBase.h.

◆ BELOW_GRID

const float Wasp::BELOW_GRID = 0.f

Definition at line 60 of file MyBase.h.