OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
Util.h File Reference
#include "Algorithms/Vektor.h"
#include "Algorithms/Quaternion.h"
#include "Physics/Physics.h"
#include <algorithm>
#include <cmath>
#include <cstring>
#include <functional>
#include <initializer_list>
#include <limits>
#include <sstream>
#include <string>
#include <type_traits>
Include dependency graph for Util.h:

Go to the source code of this file.

Classes

struct  Util::KahanAccumulation

Namespaces

namespace  Util

Macros

#define __FILENAME__   (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
#define __DBGMSG__   __FILENAME__ << ": " << __LINE__ << "\t"

Functions

std::string Util::getGitRevision ()
double Util::erfinv (double x)
double Util::getGamma (Vector_t p)
Vector_t Util::getBeta (Vector_t p)
double Util::getKineticEnergy (Vector_t p, double mass)
double Util::getBetaGamma (double Ekin, double mass)
double Util::convertMomentumEVoverCToBetaGamma (double p, double mass)
std::string Util::getTimeString (double time, unsigned int precision=3)
std::string Util::getLengthString (double spos, unsigned int precision=3)
std::string Util::getLengthString (Vector_t spos, unsigned int precision=3)
std::string Util::getEnergyString (double energyInMeV, unsigned int precision=3)
std::string Util::getChargeString (double charge, unsigned int precision=3)
Vector_t Util::getTaitBryantAngles (Quaternion rotation, const std::string &)
double Util::angle_0to2pi (double angle)
 convert angle (in rad) to [0,2pi) range, from https://stackoverflow.com/a/29721295
bool Util::angleBetweenAngles (const double angle, const double min, const double max)
 check if angle (in rad and in range [0,2pi]) is within [min, max]
std::string Util::toUpper (const std::string &str)
std::string Util::boolToUpperString (const bool &b)
std::string Util::boolVectorToUpperString (const std::vector< bool > &b)
std::string Util::doubleVectorToString (const std::vector< double > &v)
std::string Util::combineFilePath (std::initializer_list< std::string > ilist)
void Util::checkInt (double real, std::string name, double tolerance)
bool Util::isAllDigits (const std::string &str)
template<class IteratorIn, class IteratorOut>
void Util::toString (IteratorIn first, IteratorIn last, IteratorOut out)
template<typename T>
std::string Util::toStringWithThousandSep (T value, char sep='\'')
unsigned int Util::rewindLinesSDDS (const std::string &fileName, double maxSPos, bool checkForTime)
 rewind the SDDS file such that the spos of the last step is less or equal to maxSPos
std::string Util::base64_encode (const std::string &string_to_encode)
std::string Util::base64_decode (std::string const &encoded_string)
template<typename T, typename A>
T * Util::c_data (std::vector< T, A > &v)
template<typename T, typename A>
T const * Util::c_data (std::vector< T, A > const &v)

Macro Definition Documentation

◆ __DBGMSG__

#define __DBGMSG__   __FILENAME__ << ": " << __LINE__ << "\t"

Definition at line 37 of file Util.h.

◆ __FILENAME__

#define __FILENAME__   (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)

Definition at line 36 of file Util.h.