$treeview $search $mathjax
Palabos  Version 1.1
$projectbrief
$projectbrief
$searchbox

plb::util Namespace Reference

Classes

class  ValueTracer
 Check time-convergence of a scalar. More...
class  BisectStepper
 Propose successive test values of a scalar (e.g. Re) to check stability of a system. More...
class  Stats
class  Buffer
 A simple class for handling buffer memory. More...
class  UniqueId

Functions

template<typename T >
sqr (T arg)
 Compute square of a scalar value.
plint kronDelta (plint iA, plint iB)
 Kronecker delta.
bool boolIsEqual (bool val1, bool val2)
 Test equality between two boolean values.
template<typename T >
plint roundToInt (T value)
 Round to next plint value.
plint roundUp (plint value, plint step)
 Round a signed integer to the next larger value which is divisible by step.
plint roundDown (plint value, plint step)
 Round a signed integer to the next smaller value which is divisible by step.
double twoToThePower (int power)
template<typename T >
std::string val2str (T val)
template<typename T1 , typename T2 >
std::string val2str (T1 val1, T2 val2)
template<typename T1 , typename T2 , typename T3 >
std::string val2str (T1 val1, T2 val2, T3 val3)
template<typename T >
void str2val (std::string str, T &val)
std::vector< std::string > split (std::string str)
template<typename T >
std::string consume (std::string str, T &val)
template<typename T1 , typename T2 >
std::string consume (std::string str, T1 &val1, T2 &val2)
template<typename T1 , typename T2 , typename T3 >
std::string consume (std::string str, T1 &val1, T2 &val2, T3 &val3)
std::string tolower (std::string arg)
std::string toupper (std::string arg)
void linearRepartition (plint x0, plint x1, plint nBlocks, std::vector< std::pair< plint, plint > > &ranges)
void extendVectorSize (std::vector< int > &vect, pluint fullSize)
 Extend the size of an int-vector, and initialize new values to -1.
template<typename T >
bool fpequal (T x, T y, T eps)
template<typename T >
bool fpequal_abs (T x, T y, T eps)

Function Documentation

bool plb::util::boolIsEqual ( bool  val1,
bool  val2 
) [inline]

Test equality between two boolean values.

As we were testing with GCC 4.3.3, we observed that the equality operator (==) has an unexpected behavior. It compares the bools as if they were ints, and sometimes returns false, even if both bools are true. We don't know if this is a weird definition of the C++ language or a compiler bug, but in both cases, the present function offers a workaround.

Referenced by plb::DynamicsFromMaskFunctional3D< T, Descriptor >::process(), and plb::DynamicsFromMaskFunctional2D< T, Descriptor >::process().

template<typename T1 , typename T2 , typename T3 >
std::string plb::util::consume ( std::string  str,
T1 &  val1,
T2 &  val2,
T3 &  val3 
) [inline]
template<typename T1 , typename T2 >
std::string plb::util::consume ( std::string  str,
T1 &  val1,
T2 &  val2 
) [inline]
void plb::util::extendVectorSize ( std::vector< int > &  vect,
pluint  fullSize 
) [inline]
template<typename T >
bool plb::util::fpequal_abs ( x,
y,
eps 
) [inline]

Test equality of two floating point numbers, with absolute accuracy, independent of the value of the arguments. This is useful in relation with calculations in which all important quantities are of the order 1.

Referenced by plb::TriangularSurfaceMesh< T >::distanceToEdgeLine(), plb::TriangularSurfaceMesh< T >::distanceToTrianglePlane(), and plb::TriangularSurfaceMesh< T >::pointOnTriangle().

plint plb::util::kronDelta ( plint  iA,
plint  iB 
) [inline]

Kronecker delta.

void plb::util::linearRepartition ( plint  x0,
plint  x1,
plint  nBlocks,
std::vector< std::pair< plint, plint > > &  ranges 
) [inline]
plint plb::util::roundDown ( plint  value,
plint  step 
) [inline]
plint plb::util::roundUp ( plint  value,
plint  step 
) [inline]

Round a signed integer to the next larger value which is divisible by step.

Referenced by plb::Box3D::divideAndFitLarger(), plb::Box2D::divideAndFitLarger(), plb::Box3D::divideAndFitSmaller(), and plb::Box2D::divideAndFitSmaller().

std::vector<std::string> plb::util::split ( std::string  str  )  [inline]

Referenced by consume().

template<typename T >
T plb::util::sqr ( arg  )  [inline]

Compute square of a scalar value.

Referenced by plb::asinariTemplatesImpl< T, descriptors::D3Q15DescriptorBase< T > >::bgk_collision_stage1(), plb::asinariTemplatesImpl< T, descriptors::D3Q19DescriptorBase< T > >::bgk_collision_stage1(), plb::asinariTemplatesImpl< T, descriptors::D3Q27DescriptorBase< T > >::bgk_collision_stage1(), plb::asinariTemplatesImpl< T, descriptors::D2Q9DescriptorBase< T > >::bgk_collision_stage1(), plb::asinariTemplatesImpl< T, Descriptor >::bgk_collision_stage1(), plb::IncGuoExternalForceSmagorinskyBGKdynamics< T, Descriptor >::collide(), plb::GuoExternalForceSmagorinskyBGKdynamics< T, Descriptor >::collide(), plb::ShanChenExternalForceBGKdynamics< T, Descriptor >::collide(), plb::SmagoOperations< T, Descriptor >::computePrefactor(), plb::AD_SmagoOperations< T, Descriptor >::computePrefactor(), plb::externalForceTemplatesImpl< T, descriptors::ForcedD3Q19Descriptor< T > >::heForcedBGKCollision(), plb::externalForceTemplatesImpl< T, descriptors::ForcedD2Q9Descriptor< T > >::heForcedBGKCollision(), plb::externalForceTemplatesImpl< T, Descriptor >::heForcedBGKCollision(), plb::BoxPeriodicGradientNormFunctional3D< T >::process(), plb::ComputeSymmetricTensorNormSqrFunctional3D< T >::process(), plb::ComputeSymmetricTensorNormFunctional3D< T >::process(), plb::ComputeSymmetricTensorNormSqrFunctional2D< T >::process(), plb::ComputeSymmetricTensorNormFunctional2D< T >::process(), plb::BoxGradientNormFunctional3D< T >::processBulk(), plb::BoxGradientNormFunctional2D< T >::processBulk(), plb::BoxGradientNormFunctional3D< T >::processCorner(), plb::BoxGradientNormFunctional2D< T >::processCorner(), plb::BoxGradientNormFunctional3D< T >::processEdge(), plb::BoxGradientNormFunctional2D< T >::processEdge(), plb::BoxGradientNormFunctional3D< T >::processPlane(), plb::TriangularSurfaceMesh< T >::segmentIntersectsTriangle(), and plb::util::Stats::Stats().

template<typename T >
void plb::util::str2val ( std::string  str,
T &  val 
) [inline]

References plb::plbLogicError().

Referenced by consume().

std::string plb::util::tolower ( std::string  arg  )  [inline]
std::string plb::util::toupper ( std::string  arg  )  [inline]
template<typename T1 , typename T2 , typename T3 >
std::string plb::util::val2str ( T1  val1,
T2  val2,
T3  val3 
) [inline]
template<typename T1 , typename T2 >
std::string plb::util::val2str ( T1  val1,
T2  val2 
) [inline]