AQUAgpusph 4.1.2
Loading...
Searching...
No Matches
Namespaces | Data Structures | Enumerations | Functions | Variables
Aqua Namespace Reference

Main AQUAgpusph namespace. More...

Namespaces

namespace  CalcServer
 Calculation server name space.
 
namespace  InputOutput
 Input/Output data interfaces.
 

Data Structures

class  Singleton
 Simple but versatile singleton instance (Meyers singleton). More...
 
class  Tokenizer
 Tool to evaluate math expressions. More...
 

Enumerations

enum  TLogLevel { L_DEBUG , L_INFO , L_WARNING , L_ERROR }
 

Functions

int isKeyPressed ()
 Returns if a key press event has been registered.
 
bool hasPrefix (const std::string &str, const std::string &prefix)
 Check if a string starts with an specific prefix.
 
bool hasSuffix (const std::string &str, const std::string &suffix)
 Check if a string ends with an specific suffix.
 
void replaceAll (std::string &str, const std::string &search, const std::string &replace)
 Replace all substring occurrences by another substring.
 
std::string replaceAllCopy (std::string str, std::string search, std::string replace)
 Replace all substring occurrences by another substring.
 
void ltrim (std::string &s)
 Remove all the blank spaces (including line breaks, tabulators...) string prefix.
 
void rtrim (std::string &s)
 Remove all the blank spaces (including line breaks, tabulators...) string suffix.
 
void trim (std::string &s)
 Remove all the blank spaces (including line breaks, tabulators...) string prefix and suffix.
 
std::string ltrimCopy (std::string s)
 Remove all the blank spaces (including line breaks, tabulators...) string suffix.
 
std::string rtrimCopy (std::string s)
 Remove all the blank spaces (including line breaks, tabulators...) string suffix.
 
std::string trimCopy (std::string s)
 Remove all the blank spaces (including line breaks, tabulators...) string prefix and suffix.
 
std::string xxd2string (unsigned char *arr, unsigned int len)
 Transform a xxd exported file into a C++ string.
 
void toLower (std::string &str)
 Convert a string to lower case.
 
std::string toLowerCopy (std::string str)
 Convert a string to lower case.
 
void setStrConstants (std::string &str)
 Set several constants into a string.
 
std::string setStrConstantsCopy (std::string str)
 Set several constants into a string.
 
std::vector< std::string > split (std::string str, char chr)
 Split a string by a character.
 
std::vector< std::string > split_formulae (std::string str)
 Split a list of split_formulae.
 
std::string newFilePath (const std::string &basename, unsigned int &i, unsigned int digits=5)
 Look for a file path which is not already taken.
 
unsigned int nextPowerOf2 (unsigned int x)
 Next number which is power of 2.
 
unsigned int isPowerOf2 (unsigned int x)
 Check if a number is power of 2.
 
unsigned int roundUp (unsigned int x, unsigned int divisor)
 Rounded up value which is divisible by <strong class=.
 
int round (float n)
 Round an float value to an integer one.
 
const std::string getFolderFromFilePath (const std::string file_path)
 Gets the folder path which contains the file <strong class=.
 
const std::string getFileNameFromFilePath (const std::string file_path)
 Gets the file name of the path <strong class=.
 
const std::string getExtensionFromFilePath (const std::string file_path)
 Gets the file extension.
 
bool isFile (const std::string file_name)
 Check if the file <strong class= exist on the system.
 
bool isRelativePath (const std::string path)
 Check if the path <strong class= is a relative or an absolute one.
 
size_t getLocalWorkSize (cl_uint n, cl_command_queue queue)
 Compute the maximum local work size allowed by a device.
 
size_t getGlobalWorkSize (cl_uint n, size_t local_work_size)
 Compute the global work size needed to compute <strong class= threads.
 
vec Vzero ()
 Return a null vector.
 
vec Vx ()
 Return the x direction unit vector.
 
vec Vy ()
 Return the y direction unit vector.
 
vec Vz ()
 Return the z direction unit vector.
 
vec mult (float n, vec v)
 Multiply a vector by a scalar.
 
vec add (vec a, vec b)
 Adding operation.
 
vec sub (vec a, vec b)
 Subtracting operation.
 
float dot (vec a, vec b)
 Inner product.
 
float length (vec v)
 Compute the vector length.
 
vec normalize (vec v)
 Compute a normalized vector copy (such that length() will return 1.0.
 
vec cross (vec a, vec b)
 Cross product.
 
unsigned int numberOfDigits (unsigned int number)
 Get the number of digits of an integer decimal text representation.
 
double mod_operator (double v, double w)
 
double not_operator (double v)
 
template<typename T >
min (T a, T b)
 Gets the minimum of two values.
 
template<typename T >
max (T a, T b)
 Gets the maximum of two values.
 
float clamp (float x, float a, float b)
 Clamps a value between the bounds.
 

Variables

static std::string folder
 
static std::string filename
 
static std::string extension
 

Detailed Description

Main AQUAgpusph namespace.

Enumeration Type Documentation

◆ TLogLevel

Enumerator
L_DEBUG 
L_INFO 
L_WARNING 
L_ERROR 

Function Documentation

◆ add()

vec Aqua::add ( vec  a,
vec  b 
)

Adding operation.

Parameters
aVector to operate.
bVector to operate.
Returns
<strong class= + <strong class=.

◆ clamp()

float Aqua::clamp ( float  x,
float  a,
float  b 
)
inline

Clamps a value between the bounds.

Parameters
xValue to adjust into the bounds.
aMinimum value.
bMaximum value.
Returns
Clamped value.

◆ cross()

vec Aqua::cross ( vec  a,
vec  b 
)

Cross product.

Remarks
Only available in the 3D version.
Parameters
aVector to operate.
bVector to operate.
Returns
<strong class= \( \times \) <strong class= crossed product vector.

◆ dot()

float Aqua::dot ( vec  a,
vec  b 
)

Inner product.

Parameters
aVector to operate.
bVector to operate.
Returns
<strong class= \( \cdot \) <strong class= scalar product value.

◆ getExtensionFromFilePath()

const std::string Aqua::getExtensionFromFilePath ( const std::string  file_path)

Gets the file extension.

Get the file extension from the full file path <strong class=.

Parameters
file_pathThe file path.
Returns
Extension of the file.

◆ getFileNameFromFilePath()

const std::string Aqua::getFileNameFromFilePath ( const std::string  file_path)

Gets the file name of the path <strong class=.

Parameters
file_pathThe file path.
Returns
The file name.

◆ getFolderFromFilePath()

const std::string Aqua::getFolderFromFilePath ( const std::string  file_path)

Gets the folder path which contains the file <strong class=.

Parameters
file_pathThe file path.
Returns
The folder.

◆ getGlobalWorkSize()

size_t Aqua::getGlobalWorkSize ( cl_uint  n,
size_t  local_work_size 
)

Compute the global work size needed to compute <strong class= threads.

Parameters
nAmount of data to operate in kernel (aiming threads to launch).
local_work_sizeThe local work size which will be applied.
Returns
The required global work size.
See also
roundUp()
Here is the call graph for this function:

◆ getLocalWorkSize()

size_t Aqua::getLocalWorkSize ( cl_uint  n,
cl_command_queue  queue 
)

Compute the maximum local work size allowed by a device.

Parameters
nAmount of data to operate in kernel (aiming threads to launch).
queueCommand queue.
Returns
The local work size, 0 if it is not possible to find a valid value.

◆ hasPrefix()

bool Aqua::hasPrefix ( const std::string &  str,
const std::string &  prefix 
)

Check if a string starts with an specific prefix.

Parameters
strString to be checked
prefixPrefix to be looked for
Returns
true if #str starts with #prefix, false otherwise.

◆ hasSuffix()

bool Aqua::hasSuffix ( const std::string &  str,
const std::string &  suffix 
)

Check if a string ends with an specific suffix.

Parameters
strString to be checked
suffixSuffix to be looked for
Returns
true if #str ends with #suffix, false otherwise.

◆ isFile()

bool Aqua::isFile ( const std::string  file_name)

Check if the file <strong class= exist on the system.

Parameters
file_nameThe file path.
Returns
false if the file can not be found in the system, true otherwise.

◆ isKeyPressed()

int Aqua::isKeyPressed ( )

Returns if a key press event has been registered.

Returns
0 if no keys have been pressed, 1 otherwise.

◆ isPowerOf2()

unsigned int Aqua::isPowerOf2 ( unsigned int  x)

Check if a number is power of 2.

Compute if a value is power of 2.

Parameters
xValue to test.
Returns
1 if it is a power of two, 0 otherwise.

◆ isRelativePath()

bool Aqua::isRelativePath ( const std::string  path)

Check if the path <strong class= is a relative or an absolute one.

Parameters
pathThe path.
Returns
true if it is a relative path, false otherwise.
Here is the call graph for this function:

◆ length()

float Aqua::length ( vec  v)

Compute the vector length.

Parameters
vInput vector.
Returns
\( \vert \) <strong class= \( \vert \) vector length.

◆ ltrim()

void Aqua::ltrim ( std::string &  s)

Remove all the blank spaces (including line breaks, tabulators...) string prefix.

Parameters
sString to become trimmed

◆ ltrimCopy()

std::string Aqua::ltrimCopy ( std::string  s)

Remove all the blank spaces (including line breaks, tabulators...) string suffix.

Parameters
sString to become trimmed
Returns
Trimmed string
Here is the call graph for this function:

◆ max()

template<typename T >
T Aqua::max ( a,
b 
)
inline

Gets the maximum of two values.

Parameters
aFirst value.
bSecond value.
Returns
Maximum value.

◆ min()

template<typename T >
T Aqua::min ( a,
b 
)
inline

Gets the minimum of two values.

Parameters
aFirst value.
bSecond value.
Returns
Minimum value.

◆ mod_operator()

double Aqua::mod_operator ( double  v,
double  w 
)

◆ mult()

vec Aqua::mult ( float  n,
vec  v 
)

Multiply a vector by a scalar.

Parameters
nScalar to operate.
vVector to operate.
Returns
<strong class= \( \cdot \) <strong class= Resulting vector.

◆ newFilePath()

std::string Aqua::newFilePath ( const std::string &  basename,
unsigned int &  i,
unsigned int  digits = 5 
)

Look for a file path which is not already taken.

Several scape strings can be used, that will be replaced as follows:

  • "%d"/"{index}" will be replaced by the first integer which results in a non-existing file path
  • "{mpi_rank}" will be replaced by the process identifier index
  • "{version}" will be replaced by the AQUAgpusph package version

In case a file path cannot be obtained, a std::invalid_argument exception will be raised.

Parameters
basenameThe base name of the file
iFirst index that will be checked. Also, the resulting file index is stored in this variable.
Returns
The available file path
Note
In case overwriting files is allowed, you can call this method with a try, catching std::invalid_argument exception. If exception std::invalid_argument is eventually raised, you can call setStrConstantsCopy()
Here is the call graph for this function:

◆ nextPowerOf2()

unsigned int Aqua::nextPowerOf2 ( unsigned int  x)

Next number which is power of 2.

Compute a value which, being power of two, is greater or equal than <strong class=.

Parameters
xNumber to round up to a power of two.
Returns
Next value which is power of two (it can be the same input value <strong class=).

◆ normalize()

vec Aqua::normalize ( vec  v)

Compute a normalized vector copy (such that length() will return 1.0.

Parameters
vVector to normalize.
Returns
Normalized copy of the vector.
See also
length()
Here is the call graph for this function:

◆ not_operator()

double Aqua::not_operator ( double  v)

◆ numberOfDigits()

unsigned int Aqua::numberOfDigits ( unsigned int  number)

Get the number of digits of an integer decimal text representation.

Parameters
numberNumber from which the number of digits should be computed.
Returns
Number of digits.

◆ replaceAll()

void Aqua::replaceAll ( std::string &  str,
const std::string &  search,
const std::string &  replace 
)

Replace all substring occurrences by another substring.

Parameters
strString to be modified
searchSubstring to be replaced
replaceReplacement substring

◆ replaceAllCopy()

std::string Aqua::replaceAllCopy ( std::string  str,
std::string  search,
std::string  replace 
)

Replace all substring occurrences by another substring.

Parameters
strString to be modified
searchSubstring to be replaced
replaceReplacement substring
Returns
Modified string
Here is the call graph for this function:

◆ round()

int Aqua::round ( float  n)

Round an float value to an integer one.

Parameters
nNumber to round.
Returns
The closest integer to <strong class=.

◆ roundUp()

unsigned int Aqua::roundUp ( unsigned int  x,
unsigned int  divisor 
)

Rounded up value which is divisible by <strong class=.

Compute a value, which being divisible by <strong class=, is greater or equal than <strong class=.

Parameters
xNumber to round up.
divisorDivisor.
Returns
Rounded up number.

◆ rtrim()

void Aqua::rtrim ( std::string &  s)

Remove all the blank spaces (including line breaks, tabulators...) string suffix.

Parameters
sString to become trimmed

◆ rtrimCopy()

std::string Aqua::rtrimCopy ( std::string  s)

Remove all the blank spaces (including line breaks, tabulators...) string suffix.

Parameters
sString to become trimmed
Returns
Trimmed string
Here is the call graph for this function:

◆ setStrConstants()

void Aqua::setStrConstants ( std::string &  str)

Set several constants into a string.

Following scape strings can be used, that will be replaced as follows:

  • "{mpi_rank}" will be replaced by the process identifier index
  • "{version}" will be replaced by the AQUAgpusph package version
Parameters
strThe string where constants shall be set
Here is the call graph for this function:

◆ setStrConstantsCopy()

std::string Aqua::setStrConstantsCopy ( std::string  str)

Set several constants into a string.

Following scape strings can be used, that will be replaced as follows:

  • "{mpi_rank}" will be replaced by the process identifier index
  • "{version}" will be replaced by the AQUAgpusph package version
Parameters
strThe string where constants shall be set
Returns
The modified string
Here is the call graph for this function:

◆ split()

std::vector< std::string > Aqua::split ( std::string  str,
char  chr 
)

Split a string by a character.

Parameters
strString to be split
chrSplitting cahracter
Returns
List of substrings

◆ split_formulae()

std::vector< std::string > Aqua::split_formulae ( std::string  str)

Split a list of split_formulae.

Formulae can be separated either by semicolon, ';', or by simple comma, ','. This function already takes care of parentheses, but it is not checking for syntax errors

Parameters
strString within formulae
Returns
List of formulae string
Here is the call graph for this function:

◆ sub()

vec Aqua::sub ( vec  a,
vec  b 
)

Subtracting operation.

Parameters
aVector to operate.
bVector to operate.
Returns
<strong class= - <strong class=.

◆ toLower()

void Aqua::toLower ( std::string &  str)

Convert a string to lower case.

◆ toLowerCopy()

std::string Aqua::toLowerCopy ( std::string  str)

Convert a string to lower case.

Returns
Modified string
Here is the call graph for this function:

◆ trim()

void Aqua::trim ( std::string &  s)

Remove all the blank spaces (including line breaks, tabulators...) string prefix and suffix.

Parameters
sString to become trimmed
Here is the call graph for this function:

◆ trimCopy()

std::string Aqua::trimCopy ( std::string  s)

Remove all the blank spaces (including line breaks, tabulators...) string prefix and suffix.

Parameters
sString to become trimmed
Returns
Trimmed string
Here is the call graph for this function:

◆ Vx()

vec Aqua::Vx ( )

Return the x direction unit vector.

Returns
x direction unit vector.

◆ Vy()

vec Aqua::Vy ( )

Return the y direction unit vector.

Returns
y direction unit vector.

◆ Vz()

vec Aqua::Vz ( )

Return the z direction unit vector.

Remarks
Only available in the 3D version.
Returns
z direction unit vector.

◆ Vzero()

vec Aqua::Vzero ( )

Return a null vector.

Returns
zeroes vector.

◆ xxd2string()

std::string Aqua::xxd2string ( unsigned char *  arr,
unsigned int  len 
)

Transform a xxd exported file into a C++ string.

xdd can be used to embed external files into the program source code, by means of an include statement. However, the data is exported as a non-null terminated char array and its length. This method is appending the null character, and building a C++ string

Parameters
arrC-Like chars array
lenC-Like chars array length
Returns
C++ string

Variable Documentation

◆ extension

std::string Aqua::extension
static

◆ filename

std::string Aqua::filename
static

◆ folder

std::string Aqua::folder
static