23#ifndef AUXILIARMETHODS_H_INCLUDED
24#define AUXILIARMETHODS_H_INCLUDED
46hasPrefix(
const std::string& str,
const std::string& prefix);
55hasSuffix(
const std::string& str,
const std::string& suffix);
65 const std::string& search,
66 const std::string& replace);
76replaceAllCopy(std::string str, std::string search, std::string replace);
141xxd2string(
unsigned char* arr,
unsigned int len);
182std::vector<std::string>
183split(std::string str,
char chr);
194std::vector<std::string>
220 unsigned int digits = 5);
251roundUp(
unsigned int x,
unsigned int divisor);
291isFile(
const std::string file_name);
331 return (a > b) ? b : a;
344 return (a < b) ? b : a;
357 return x < a ? a : (x > b ? b : x);
#define vec
Definition: LinkList.hcl.in:39
Main AQUAgpusph namespace.
Definition: ArgumentsManager.cpp:45
vec Vy()
Return the y direction unit vector.
Definition: AuxiliarMethods.cpp:445
void toLower(std::string &str)
Convert a string to lower case.
Definition: AuxiliarMethods.cpp:164
const std::string getFolderFromFilePath(const std::string file_path)
Gets the folder path which contains the file <strong class=.
Definition: AuxiliarMethods.cpp:324
std::string setStrConstantsCopy(std::string str)
Set several constants into a string.
Definition: AuxiliarMethods.cpp:199
vec Vx()
Return the x direction unit vector.
Definition: AuxiliarMethods.cpp:432
std::string toLowerCopy(std::string str)
Convert a string to lower case.
Definition: AuxiliarMethods.cpp:170
std::string newFilePath(const std::string &basename, unsigned int &i, unsigned int digits)
Look for a file path which is not already taken.
Definition: AuxiliarMethods.cpp:239
const std::string getFileNameFromFilePath(const std::string file_path)
Gets the file name of the path <strong class=.
Definition: AuxiliarMethods.cpp:339
vec normalize(vec v)
Compute a normalized vector copy (such that length() will return 1.0.
Definition: AuxiliarMethods.cpp:531
std::string xxd2string(unsigned char *arr, unsigned int len)
Transform a xxd exported file into a C++ string.
Definition: AuxiliarMethods.cpp:154
float dot(vec a, vec b)
Inner product.
Definition: AuxiliarMethods.cpp:510
std::string ltrimCopy(std::string s)
Remove all the blank spaces (including line breaks, tabulators...) string suffix.
Definition: AuxiliarMethods.cpp:133
unsigned int nextPowerOf2(unsigned int n)
Next number which is power of 2.
Definition: AuxiliarMethods.cpp:283
vec Vzero()
Return a null vector.
Definition: AuxiliarMethods.cpp:419
std::string trimCopy(std::string s)
Remove all the blank spaces (including line breaks, tabulators...) string prefix and suffix.
Definition: AuxiliarMethods.cpp:147
vec cross(vec a, vec b)
Cross product.
Definition: AuxiliarMethods.cpp:545
void ltrim(std::string &s)
Remove all the blank spaces (including line breaks, tabulators...) string prefix.
Definition: AuxiliarMethods.cpp:109
vec mult(float n, vec v)
Multiply a vector by a scalar.
Definition: AuxiliarMethods.cpp:471
float length(vec v)
Compute the vector length.
Definition: AuxiliarMethods.cpp:521
void trim(std::string &s)
Remove all the blank spaces (including line breaks, tabulators...) string prefix and suffix.
Definition: AuxiliarMethods.cpp:126
unsigned int numberOfDigits(unsigned int number)
Get the number of digits of an integer decimal text representation.
Definition: AuxiliarMethods.cpp:557
float clamp(float x, float a, float b)
Clamps a value between the bounds.
Definition: AuxiliarMethods.h:355
vec add(vec a, vec b)
Adding operation.
Definition: AuxiliarMethods.cpp:484
unsigned int isPowerOf2(unsigned int n)
Check if a number is power of 2.
Definition: AuxiliarMethods.cpp:296
std::string rtrimCopy(std::string s)
Remove all the blank spaces (including line breaks, tabulators...) string suffix.
Definition: AuxiliarMethods.cpp:140
vec Vz()
Return the z direction unit vector.
Definition: AuxiliarMethods.cpp:459
std::vector< std::string > split(std::string str, char chr)
Split a string by a character.
Definition: AuxiliarMethods.cpp:206
void rtrim(std::string &s)
Remove all the blank spaces (including line breaks, tabulators...) string suffix.
Definition: AuxiliarMethods.cpp:117
T max(T a, T b)
Gets the maximum of two values.
Definition: AuxiliarMethods.h:342
unsigned int roundUp(unsigned int n, unsigned int divisor)
Rounded up value which is divisible by <strong class=.
Definition: AuxiliarMethods.cpp:302
std::vector< std::string > split_formulae(std::string str)
Split a list of split_formulae.
Definition: AuxiliarMethods.cpp:218
const std::string getExtensionFromFilePath(const std::string file_path)
Gets the file extension.
Definition: AuxiliarMethods.cpp:352
size_t getLocalWorkSize(cl_uint n, cl_command_queue queue)
Compute the maximum local work size allowed by a device.
Definition: AuxiliarMethods.cpp:378
void setStrConstants(std::string &str)
Set several constants into a string.
Definition: AuxiliarMethods.cpp:177
std::string replaceAllCopy(std::string str, std::string search, std::string replace)
Replace all substring occurrences by another substring.
Definition: AuxiliarMethods.cpp:102
bool isFile(const std::string file_name)
Check if the file <strong class= exist on the system.
Definition: AuxiliarMethods.cpp:363
int round(float n)
Round an float value to an integer one.
Definition: AuxiliarMethods.cpp:313
T min(T a, T b)
Gets the minimum of two values.
Definition: AuxiliarMethods.h:329
size_t getGlobalWorkSize(cl_uint n, size_t local_work_size)
Compute the global work size needed to compute <strong class= threads.
Definition: AuxiliarMethods.cpp:413
void replaceAll(std::string &str, const std::string &search, const std::string &replace)
Replace all substring occurrences by another substring.
Definition: AuxiliarMethods.cpp:90
int isKeyPressed()
Returns if a key press event has been registered.
Definition: AuxiliarMethods.cpp:49
bool hasPrefix(const std::string &str, const std::string &prefix)
Check if a string starts with an specific prefix.
Definition: AuxiliarMethods.cpp:76
bool isRelativePath(const std::string path)
Check if the path <strong class= is a relative or an absolute one.
Definition: AuxiliarMethods.cpp:370
bool hasSuffix(const std::string &str, const std::string &suffix)
Check if a string ends with an specific suffix.
Definition: AuxiliarMethods.cpp:83
vec sub(vec a, vec b)
Subtracting operation.
Definition: AuxiliarMethods.cpp:497
Set of definitions and macros related with the implementation.