24 #include "libmesh/utility.h" 25 #include "libmesh/elem.h" 53 #include <sys/ioctl.h> 77 std::string path =
".";
78 for (
int i = 0; i < 5; i++)
80 auto testroot =
pathjoin(path,
"testroot");
91 std::istringstream ss(input);
93 if (ss >> real_value && ss.eof())
96 (*parsed_real) = real_value;
104 const std::string & dir_name,
105 const std::string & extra_error_msg)
110 std::string installed_path =
113 auto test_root =
pathjoin(installed_path,
"testroot");
115 mooseError(
"Couldn't locate any installed inputs to copy in path: ",
121 return installed_path;
132 auto docfile =
pathjoin(installed_path,
"css",
"moose.css");
134 return installed_path;
141 return "https://mooseframework.inl.gov/" + path;
145 replaceAll(std::string str,
const std::string & from,
const std::string & to)
147 size_t start_pos = 0;
148 while ((start_pos = str.find(from, start_pos)) != std::string::npos)
150 str.replace(start_pos, from.length(), to);
151 start_pos += to.length();
159 auto slash_pos = orig.find_last_of(
"/");
160 auto path = orig.substr(0, slash_pos);
161 auto file = orig.substr(slash_pos + 1);
162 if (file !=
"LATEST")
167 if (converted.empty())
168 mooseError(
"Unable to find suitable recovery file!");
180 auto s1len = s1.size();
181 auto s2len = s2.size();
183 auto column_start = (decltype(s1len))1;
185 auto column =
new decltype(s1len)[s1len + 1];
186 std::iota(column + column_start, column + s1len + 1, column_start);
188 for (
auto x = column_start; x <= s2len; x++)
191 auto last_diagonal = x - column_start;
192 for (
auto y = column_start; y <= s1len; y++)
194 auto old_diagonal = column[y];
195 auto possibilities = {
196 column[y] + 1, column[y - 1] + 1, last_diagonal + (s1[y - 1] == s2[x - 1] ? 0 : 1)};
197 column[y] =
std::min(possibilities);
198 last_diagonal = old_diagonal;
201 auto result = column[s1len];
209 std::map<char, std::string> escapes;
210 escapes[
'\a'] =
"\\a";
211 escapes[
'\b'] =
"\\b";
212 escapes[
'\f'] =
"\\f";
213 escapes[
'\n'] =
"\\n";
214 escapes[
'\t'] =
"\\t";
215 escapes[
'\v'] =
"\\v";
216 escapes[
'\r'] =
"\\r";
218 for (
const auto & it : escapes)
219 for (
size_t pos = 0; (pos = str.find(it.first, pos)) != std::string::npos;
220 pos += it.second.size())
221 str.replace(pos, 1, it.second);
227 return std::regex_replace(input, std::regex(
"^\\s+|\\s+$|\\s+(?=\\s)"),
"");
232 const std::string & string_to_find,
233 const std::string & delims)
235 std::vector<std::string> elements;
236 tokenize(expression, elements, 0, delims);
238 std::vector<std::string>::iterator found_it =
239 std::find(elements.begin(), elements.end(), string_to_find);
240 if (found_it != elements.end())
250 return (stat(path.c_str(), &buffer) == 0);
255 bool check_line_endings,
256 bool throw_on_unreadable,
257 bool check_for_git_lfs_pointer)
259 std::ifstream in(filename.c_str(), std::ifstream::in);
262 if (throw_on_unreadable)
264 (std::string(
"Unable to open file \"") + filename +
265 std::string(
"\". Check to make sure that it exists and that you have read permission."))
271 if (check_line_endings)
273 std::istream_iterator<char> iter(in);
274 std::istream_iterator<char> eos;
278 mooseError(filename +
" contains Windows(DOS) line endings which are not supported.");
282 mooseError(filename +
" appears to be a Git-LFS pointer. Make sure you have \"git-lfs\" " 283 "installed so that you may pull this file.");
292 mooseAssert(file.is_open(),
"Passed in file handle is not open");
299 std::getline(file, line);
300 if (line.find(
"version https://") != std::string::npos)
309 std::ofstream
out(filename.c_str(), std::ios_base::app);
312 if (throw_on_unwritable)
314 (std::string(
"Unable to open file \"") + filename +
315 std::string(
"\". Check to make sure that it exists and that you have write permission."))
332 Moose::out <<
"Waiting For Other Processors To Finish" << std::endl;
333 if (comm.
rank() == 0)
337 Moose::out <<
"Jobs complete: 1/" << comm.
size() << (1 == comm.
size() ?
"\n" :
"\r")
339 for (
unsigned int i = 2; i <= comm.
size(); ++i)
341 comm.
receive(MPI_ANY_SOURCE, secondary_processor_id);
343 Moose::out <<
"Jobs complete: " << i <<
"/" << comm.
size()
344 << (i == comm.
size() ?
"\n" :
"\r") << std::flush;
349 secondary_processor_id = comm.
rank();
350 comm.
send(0, secondary_processor_id);
367 mooseWarning(
"Entering serial execution block (use only for debugging)");
382 if (comm.
rank() == 0 && warn)
383 mooseWarning(
"Leaving serial execution block (use only for debugging)");
387 hasExtension(
const std::string & filename, std::string ext,
bool strip_exodus_ext)
390 std::string file_ext;
391 if (strip_exodus_ext)
394 ".*\\.([^\\.]*?)(?:-s\\d+)?\\s*$");
395 re.FullMatch(filename, &file_ext);
399 pcrecpp::RE re(
".*\\.([^\\.]*?)\\s*$");
400 re.FullMatch(filename, &file_ext);
413 std::string file_ext =
"";
417 const std::string stripped_filename = splitFileName<std::string>(filename).second;
418 auto pos = rfind ? stripped_filename.rfind(
".") : stripped_filename.find(
".");
419 if (pos != std::string::npos)
420 file_ext += stripped_filename.substr(pos + 1, std::string::npos);
430 const bool offset = (ext.size() != 0);
432 return s.substr(0, s.size() - ext.size() - offset);
442 constexpr
unsigned int BUF_SIZE = 1024;
443 char buffer[BUF_SIZE];
445 return getcwd(buffer, BUF_SIZE) !=
nullptr ? buffer :
"";
449 makedirs(
const std::string & dir_name,
bool throw_on_failure)
452 std::vector<std::string> split_dir_names;
455 auto n = split_dir_names.size();
462 if (split_dir_names[i] ==
".")
464 for (
auto j = i + 1; j < n; ++j)
465 split_dir_names[j - 1] = split_dir_names[j];
468 else if (i > 0 && split_dir_names[i] ==
".." && split_dir_names[i - 1] !=
"..")
470 for (
auto j = i + 1; j < n; ++j)
471 split_dir_names[j - 2] = split_dir_names[j];
481 split_dir_names.resize(n);
484 std::string cur_dir = dir_name[0] ==
'/' ?
"" :
".";
485 for (
auto & dir : split_dir_names)
487 cur_dir +=
"/" + dir;
491 auto code = Utility::mkdir(cur_dir.c_str());
494 std::string msg =
"Failed creating directory " + dir_name;
495 if (throw_on_failure)
496 throw std::invalid_argument(msg);
505 removedirs(
const std::string & dir_name,
bool throw_on_failure)
508 std::vector<std::string> split_dir_names;
511 auto n = split_dir_names.size();
518 if (split_dir_names[i] ==
".")
520 for (
auto j = i + 1; j < n; ++j)
521 split_dir_names[j - 1] = split_dir_names[j];
524 else if (i > 0 && split_dir_names[i] ==
".." && split_dir_names[i - 1] !=
"..")
526 for (
auto j = i + 1; j < n; ++j)
527 split_dir_names[j - 2] = split_dir_names[j];
537 split_dir_names.resize(n);
540 std::string base_dir = dir_name[0] ==
'/' ?
"" :
".";
541 for (i = n; i > 0; --i)
543 std::string cur_dir = base_dir;
545 for (j = 0; j < i; ++j)
546 cur_dir +=
"/" + split_dir_names[j];
551 auto code = rmdir(cur_dir.c_str());
554 std::string msg =
"Failed removing directory " + dir_name;
555 if (throw_on_failure)
556 throw std::invalid_argument(msg);
570 std::string replaced = camel_case_name;
572 pcrecpp::RE(
"(?!^)(?<![A-Z_])([A-Z]+)").GlobalReplace(
"_\\1", &replaced);
575 std::transform(replaced.begin(), replaced.end(), replaced.begin(), ::tolower);
582 pcrecpp::StringPiece input(underscore_name);
583 pcrecpp::RE re(
"([^_]*)(_|$)");
586 std::string us, not_us;
587 bool make_upper = leading_upper_case;
588 while (re.Consume(&input, ¬_us, &us))
590 if (not_us.length() > 0)
594 result += std::toupper(not_us[0]);
595 if (not_us.length() > 1)
596 result += not_us.substr(1);
614 return name.substr(
name.find_last_of(
'/') != std::string::npos ?
name.find_last_of(
'/') + 1 : 0);
620 return name.substr(0,
name.find_last_of(
'/') != std::string::npos ?
name.find_last_of(
'/') : 0);
633 if (!GetComputerNameEx(ComputerNamePhysicalDnsHostname,
hostname, &dwSize))
647 unsigned short ws_col;
658 char * pps_width = std::getenv(
"MOOSE_PPS_WIDTH");
659 if (pps_width != NULL)
661 std::stringstream ss(pps_width);
671 ioctl(0, TIOCGWINSZ, &w);
692 for (
const auto & elem_it : props)
694 Moose::out <<
"Element " << elem_it.first->id() <<
'\n';
697 for (
const auto & side_it : elem_it.second)
699 Moose::out <<
" Side " << side_it.first <<
'\n';
702 unsigned int cnt = 0;
703 for (
const auto & mat_prop : side_it.second)
707 Moose::out <<
" Property " << cnt <<
'\n';
711 for (
unsigned int qp = 0; qp < mp->size(); ++qp)
712 Moose::out <<
" prop[" << qp <<
"] = " << (*mp)[qp] <<
'\n';
718 Moose::out << std::flush;
724 pcrecpp::RE re(
"(\\33\\[3[0-7]m))", pcrecpp::DOTALL());
725 re.GlobalReplace(std::string(
""), &msg);
731 unsigned int line_width )
733 for (
auto i :
make_range(
int(message.length() / line_width)))
734 message.insert((i + 1) * (line_width + 2) - 2,
"\n");
739 std::string & message,
741 bool indent_first_line,
742 const std::string & post_prefix)
749 std::string colored_message;
750 std::string curr_color = COLOR_DEFAULT;
751 std::string line, color_code;
753 bool ends_in_newline = message.empty() ? true : message.back() ==
'\n';
757 std::istringstream iss(message);
758 for (std::string line; std::getline(iss, line);)
760 const static pcrecpp::RE match_color(
".*(\\33\\[3\\dm)((?!\\33\\[3\\d)[^\n])*");
761 pcrecpp::StringPiece line_piece(line);
762 match_color.FindAndConsume(&line_piece, &color_code);
764 if (!first || indent_first_line)
765 colored_message += color + prefix + post_prefix + curr_color;
767 colored_message += line;
770 if (!iss.eof() || ends_in_newline)
771 colored_message +=
"\n";
773 if (!color_code.empty())
774 curr_color = color_code;
778 message = colored_message;
781 std::list<std::string>
782 listDir(
const std::string path,
bool files_only)
784 std::list<std::string> files;
788 tinydir_open(&dir, path.c_str());
794 tinydir_readfile(&dir, &file);
796 if (!files_only || !file.is_dir)
797 files.push_back(path +
"/" + file.name);
807 std::list<std::string>
808 getFilesInDirs(
const std::list<std::string> & directory_list,
const bool files_only )
810 std::list<std::string> files;
812 for (
const auto & dir_name : directory_list)
813 files.splice(files.end(),
listDir(dir_name, files_only));
824 std::time_t newest_time = 0;
825 std::list<std::string> newest_restart_files;
828 for (
const auto & cp_file : checkpoint_files)
833 stat(cp_file.c_str(), &stats);
835 std::time_t mod_time = stats.st_mtime;
836 if (mod_time > newest_time)
838 newest_restart_files.clear();
839 newest_time = mod_time;
842 if (mod_time == newest_time)
843 newest_restart_files.push_back(cp_file);
848 int max_file_num = -1;
849 std::string max_file;
850 std::string max_prefix;
856 pcrecpp::RE re_file_num(
"(.*?(\\d+))-restart-\\d+.rd$");
859 for (
const auto & res_file : newest_restart_files)
864 std::string file_prefix;
866 re_file_num.FullMatch(res_file, &file_prefix, &file_num);
868 if (file_num > max_file_num)
874 max_file_num = file_num;
876 max_prefix = file_prefix;
881 if (max_file_num == -1)
891 if (search_string ==
"")
896 std::transform(search_string.begin(),
898 search_string.begin(),
899 (
int (*)(
int))std::toupper);
902 if (search_string.find(
"*") == std::string::npos)
903 return search_string ==
name;
906 std::vector<std::string> tokens;
910 for (
unsigned int i = 0; i < tokens.size() && pos != std::string::npos; ++i)
912 pos =
name.find(tokens[i], pos);
914 if (search_string[0] !=
'*' && i == 0 && pos != 0)
918 if (pos != std::string::npos && tokens.size() > 0)
921 size_t last_token_length = tokens.back().length();
922 if (*search_string.rbegin() ==
'*' || pos ==
name.size() - last_token_length)
933 const std::string & pattern,
937 if (p == pattern.size())
938 return c == candidate.size();
940 if (pattern[p] ==
'*')
942 for (; c < candidate.size(); ++c)
948 if (pattern[p] !=
'?' && pattern[p] != candidate[c])
951 return globCompare(candidate, pattern, c + 1, p + 1);
955 stringJoin(
const std::vector<std::string> & values,
const std::string & separator)
957 std::string combined;
958 for (
const auto &
value : values)
959 combined +=
value + separator;
961 combined = combined.substr(0, combined.size() - separator.size());
966 beginsWith(
const std::string & value,
const std::string & begin_value)
968 return value.rfind(begin_value, 0) == 0;
980 return convert<int>(input, throw_on_failure);
991 auto global_num_local_items = num_items / num_chunks;
993 num_local_items = global_num_local_items;
995 auto leftovers = num_items % num_chunks;
997 if (chunk_id < leftovers)
1000 local_items_begin = num_local_items * chunk_id;
1004 (global_num_local_items + 1) * leftovers + global_num_local_items * (chunk_id - leftovers);
1006 local_items_end = local_items_begin + num_local_items;
1012 auto global_num_local_items = num_items / num_chunks;
1014 auto leftovers = num_items % num_chunks;
1016 auto first_item_past_first_part = leftovers * (global_num_local_items + 1);
1019 if (item_id < first_item_past_first_part)
1020 return item_id / (global_num_local_items + 1);
1023 auto new_item_id = item_id - first_item_past_first_part;
1026 return leftovers + (new_item_id / global_num_local_items);
1030 std::vector<std::string>
1033 std::vector<std::string> output;
1034 std::size_t count = 0;
1035 size_t prev = 0, pos = 0;
1039 output.push_back(str.substr(prev, pos - prev));
1042 }
while (pos != std::string::npos && count < max_count);
1044 if (pos != std::string::npos)
1045 output.push_back(str.substr(prev));
1050 std::vector<std::string>
1053 std::vector<std::string> output;
1054 std::size_t count = 0;
1055 size_t prev = str.length(), pos = str.length();
1059 output.insert(output.begin(), str.substr(pos +
delimiter.length(), prev - pos));
1062 }
while (pos != std::string::npos && pos > 0 && count < max_count);
1064 if (pos != std::string::npos)
1065 output.insert(output.begin(), str.substr(0, pos));
1075 auto err = symlink(target.c_str(), link.c_str());
1077 auto err = CreateSymbolicLink(target.c_str(), link.c_str(), 0);
1080 mooseError(
"Failed to create symbolic link (via 'symlink') from ", target,
" to ", link);
1088 if (lstat(link.c_str(), &sbuf) == 0)
1090 auto err = unlink(link.c_str());
1092 mooseError(
"Failed to remove symbolic link (via 'unlink') to ", link);
1095 auto attr = GetFileAttributesA(link.c_str());
1096 if (attr != INVALID_FILE_ATTRIBUTES)
1098 auto err = _unlink(link.c_str());
1100 mooseError(
"Failed to remove link/file (via '_unlink') to ", link);
1110 if (!stat(filename.c_str(), &buffer))
1111 return buffer.st_size;
1113 HANDLE hFile = CreateFile(filename.c_str(),
1115 FILE_SHARE_READ | FILE_SHARE_WRITE,
1118 FILE_ATTRIBUTE_NORMAL,
1120 if (hFile == INVALID_HANDLE_VALUE)
1124 if (GetFileSizeEx(hFile, &size))
1127 return size.QuadPart;
1138 return std::filesystem::absolute(path);
1155 std::string s = cpp_type;
1157 pcrecpp::RE(
"\\s(?=>)").GlobalReplace(
"", &s);
1158 pcrecpp::RE(
"std::__\\w+::").GlobalReplace(
"std::", &s);
1160 pcrecpp::RE(
"\\s*std::basic_string<char, std::char_traits<char>, std::allocator<char>>\\s*")
1161 .GlobalReplace(
"std::string", &s);
1163 pcrecpp::RE r(
"std::vector<([[:print:]]+),\\s?std::allocator<\\s?\\1\\s?>\\s?>");
1164 r.GlobalReplace(
"std::vector<\\1>", &s);
1166 r.GlobalReplace(
"std::vector<\\1>", &s);
1173 return std::filesystem::weakly_canonical(path).c_str();
1177 startsWith(
const std::string & string1,
const std::string & string2)
1179 if (string2.size() > string1.size())
1181 return string1.compare(0, string2.size(), string2) == 0;
1185 replaceStart(std::string & string1,
const std::string & string2,
const std::string & string3)
1188 "Cannot replace the start because it doesn't match the start string");
1189 string1.replace(0, string2.size(), string3);
1196 str.begin(), str.end(), [](
unsigned char c) {
return !std::isalpha(c) || std::islower(c); });
1203 std::string::size_type n = sub.length();
1204 for (std::string::size_type i =
main.find(sub); i != std::string::npos; i =
main.find(sub))
1211 std::string copy_main =
main;
1212 std::string::size_type n = sub.length();
1213 for (std::string::size_type i = copy_main.find(sub); i != std::string::npos;
1214 i = copy_main.find(sub))
1215 copy_main.erase(i, n);
std::string name(const ElemQuality q)
std::string docsDir(const std::string &app_name)
Returns the directory of any installed docs/site.
bool globCompare(const std::string &candidate, const std::string &pattern, std::size_t c=0, std::size_t p=0)
KOKKOS_INLINE_FUNCTION const T * find(const T &target, const T *const begin, const T *const end)
Find a value in an array.
A MultiMooseEnum object to hold "execute_on" flags.
void 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 ...
void tokenize(const std::string &str, std::vector< T > &elements, unsigned int min_len=1, const std::string &delims="/")
This function will split the passed in string on a set of delimiters appending the substrings to the ...
bool beginsWith(const std::string &value, const std::string &begin_value)
HashMap is an abstraction for dictionary data type, we make it thread-safe by locking inserts...
int stringToInteger(const std::string &input, bool throw_on_failure=false)
Robust string to integer conversion that fails for cases such at "1foo".
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
void MaterialPropertyStorageDump(const HashMap< const libMesh::Elem *, HashMap< unsigned int, MaterialProperties >> &props)
Function to dump the contents of MaterialPropertyStorage for debugging purposes.
std::string 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.
std::string getExecutablePath()
Gets the directory the running executable is on Mac OS X and linux.
bool parsesToReal(const std::string &input, Real *parsed_real=nullptr)
Check if the input string can be parsed into a Real.
bool isAllLowercase(const std::string &str)
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
bool startsWith(const std::string &string1, const std::string &string2)
std::list< std::string > 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 rout...
processor_id_type rank() const
void removedirs(const std::string &dir_name, bool throw_on_failure=false)
Recursively remove directories from inner-most when the directories are empty.
void 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.
bool checkForGitLFSPointer(std::ifstream &file)
Check if the file is a Git-LFS pointer.
std::string realpath(const std::string &path)
Wrapper around PetscGetRealPath, which is a cross-platform replacement for realpath.
static ExecFlagRegistry & getExecFlagRegistry()
Return Singleton instance.
std::string convertLatestCheckpoint(std::string orig)
Replaces "LATEST" placeholders with the latest checkpoint file name.
std::string mooseDocsURL(const std::string &path)
Returns the URL of a page located on the MOOSE documentation site.
std::string hostname()
Get the hostname the current process is running on.
auto max(const L &left, const R &right)
std::string camelCaseToUnderscore(const std::string &camel_case_name)
Function for converting a camel case name to a name containing underscores.
std::string shortName(const std::string &name)
Function for stripping name after the file / in parser block.
void removeSubstring(std::string &main, const std::string &sub)
find, erase, length algorithm for removing a substring from a string
std::vector< std::string > 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.
ExecFlagEnum getDefaultExecFlagEnum()
Return the default ExecFlagEnum for MOOSE.
std::string getExtension(const std::string &filename, const bool rfind=false)
Gets the extension of the passed file name.
void replaceStart(std::string &string1, const std::string &string2, const std::string &string3)
Replace the starting string string2 of string1 with string3.
processor_id_type size() const
std::vector< std::string > rsplit(const std::string &str, const std::string &delimiter, std::size_t max_count=std::numeric_limits< std::size_t >::max())
uint8_t processor_id_type
Status receive(const unsigned int dest_processor_id, T &buf, const MessageTag &tag=any_tag) const
std::string stripExtension(const std::string &s, const bool rfind=false)
Removes any file extension from the given string s (i.e.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
void 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.
void parallelBarrierNotify(const libMesh::Parallel::Communicator &comm, bool messaging=true)
This function implements a parallel barrier function but writes progress to stdout.
std::string 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'...
void 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...
std::string canonicalPath(const std::string &path)
Gets the canonical path of the given path.
bool 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)
std::string runTestsExecutable()
Returns the location of either a local repo run_tests script - or an installed test executor script i...
std::size_t fileSize(const std::string &filename)
Check the file size.
std::string underscoreToCamelCase(const std::string &underscore_name, bool leading_upper_case)
Function for converting an underscore name to a camel case name.
bool hasExtension(const std::string &filename, std::string ext, bool strip_exodus_ext=false)
Function tests if the supplied filename as the desired extension.
std::string & removeColor(std::string &msg)
remove ANSI escape sequences for terminal color from msg
bool checkFileWriteable(const std::string &filename, bool throw_on_unwritable=true)
Check if the file is writable (path exists and permissions)
void addLineBreaks(std::string &message, unsigned int line_width)
int main(int argc, char *argv[])
Initialize, create and run a MooseApp.
void clearSymlink(const std::string &link)
Remove a symbolic link, if the given filename is a link.
processor_id_type 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.
void createSymlink(const std::string &target, const std::string &link)
Create a symbolic link, if the link already exists it is replaced.
std::filesystem::path pathjoin(const std::filesystem::path &p)
std::string baseName(const std::string &name)
Function for string the information before the final / in a parser block.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool wildCardMatch(std::string name, std::string search_string)
void send(const unsigned int dest_processor_id, const T &buf, const MessageTag &tag=no_tag) const
IntRange< T > make_range(T beg, T end)
const ExecFlagEnum & getDefaultFlags() const
std::list< std::string > listDir(const std::string path, bool files_only=false)
libMesh::BoundingBox buildBoundingBox(const Point &p1, const Point &p2)
Construct a valid bounding box from 2 arbitrary points.
int levenshteinDist(const std::string &s1, const std::string &s2)
Computes and returns the Levenshtein distance between strings s1 and s2.
std::string getCurrentWorkingDir()
Returns the current working directory as a string.
void makedirs(const std::string &dir_name, bool throw_on_failure=false)
Recursively make directories.
std::string removeExtraWhitespace(const std::string &str)
Removes additional whitespace from a string.
void union_with(const Point &p)
bool 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...
bool pathExists(const std::string &path)
std::string 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.
auto min(const L &left, const R &right)
std::string stringJoin(const std::vector< std::string > &values, const std::string &separator=" ")
Concatenates value into a single string separated by separator.
void ErrorVector unsigned int
void escape(std::string &str)
This function will escape all of the standard C++ escape characters so that they can be printed...
std::string prettyCppType(const std::string &cpp_type)
std::string findTestRoot()
Searches in the current working directory and then recursively up in each parent directory looking fo...
unsigned short getTermWidth(bool use_environment)
Returns the width of the terminal using sys/ioctl.
static bool isAvailable(const std::filesystem::path &folder_base)