AQUAgpusph 5.0.4
Loading...
Searching...
No Matches
AuxiliarMethods.hpp File Reference

Set of auxiliar functions. More...

#include "sphPrerequisites.hpp"
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <limits>
#include <filesystem>
#include "aquagpusph/ext/boost/numeric/conversion/cast.hpp"
#include <mpi.h>
Include dependency graph for AuxiliarMethods.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  Aqua
 Main AQUAgpusph namespace.
namespace  Aqua::MPI

Functions

bool Aqua::hasPrefix (const std::string &str, const std::string &prefix)
 Check if a string starts with an specific prefix.
bool Aqua::startswith (const std::string &str, const std::string &prefix)
 Alias for hasPrefix()
bool Aqua::hasSuffix (const std::string &str, const std::string &suffix)
 Check if a string ends with an specific suffix.
bool Aqua::endswith (const std::string &str, const std::string &prefix)
 Alias for hasSuffix()
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 (const std::string &s)
 Split a string in a list of substrings.
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.
template<typename T>
bool Aqua::isPowerOf2 (T x)
 Check if a number is power of 2.
template<typename T>
T Aqua::nextPowerOf2 (T n)
 Next number which is power of 2.
template<typename T = unsigned int>
T Aqua::roundUp (T x, T divisor)
 Rounded up value which is divisible by <strong class=.
template<typename Tout = int, typename Tin>
Tout Aqua::round (Tin n)
 Round an float value to an integer one.
const std::string Aqua::getExePath ()
 Get the executable path.
const std::string Aqua::getRootPath ()
 Get the root path.
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_command_queue queue)
 Compute the maximum local work size allowed by a device.
size_t Aqua::getGlobalWorkSize (size_t n, size_t local_work_size)
 Compute the global work size needed to compute <strong class= threads.
float Aqua::clamp (float x, float a, float b)
 Clamps a value between the bounds.
template<class Tdst, class Torg>
Tdst Aqua::narrow_cast (Torg v)
 Cast a value, checking that it is not overflowing.
unsigned int Aqua::numberOfDigits (unsigned int number)
 Get the number of digits of an integer decimal text representation.
std::string Aqua::MPI::error_str (int errorcode)
 Wrapper for MPI_Error_string()
void Aqua::MPI::init (int *argc, char ***argv)
 Wrapper for MPI_Init()
void Aqua::MPI::finalize ()
 Wrapper for MPI_Finalize()
int Aqua::MPI::rank (MPI_Comm comm)
 Wrapper for MPI_Comm_rank()
int Aqua::MPI::size (MPI_Comm comm)
 Wrapper for MPI_Comm_size()
void Aqua::MPI::barrier (MPI_Comm comm)
 Wrapper for MPI_Barrier()
void Aqua::MPI::send (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)
 Wrapper for MPI_Send()
MPI_Request Aqua::MPI::isend (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)
 Wrapper for MPI_Isend()
MPI_Status Aqua::MPI::recv (void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm)
 Wrapper for MPI_Recv()
MPI_Request Aqua::MPI::irecv (void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm)
 Wrapper for MPI_Irecv()
MPI_Status Aqua::MPI::wait (MPI_Request *request)
 Wrapper for MPI_Wait()

Detailed Description

Set of auxiliar functions.