Go to the source code of this file.
Classes | |
class | MooseUtils::Has_size< T > |
Taken from https://stackoverflow.com/a/257382 Evaluating constexpr (Has_size<T>::value) in a templated method over class T will return whether T is a standard container or a singleton. More... | |
struct | MooseUtils::Has_size< T >::No |
struct | MooseUtils::IsLikeReal< T > |
Custom type trait that has a value of true for types that cam be use interchangeably with Real. More... | |
struct | MooseUtils::IsLikeReal< Real > |
struct | MooseUtils::IsLikeReal< ADReal > |
struct | MooseUtils::canBroadcast< T > |
Custom type trait that has a value of true for types that can be broadcasted. More... | |
struct | MooseUtils::AnyType |
Comparison helpers that support the MooseUtils::Any wildcard which will match any value. More... | |
class | MooseUtils::SemidynamicVector< T, N, value_init > |
Utility class template for a semidynamic vector with a maximum size N and a chosen dynamic size. More... | |
struct | Moose::ADType< T > |
struct | Moose::ADType< MooseUtils::SemidynamicVector< T, N, value_init > > |
Namespaces | |
libMesh | |
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines for std::strings. | |
libMesh::Parallel | |
MooseUtils | |
Moose | |
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to address this in their environment if C++17 compatibility isn't found. | |
Functions | |
std::filesystem::path | MooseUtils::pathjoin (const std::filesystem::path &p) |
template<typename... Args> | |
std::filesystem::path | MooseUtils::pathjoin (const std::filesystem::path &p, Args... args) |
bool | MooseUtils::parsesToReal (const std::string &input) |
Check if the input string can be parsed into a Real. More... | |
std::string | MooseUtils::runTestsExecutable () |
Returns the location of either a local repo run_tests script - or an installed test executor script if run_tests isn't found. More... | |
std::string | MooseUtils::findTestRoot () |
Searches in the current working directory and then recursively up in each parent directory looking for a "testroot" file. More... | |
std::string | MooseUtils::installedInputsDir (const std::string &app_name, const std::string &dir_name, const std::string &extra_error_msg="") |
Returns the directory of any installed inputs or the empty string if none are found. More... | |
std::string | MooseUtils::docsDir (const std::string &app_name) |
Returns the directory of any installed docs/site. More... | |
std::string | MooseUtils::mooseDocsURL (const std::string &path) |
Returns the URL of a page located on the MOOSE documentation site. More... | |
std::string | MooseUtils::replaceAll (std::string str, const std::string &from, const std::string &to) |
Replaces all occurrences of from in str with to and returns the result. More... | |
std::string | MooseUtils::convertLatestCheckpoint (std::string orig) |
Replaces "LATEST" placeholders with the latest checkpoint file name. More... | |
int | MooseUtils::levenshteinDist (const std::string &s1, const std::string &s2) |
Computes and returns the Levenshtein distance between strings s1 and s2. More... | |
void | MooseUtils::escape (std::string &str) |
This function will escape all of the standard C++ escape characters so that they can be printed. More... | |
std::string | MooseUtils::removeExtraWhitespace (const std::string &str) |
Removes additional whitespace from a string. More... | |
std::vector< std::string > | MooseUtils::split (const std::string &str, const std::string &delimiter, std::size_t max_count=std::numeric_limits< std::size_t >::max()) |
Python like split functions for strings. More... | |
std::vector< std::string > | MooseUtils::rsplit (const std::string &str, const std::string &delimiter, std::size_t max_count=std::numeric_limits< std::size_t >::max()) |
template<typename Iterator > | |
std::string | MooseUtils::join (Iterator begin, Iterator end, const std::string &delimiter) |
Python-like join function for strings over an iterator range. More... | |
template<typename T > | |
std::string | MooseUtils::join (const T &strings, const std::string &delimiter) |
Python-like join function for strings over a container. More... | |
std::size_t | MooseUtils::fileSize (const std::string &filename) |
Check the file size. More... | |
bool | MooseUtils::pathContains (const std::string &expression, const std::string &string_to_find, const std::string &delims="/") |
This function tokenizes a path and checks to see if it contains the string to look for. More... | |
bool | MooseUtils::checkFileReadable (const std::string &filename, bool check_line_endings=false, bool throw_on_unreadable=true, bool check_for_git_lfs_pointer=true) |
Checks to see if a file is readable (exists and permissions) More... | |
bool | MooseUtils::checkFileWriteable (const std::string &filename, bool throw_on_unwritable=true) |
Check if the file is writable (path exists and permissions) More... | |
bool | MooseUtils::checkForGitLFSPointer (std::ifstream &file) |
Check if the file is a Git-LFS pointer. More... | |
void | MooseUtils::parallelBarrierNotify (const libMesh::Parallel::Communicator &comm, bool messaging=true) |
This function implements a parallel barrier function but writes progress to stdout. More... | |
void | MooseUtils::serialBegin (const libMesh::Parallel::Communicator &comm, bool warn=true) |
This function marks the begin of a section of code that is executed in serial rank by rank. More... | |
void | MooseUtils::serialEnd (const libMesh::Parallel::Communicator &comm, bool warn=true) |
Closes a section of code that is executed in serial rank by rank, and that was opened with a call to serialBegin. More... | |
bool | MooseUtils::hasExtension (const std::string &filename, std::string ext, bool strip_exodus_ext=false) |
Function tests if the supplied filename as the desired extension. More... | |
std::string | MooseUtils::getExtension (const std::string &filename, const bool rfind=false) |
Gets the extension of the passed file name. More... | |
std::string | MooseUtils::stripExtension (const std::string &s, const bool rfind=false) |
Removes any file extension from the given string s (i.e. More... | |
template<typename T > | |
std::pair< std::filesystem::path, std::filesystem::path > | MooseUtils::splitFileName (const T &full_file) |
Function for splitting path and filename. More... | |
std::string | MooseUtils::getCurrentWorkingDir () |
Returns the current working directory as a string. More... | |
void | MooseUtils::makedirs (const std::string &dir_name, bool throw_on_failure=false) |
Recursively make directories. More... | |
void | MooseUtils::removedirs (const std::string &dir_name, bool throw_on_failure=false) |
Recursively remove directories from inner-most when the directories are empty. More... | |
std::string | MooseUtils::camelCaseToUnderscore (const std::string &camel_case_name) |
Function for converting a camel case name to a name containing underscores. More... | |
std::string | MooseUtils::underscoreToCamelCase (const std::string &underscore_name, bool leading_upper_case) |
Function for converting an underscore name to a camel case name. More... | |
std::string | MooseUtils::shortName (const std::string &name) |
Function for stripping name after the file / in parser block. More... | |
std::string | MooseUtils::baseName (const std::string &name) |
Function for string the information before the final / in a parser block. More... | |
std::string | MooseUtils::hostname () |
Get the hostname the current process is running on. More... | |
unsigned short | MooseUtils::getTermWidth (bool use_environment) |
Returns the width of the terminal using sys/ioctl. More... | |
std::string | MooseUtils::prettyCppType (const std::string &cpp_type) |
template<typename T > | |
std::string | MooseUtils::prettyCppType (const T *obj=nullptr) |
template<typename T1 , typename T2 > | |
bool | MooseUtils::doesMapContainValue (const std::map< T1, T2 > &the_map, const T2 &value) |
This routine is a simple helper function for searching a map by values instead of keys. More... | |
template<typename T , typename T2 , typename T3 = T, typename std::enable_if< libMesh::ScalarTraits< T >::value &&libMesh::ScalarTraits< T2 >::value &&libMesh::ScalarTraits< T3 >::value, int >::type = 0> | |
bool | MooseUtils::absoluteFuzzyEqual (const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE) |
Function to check whether two variables are equal within an absolute tolerance. More... | |
template<typename T , typename T2 , typename T3 = T, typename std::enable_if< libMesh::ScalarTraits< T >::value &&libMesh::ScalarTraits< T2 >::value &&libMesh::ScalarTraits< T3 >::value, int >::type = 0> | |
bool | MooseUtils::absoluteFuzzyGreaterEqual (const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE) |
Function to check whether a variable is greater than or equal to another variable within an absolute tolerance. More... | |
template<typename T , typename T2 , typename T3 = T, typename std::enable_if< libMesh::ScalarTraits< T >::value &&libMesh::ScalarTraits< T2 >::value &&libMesh::ScalarTraits< T3 >::value, int >::type = 0> | |
bool | MooseUtils::absoluteFuzzyGreaterThan (const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE) |
Function to check whether a variable is greater than another variable within an absolute tolerance. More... | |
template<typename T , typename T2 , typename T3 = T, typename std::enable_if< libMesh::ScalarTraits< T >::value &&libMesh::ScalarTraits< T2 >::value &&libMesh::ScalarTraits< T3 >::value, int >::type = 0> | |
bool | MooseUtils::absoluteFuzzyLessEqual (const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE) |
Function to check whether a variable is less than or equal to another variable within an absolute tolerance. More... | |
template<typename T , typename T2 , typename T3 = T, typename std::enable_if< libMesh::ScalarTraits< T >::value &&libMesh::ScalarTraits< T2 >::value &&libMesh::ScalarTraits< T3 >::value, int >::type = 0> | |
bool | MooseUtils::absoluteFuzzyLessThan (const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE) |
Function to check whether a variable is less than another variable within an absolute tolerance. More... | |
template<typename T , typename T2 , typename T3 = Real> | |
bool | MooseUtils::relativeFuzzyEqual (const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE) |
Function to check whether two variables are equal within a relative tolerance. More... | |
template<typename T , typename T2 , typename T3 = T, typename std::enable_if< libMesh::ScalarTraits< T >::value &&libMesh::ScalarTraits< T2 >::value &&libMesh::ScalarTraits< T3 >::value, int >::type = 0> | |
bool | MooseUtils::relativeFuzzyGreaterEqual (const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE) |
Function to check whether a variable is greater than or equal to another variable within a relative tolerance. More... | |
template<typename T , typename T2 , typename T3 = T, typename std::enable_if< libMesh::ScalarTraits< T >::value &&libMesh::ScalarTraits< T2 >::value &&libMesh::ScalarTraits< T3 >::value, int >::type = 0> | |
bool | MooseUtils::relativeFuzzyGreaterThan (const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE) |
Function to check whether a variable is greater than another variable within a relative tolerance. More... | |
template<typename T , typename T2 , typename T3 = T, typename std::enable_if< libMesh::ScalarTraits< T >::value &&libMesh::ScalarTraits< T2 >::value &&libMesh::ScalarTraits< T3 >::value, int >::type = 0> | |
bool | MooseUtils::relativeFuzzyLessEqual (const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE) |
Function to check whether a variable is less than or equal to another variable within a relative tolerance. More... | |
template<typename T , typename T2 , typename T3 = T, typename std::enable_if< libMesh::ScalarTraits< T >::value &&libMesh::ScalarTraits< T2 >::value &&libMesh::ScalarTraits< T3 >::value, int >::type = 0> | |
bool | MooseUtils::relativeFuzzyLessThan (const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE) |
Function to check whether a variable is less than another variable within a relative tolerance. More... | |
template<typename T > | |
void | MooseUtils::getUnion (const std::vector< T > &vector1, const std::vector< T > &vector2, std::vector< T > &common) |
Function which takes the union of vector1 and vector2 and copies them to common . More... | |
template<typename T > | |
bool | MooseUtils::isZero (const T &value, const Real tolerance=TOLERANCE *TOLERANCE *TOLERANCE) |
void | MooseUtils::MaterialPropertyStorageDump (const HashMap< const libMesh::Elem *, HashMap< unsigned int, MaterialProperties >> &props) |
Function to dump the contents of MaterialPropertyStorage for debugging purposes. More... | |
void | MooseUtils::indentMessage (const std::string &prefix, std::string &message, const char *color=COLOR_CYAN, bool dont_indent_first_line=true, const std::string &post_prefix=": ") |
Indents the supplied message given the prefix and color. More... | |
std::string & | MooseUtils::removeColor (std::string &msg) |
remove ANSI escape sequences for terminal color from msg More... | |
std::list< std::string > | MooseUtils::listDir (const std::string path, bool files_only=false) |
bool | MooseUtils::pathExists (const std::string &path) |
std::list< std::string > | MooseUtils::getFilesInDirs (const std::list< std::string > &directory_list, const bool files_only=true) |
Retrieves the names of all of the files contained within the list of directories passed into the routine. More... | |
std::string | MooseUtils::getLatestCheckpointFilePrefix (const std::list< std::string > &checkpoint_files) |
Returns the most recent checkpoint prefix (the four numbers at the beginning) If a suitable file isn't found the empty string is returned. More... | |
bool | MooseUtils::wildCardMatch (std::string name, std::string search_string) |
bool | MooseUtils::globCompare (const std::string &candidate, const std::string &pattern, std::size_t c=0, std::size_t p=0) |
template<typename T > | |
void | MooseUtils::expandAllMatches (const std::vector< T > &candidates, std::vector< T > &patterns) |
template<typename T > | |
T | MooseUtils::convert (const std::string &str, bool throw_on_failure=false) |
convert takes a string representation of a number type and converts it to the number. More... | |
template<> | |
short int | MooseUtils::convert< short int > (const std::string &str, bool throw_on_failure) |
template<> | |
unsigned short int | MooseUtils::convert< unsigned short int > (const std::string &str, bool throw_on_failure) |
template<> | |
int | MooseUtils::convert< int > (const std::string &str, bool throw_on_failure) |
template<> | |
unsigned int | MooseUtils::convert< unsigned int > (const std::string &str, bool throw_on_failure) |
template<> | |
long int | MooseUtils::convert< long int > (const std::string &str, bool throw_on_failure) |
template<> | |
unsigned long int | MooseUtils::convert< unsigned long int > (const std::string &str, bool throw_on_failure) |
template<> | |
long long int | MooseUtils::convert< long long int > (const std::string &str, bool throw_on_failure) |
template<> | |
unsigned long long int | MooseUtils::convert< unsigned long long int > (const std::string &str, bool throw_on_failure) |
void | MooseUtils::createSymlink (const std::string &target, const std::string &link) |
Create a symbolic link, if the link already exists it is replaced. More... | |
void | MooseUtils::clearSymlink (const std::string &link) |
Remove a symbolic link, if the given filename is a link. More... | |
template<typename T > | |
T | MooseUtils::concatenate (T c1, const T &c2) |
Returns a container that contains the content of second passed in container inserted into the first passed in container (set or map union). More... | |
template<typename T > | |
std::vector< T > | MooseUtils::concatenate (std::vector< T > c1, const std::vector< T > &c2) |
Returns a vector that contains is the concatenation of the two passed in vectors. More... | |
template<typename T > | |
std::vector< T > | MooseUtils::concatenate (std::vector< T > c1, const T &item) |
Returns the passed in vector with the item appended to it. More... | |
std::string | MooseUtils::stringJoin (const std::vector< std::string > &values, const std::string &separator=" ") |
Concatenates value into a single string separated by separator . More... | |
bool | MooseUtils::beginsWith (const std::string &value, const std::string &begin_value) |
template<typename T > | |
int | MooseUtils::numDigits (const T &num) |
Return the number of digits for a number. More... | |
ExecFlagEnum | MooseUtils::getDefaultExecFlagEnum () |
Return the default ExecFlagEnum for MOOSE. More... | |
int | MooseUtils::stringToInteger (const std::string &input, bool throw_on_failure=false) |
Robust string to integer conversion that fails for cases such at "1foo". More... | |
void | MooseUtils::linearPartitionItems (dof_id_type num_items, dof_id_type num_chunks, dof_id_type chunk_id, dof_id_type &num_local_items, dof_id_type &local_items_begin, dof_id_type &local_items_end) |
Linearly partition a number of items. More... | |
processor_id_type | MooseUtils::linearPartitionChunk (dof_id_type num_items, dof_id_type num_chunks, dof_id_type item_id) |
Return the chunk_id that is assigned to handle item_id. More... | |
std::string | MooseUtils::realpath (const std::string &path) |
Wrapper around PetscGetRealPath, which is a cross-platform replacement for realpath. More... | |
template<typename C , typename It , typename M1 , typename M2 > | |
auto | MooseUtils::findPair (C &container, It start_iterator, const M1 &first, const M2 &second) |
Find a specific pair in a container matching on first, second or both pair components. More... | |
libMesh::BoundingBox | MooseUtils::buildBoundingBox (const Point &p1, const Point &p2) |
Construct a valid bounding box from 2 arbitrary points. More... | |
template<typename T > | |
T * | MooseUtils::get (const std::unique_ptr< T > &u) |
The MooseUtils::get() specializations are used to support making forwards-compatible code changes from dumb pointers to smart pointers. More... | |
template<typename T > | |
T * | MooseUtils::get (T *p) |
template<typename T > | |
T * | MooseUtils::get (const std::shared_ptr< T > &s) |
template<class InputIterator > | |
bool | MooseUtils::setsIntersect (InputIterator first1, InputIterator last1, InputIterator first2, InputIterator last2) |
This method detects whether two sets intersect without building a result set. More... | |
template<class T > | |
bool | MooseUtils::setsIntersect (const T &s1, const T &s2) |
bool | MooseUtils::isDigits (const std::string &str) |
Courtesy https://stackoverflow.com/a/8889045 and https://en.cppreference.com/w/cpp/string/byte/isdigit. More... | |
bool | MooseUtils::isFloat (const std::string &str) |
Courtesy https://stackoverflow.com/a/57163016 and https://stackoverflow.com/questions/447206/c-isfloat-function. More... | |
std::string | MooseUtils::canonicalPath (const std::string &path) |
Gets the canonical path of the given path. More... | |
bool | MooseUtils::startsWith (const std::string &string1, const std::string &string2) |
void | MooseUtils::replaceStart (std::string &string1, const std::string &string2, const std::string &string3) |
Replace the starting string string2 of string1 with string3 . More... | |
bool | MooseUtils::isAllLowercase (const std::string &str) |
void | removeSubstring (std::string &main, const std::string &sub) |
find, erase, length algorithm for removing a substring from a string More... | |
std::string | removeSubstring (const std::string &main, const std::string &sub) |
find, erase, length algorithm for removing a substring from a copy of a string More... | |
static const struct MooseUtils::AnyType | MooseUtils::Any |
template<typename T1 , typename T2 > | |
bool | MooseUtils::wildcardEqual (const T1 &a, const T2 &b) |
template<typename T > | |
bool | MooseUtils::wildcardEqual (const T &, AnyType) |
template<typename T > | |
bool | MooseUtils::wildcardEqual (AnyType, const T &) |
void removeSubstring | ( | std::string & | main, |
const std::string & | sub | ||
) |
find, erase, length algorithm for removing a substring from a string
Definition at line 1296 of file MooseUtils.C.
Referenced by FEProblemBase::checkDependMaterialsHelper(), and SubProblem::initialSetup().
std::string removeSubstring | ( | const std::string & | main, |
const std::string & | sub | ||
) |
find, erase, length algorithm for removing a substring from a copy of a string
Definition at line 1304 of file MooseUtils.C.