AQUAgpusph 5.0.4
|
Main AQUAgpusph namespace. More...
Namespaces | |
namespace | CalcServer |
Calculation server name space. | |
namespace | InputOutput |
Input/Output data interfaces. | |
namespace | MPI |
Data Structures | |
class | Tokenizer_exprtk |
class | Tokenizer_muparser |
Typedefs | |
typedef Tokenizer_exprtk | Tokenizer |
typedef long double | tokenizer_t |
Enumerations | |
enum | TLogLevel { L_DEBUG , L_INFO , L_WARNING , L_ERROR , L_NONE } |
Functions | |
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 n) |
unsigned int | isPowerOf2 (unsigned int n) |
const std::string | getExePath () |
Get the executable path. | |
const std::string | getRootPath () |
Get the root path. | |
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_command_queue queue) |
Compute the maximum local work size allowed by a device. | |
size_t | getGlobalWorkSize (size_t n, size_t local_work_size) |
Compute the global work size needed to compute <strong class= threads. | |
unsigned int | numberOfDigits (unsigned int number) |
Get the number of digits of an integer decimal text representation. | |
bool | startswith (const std::string &str, const std::string &prefix) |
Alias for hasPrefix() | |
bool | endswith (const std::string &str, const std::string &prefix) |
Alias for hasSuffix() | |
std::vector< std::string > | split (const std::string &s) |
Split a string in a list of substrings. | |
template<typename T> | |
bool | isPowerOf2 (T x) |
Check if a number is power of 2. | |
template<typename T> | |
T | nextPowerOf2 (T n) |
Next number which is power of 2. | |
template<typename T = unsigned int> | |
T | roundUp (T x, T divisor) |
Rounded up value which is divisible by <strong class=. | |
template<typename Tout = int, typename Tin> | |
Tout | round (Tin n) |
Round an float value to an integer one. | |
float | clamp (float x, float a, float b) |
Clamps a value between the bounds. | |
template<class Tdst, class Torg> | |
Tdst | narrow_cast (Torg v) |
Cast a value, checking that it is not overflowing. | |
double | mod_operator (double v, double w) |
double | not_operator (double v) |
Main AQUAgpusph namespace.
typedef Tokenizer_exprtk Aqua::Tokenizer |
typedef long double Aqua::tokenizer_t |
enum Aqua::TLogLevel |
|
inline |
Clamps a value between the bounds.
x | Value to adjust into the bounds. |
a | Minimum value. |
b | Maximum value. |
const std::string Aqua::getExePath | ( | ) |
Get the executable path.
Gets the file extension.
Get the file extension from the full file path <strong class=.
file_path | The file path. |
Gets the file name of the path <strong class=.
file_path | The file path. |
Gets the folder path which contains the file <strong class=.
file_path | The file path. |
size_t Aqua::getGlobalWorkSize | ( | size_t | n, |
size_t | local_work_size ) |
Compute the global work size needed to compute <strong class= threads.
n | Amount of data to operate in kernel (aiming threads to launch). |
local_work_size | The local work size which will be applied. |
size_t Aqua::getLocalWorkSize | ( | cl_command_queue | queue | ) |
Compute the maximum local work size allowed by a device.
n | Amount of data to operate in kernel (aiming threads to launch). |
queue | Command queue. |
const std::string Aqua::getRootPath | ( | ) |
Get the root path.
The root path is actually the data path, where the resources folder can be found. The root path is either Aqua::getExePath() / "../" or Aqua::getExePath() / "../share/aquagpusph"
std::filesystem::filesystem_error | if none of the path candidates exists |
Check if a string starts with an specific prefix.
str | String to be checked |
prefix | Prefix to be looked for |
Check if a string ends with an specific suffix.
str | String to be checked |
suffix | Suffix to be looked for |
bool Aqua::isFile | ( | const std::string | file_name | ) |
Check if the file <strong class= exist on the system.
file_name | The file path. |
Check if a number is power of 2.
Compute if a value is power of 2.
n | Value to test. |
unsigned int Aqua::isPowerOf2 | ( | unsigned int | n | ) |
bool Aqua::isRelativePath | ( | const std::string | path | ) |
Check if the path <strong class= is a relative or an absolute one.
path | The path. |
void Aqua::ltrim | ( | std::string & | s | ) |
Remove all the blank spaces (including line breaks, tabulators...) string prefix.
s | String to become trimmed |
std::string Aqua::ltrimCopy | ( | std::string | s | ) |
Remove all the blank spaces (including line breaks, tabulators...) string suffix.
s | String to become trimmed |
double Aqua::mod_operator | ( | double | v, |
double | w ) |
|
inline |
Cast a value, checking that it is not overflowing.
This is just a wrapper around boost::numeric_cast<>()
val | Value to cast |
std::out_of_range | If the casting would overflow the variable |
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:
In case a file path cannot be obtained, a std::invalid_argument exception will be raised.
basename | The base name of the file |
i | First index that will be checked. Also, the resulting file index is stored in this variable. |
Next number which is power of 2.
Compute a value which, being power of two, is greater or equal than n
.
n | Number to round up to a power of two. |
n
). unsigned int Aqua::nextPowerOf2 | ( | unsigned int | n | ) |
double Aqua::not_operator | ( | double | v | ) |
unsigned int Aqua::numberOfDigits | ( | unsigned int | number | ) |
Get the number of digits of an integer decimal text representation.
number | Number from which the number of digits should be computed. |
void Aqua::replaceAll | ( | std::string & | str, |
const std::string & | search, | ||
const std::string & | replace ) |
Replace all substring occurrences by another substring.
str | String to be modified |
search | Substring to be replaced |
replace | Replacement substring |
std::string Aqua::replaceAllCopy | ( | std::string | str, |
std::string | search, | ||
std::string | replace ) |
Replace all substring occurrences by another substring.
str | String to be modified |
search | Substring to be replaced |
replace | Replacement substring |
|
inline |
Round an float value to an integer one.
n | Number to round. |
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=.
x | Number to round up. |
divisor | Divisor. |
void Aqua::rtrim | ( | std::string & | s | ) |
Remove all the blank spaces (including line breaks, tabulators...) string suffix.
s | String to become trimmed |
std::string Aqua::rtrimCopy | ( | std::string | s | ) |
Remove all the blank spaces (including line breaks, tabulators...) string suffix.
s | String to become trimmed |
void Aqua::setStrConstants | ( | std::string & | str | ) |
Set several constants into a string.
Following scape strings can be used, that will be replaced as follows:
str | The string where constants shall be set |
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:
str | The string where constants shall be set |
|
inline |
Split a string in a list of substrings.
The space is used as separator
s | String to split |
std::vector< std::string > Aqua::split | ( | std::string | str, |
char | chr ) |
Split a string by a character.
str | String to be split |
chr | Splitting cahracter |
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
str | String within formulae |
void Aqua::toLower | ( | std::string & | str | ) |
Convert a string to lower case.
std::string Aqua::toLowerCopy | ( | std::string | str | ) |
Convert a string to lower case.
void Aqua::trim | ( | std::string & | s | ) |
Remove all the blank spaces (including line breaks, tabulators...) string prefix and suffix.
s | String to become trimmed |
std::string Aqua::trimCopy | ( | std::string | s | ) |
Remove all the blank spaces (including line breaks, tabulators...) string prefix and suffix.
s | String to become trimmed |
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
arr | C-Like chars array |
len | C-Like chars array length |