suanPan
🧮 An Open Source, Parallel and Heterogeneous Finite Element Analysis Framework
Loading...
Searching...
No Matches
utility.h File Reference
#include <concepts>
#include <set>
#include <suanPan.h>
Include dependency graph for utility.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  suanpan
 
namespace  suanpan::expression
 

Functions

template<typename T >
constexpr const T & suanpan::middle (const std::vector< T > &container)
 
template<sp_i IT, std::invocable< IT > F>
void suanpan::for_each (const IT start, const IT end, F &&FN)
 
template<sp_i IT, std::invocable< IT > F>
void suanpan::for_each (const IT end, F &&FN)
 
template<typename T >
constexpr T suanpan::max_element (T start, T end)
 
template<typename T >
const std::vector< T > & suanpan::unique (std::vector< T > &container)
 
template<class Container , class Handler >
requires requires(Container x) { x.begin(); x.end(); }
auto suanpan::all_of (Container &target, Handler &&func)
 
template<class Container , class Handler >
requires requires(Container x) { x.begin(); x.end(); }
auto suanpan::none_of (Container &target, Handler &&func)
 
template<class Container , class Handler >
requires requires(Container x) { x.begin(); x.end(); }
auto suanpan::any_of (Container &target, Handler &&func)
 
template<typename T >
constexpr T & suanpan::hacker (const T &I)
 
template<typename T >
constexpr T *& suanpan::hacker (const T *const &I)
 
template<typename T >
requires std::signed_integral<T> || std::floating_point<T>
constexpr T suanpan::sign (const T I)
 
template<std::floating_point T>
constexpr T suanpan::clamp (const T c, T a, T b)
 
template<std::floating_point T>
constexpr T suanpan::clamp_unit (const T c)
 
template<std::floating_point T>
bool suanpan::approx_equal (const T x, const T y, int ulp=2)
 
unsigned long long suanpan::binomial (unsigned long long, unsigned long long)
 
char suanpan::to_upper (char)
 
char suanpan::to_lower (char)
 
void suanpan::to_upper (std::string &)
 
void suanpan::to_lower (std::string &)
 
std::string suanpan::to_upper (const std::string &)
 
std::string suanpan::to_lower (const std::string &)
 
std::string suanpan::to_upper (std::string &&)
 
std::string suanpan::to_lower (std::string &&)
 
std::vector< std::pair< std::string, unsigned > > suanpan::expression::split (std::string_view variable_string)
 
template<typename T >
bool get_input (std::istringstream &stream, T &output)
 
template<typename T >
bool get_input (std::istringstream &stream, Col< T > &output)
 
template<typename T , typename... U>
bool get_input (std::istringstream &stream, T &output, U &... rest)
 
template<typename... Ts>
bool get_input (std::istringstream &stream, std::tuple< Ts... > &output)
 
template<typename T >
auto get_remaining (std::istringstream &stream)
 
template<typename T >
auto get_remaining_as_set (std::istringstream &stream)
 
template<typename T1 , typename T2 , typename... Ts>
auto get_remaining (std::istringstream &stream)
 
template<typename... Ts>
auto get_remaining_as_tuple (std::istringstream &stream)
 
template<typename T >
get_input (std::istringstream &stream)
 
void ignore_whitespace (std::istringstream &)
 
template<typename T >
bool get_optional_input (std::istringstream &stream, T &output)
 
template<typename T >
bool get_optional_input (std::istringstream &stream, Col< T > &output)
 
template<typename T , typename... U>
bool get_optional_input (std::istringstream &stream, T &output, U &... rest)
 
std::string get_remaining (std::istringstream &)
 
bool is_equal (char, char)
 
bool is_equal (int, char)
 
bool is_equal (std::string_view, std::string_view)
 
template<typename... S>
bool is_equal_any (std::string_view a, S... rest)
 
bool if_startswith (std::string_view, std::string_view)
 
bool if_contain (const std::string &, const char *)
 
bool if_contain (const std::string &, const std::string &)
 
bool is_true (std::string_view)
 
bool is_false (std::string_view)
 
bool is_integer (const std::string &)
 
double perturb (double, double=1E-5)
 

Function Documentation

◆ get_input() [1/5]

template<typename T >
T get_input ( std::istringstream &  stream)

◆ get_input() [2/5]

template<typename T >
bool get_input ( std::istringstream &  stream,
Col< T > &  output 
)
Here is the call graph for this function:

◆ get_input() [3/5]

template<typename... Ts>
bool get_input ( std::istringstream &  stream,
std::tuple< Ts... > &  output 
)
Here is the call graph for this function:

◆ get_input() [4/5]

template<typename T >
bool get_input ( std::istringstream &  stream,
T &  output 
)
Here is the caller graph for this function:

◆ get_input() [5/5]

template<typename T , typename... U>
bool get_input ( std::istringstream &  stream,
T &  output,
U &...  rest 
)
Here is the call graph for this function:

◆ get_optional_input() [1/3]

template<typename T >
bool get_optional_input ( std::istringstream &  stream,
Col< T > &  output 
)
Here is the call graph for this function:

◆ get_optional_input() [2/3]

template<typename T >
bool get_optional_input ( std::istringstream &  stream,
T &  output 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_optional_input() [3/3]

template<typename T , typename... U>
bool get_optional_input ( std::istringstream &  stream,
T &  output,
U &...  rest 
)
Here is the call graph for this function:

◆ get_remaining() [1/3]

std::string get_remaining ( std::istringstream &  I)
Here is the caller graph for this function:

◆ get_remaining() [2/3]

template<typename T >
auto get_remaining ( std::istringstream &  stream)
Here is the call graph for this function:

◆ get_remaining() [3/3]

template<typename T1 , typename T2 , typename... Ts>
auto get_remaining ( std::istringstream &  stream)
Here is the call graph for this function:

◆ get_remaining_as_set()

template<typename T >
auto get_remaining_as_set ( std::istringstream &  stream)
Here is the call graph for this function:

◆ get_remaining_as_tuple()

template<typename... Ts>
auto get_remaining_as_tuple ( std::istringstream &  stream)
Here is the call graph for this function:

◆ if_contain() [1/2]

bool if_contain ( const std::string &  A,
const char *  B 
)
Here is the caller graph for this function:

◆ if_contain() [2/2]

bool if_contain ( const std::string &  A,
const std::string &  B 
)

◆ if_startswith()

bool if_startswith ( std::string_view  A,
std::string_view  B 
)
Here is the caller graph for this function:

◆ ignore_whitespace()

void ignore_whitespace ( std::istringstream &  I)
Here is the call graph for this function:

◆ is_equal() [1/3]

bool is_equal ( char  A,
char  B 
)
Here is the caller graph for this function:

◆ is_equal() [2/3]

bool is_equal ( int  A,
char  B 
)

◆ is_equal() [3/3]

bool is_equal ( std::string_view  A,
std::string_view  B 
)

◆ is_equal_any()

template<typename... S>
bool is_equal_any ( std::string_view  a,
S...  rest 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_false()

bool is_false ( std::string_view  S)
Here is the call graph for this function:

◆ is_integer()

bool is_integer ( const std::string &  S)
Here is the caller graph for this function:

◆ is_true()

bool is_true ( std::string_view  S)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ perturb()

double perturb ( double  input,
double  fraction = 1E-5 
)