AQUAgpusph 4.1.2
Loading...
Searching...
No Matches
Namespaces | Functions | Variables
AuxiliarMethods.cpp File Reference

Set of auxiliar functions. More...

#include <algorithm>
#include <cctype>
#include <locale>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
#include <fcntl.h>
#include <string>
#include <sstream>
#include <iomanip>
#include <AuxiliarMethods.h>
#include <ProblemSetup.h>
#include <InputOutput/Logger.h>
Include dependency graph for AuxiliarMethods.cpp:

Namespaces

namespace  Aqua
 Main AQUAgpusph namespace.
 

Functions

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

Variables

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

Detailed Description

Set of auxiliar functions.