24 #include "libmesh/utility.h" 25 #include "libmesh/elem.h" 52 #include <sys/ioctl.h> 76 std::string path =
".";
77 for (
int i = 0; i < 5; i++)
79 auto testroot =
pathjoin(path,
"testroot");
90 std::istringstream ss(input);
92 if (ss >> real_value && ss.eof())
99 const std::string & dir_name,
100 const std::string & extra_error_msg)
105 std::string installed_path =
108 auto test_root =
pathjoin(installed_path,
"testroot");
110 mooseError(
"Couldn't locate any installed inputs to copy in path: ",
116 return installed_path;
127 auto docfile =
pathjoin(installed_path,
"css",
"moose.css");
129 return installed_path;
134 replaceAll(std::string str,
const std::string & from,
const std::string & to)
136 size_t start_pos = 0;
137 while ((start_pos = str.find(from, start_pos)) != std::string::npos)
139 str.replace(start_pos, from.length(), to);
140 start_pos += to.length();
148 auto slash_pos = orig.find_last_of(
"/");
149 auto path = orig.substr(0, slash_pos);
150 auto file = orig.substr(slash_pos + 1);
151 if (file !=
"LATEST")
156 if (converted.empty())
157 mooseError(
"Unable to find suitable recovery file!");
169 auto s1len = s1.size();
170 auto s2len = s2.size();
172 auto column_start = (decltype(s1len))1;
174 auto column =
new decltype(s1len)[s1len + 1];
175 std::iota(column + column_start, column + s1len + 1, column_start);
177 for (
auto x = column_start; x <= s2len; x++)
180 auto last_diagonal = x - column_start;
181 for (
auto y = column_start; y <= s1len; y++)
183 auto old_diagonal = column[y];
184 auto possibilities = {
185 column[y] + 1, column[y - 1] + 1, last_diagonal + (s1[y - 1] == s2[x - 1] ? 0 : 1)};
186 column[y] =
std::min(possibilities);
187 last_diagonal = old_diagonal;
190 auto result = column[s1len];
198 std::map<char, std::string> escapes;
199 escapes[
'\a'] =
"\\a";
200 escapes[
'\b'] =
"\\b";
201 escapes[
'\f'] =
"\\f";
202 escapes[
'\n'] =
"\\n";
203 escapes[
'\t'] =
"\\t";
204 escapes[
'\v'] =
"\\v";
205 escapes[
'\r'] =
"\\r";
207 for (
const auto & it : escapes)
208 for (
size_t pos = 0; (pos = str.find(it.first, pos)) != std::string::npos;
209 pos += it.second.size())
210 str.replace(pos, 1, it.second);
214 trim(
const std::string & str,
const std::string & white_space)
216 const auto begin = str.find_first_not_of(white_space);
217 if (begin == std::string::npos)
219 const auto end = str.find_last_not_of(white_space);
220 return str.substr(begin, end - begin + 1);
225 const std::string & string_to_find,
226 const std::string & delims)
228 std::vector<std::string> elements;
229 tokenize(expression, elements, 0, delims);
231 std::vector<std::string>::iterator found_it =
232 std::find(elements.begin(), elements.end(), string_to_find);
233 if (found_it != elements.end())
243 return (stat(path.c_str(), &buffer) == 0);
249 return std::filesystem::is_directory(path);
254 bool check_line_endings,
255 bool throw_on_unreadable,
256 bool check_for_git_lfs_pointer)
258 std::ifstream in(filename.c_str(), std::ifstream::in);
261 if (throw_on_unreadable)
263 (std::string(
"Unable to open file \"") + filename +
264 std::string(
"\". Check to make sure that it exists and that you have read permission."))
270 if (check_line_endings)
272 std::istream_iterator<char> iter(in);
273 std::istream_iterator<char> eos;
277 mooseError(filename +
" contains Windows(DOS) line endings which are not supported.");
281 mooseError(filename +
" appears to be a Git-LFS pointer. Make sure you have \"git-lfs\" " 282 "installed so that you may pull this file.");
291 mooseAssert(file.is_open(),
"Passed in file handle is not open");
298 std::getline(file, line);
299 if (line.find(
"version https://") != std::string::npos)
308 std::ofstream
out(filename.c_str(), std::ios_base::app);
311 if (throw_on_unwritable)
313 (std::string(
"Unable to open file \"") + filename +
314 std::string(
"\". Check to make sure that it exists and that you have write permission."))
331 Moose::out <<
"Waiting For Other Processors To Finish" << std::endl;
332 if (comm.rank() == 0)
336 Moose::out <<
"Jobs complete: 1/" << comm.size() << (1 == comm.size() ?
"\n" :
"\r")
338 for (
unsigned int i = 2; i <= comm.size(); ++i)
340 comm.receive(MPI_ANY_SOURCE, secondary_processor_id);
342 Moose::out <<
"Jobs complete: " << i <<
"/" << comm.size()
343 << (i == comm.size() ?
"\n" :
"\r") << std::flush;
348 secondary_processor_id = comm.rank();
349 comm.send(0, secondary_processor_id);
366 mooseWarning(
"Entering serial execution block (use only for debugging)");
381 if (comm.
rank() == 0 && warn)
382 mooseWarning(
"Leaving serial execution block (use only for debugging)");
386 hasExtension(
const std::string & filename, std::string ext,
bool strip_exodus_ext)
389 std::string file_ext;
390 if (strip_exodus_ext)
393 ".*\\.([^\\.]*?)(?:-s\\d+)?\\s*$");
394 re.FullMatch(filename, &file_ext);
398 pcrecpp::RE re(
".*\\.([^\\.]*?)\\s*$");
399 re.FullMatch(filename, &file_ext);
412 auto pos = s.rfind(
".");
413 if (pos != std::string::npos)
414 return s.substr(0, pos);
425 constexpr
unsigned int BUF_SIZE = 1024;
426 char buffer[BUF_SIZE];
428 return getcwd(buffer, BUF_SIZE) !=
nullptr ? buffer :
"";
432 makedirs(
const std::string & dir_name,
bool throw_on_failure)
435 std::vector<std::string> split_dir_names;
438 auto n = split_dir_names.size();
445 if (split_dir_names[i] ==
".")
447 for (
auto j = i + 1; j < n; ++j)
448 split_dir_names[j - 1] = split_dir_names[j];
451 else if (i > 0 && split_dir_names[i] ==
".." && split_dir_names[i - 1] !=
"..")
453 for (
auto j = i + 1; j < n; ++j)
454 split_dir_names[j - 2] = split_dir_names[j];
464 split_dir_names.resize(n);
467 std::string cur_dir = dir_name[0] ==
'/' ?
"" :
".";
468 for (
auto & dir : split_dir_names)
470 cur_dir +=
"/" + dir;
474 auto code = Utility::mkdir(cur_dir.c_str());
477 std::string msg =
"Failed creating directory " + dir_name;
478 if (throw_on_failure)
479 throw std::invalid_argument(msg);
488 removedirs(
const std::string & dir_name,
bool throw_on_failure)
491 std::vector<std::string> split_dir_names;
494 auto n = split_dir_names.size();
501 if (split_dir_names[i] ==
".")
503 for (
auto j = i + 1; j < n; ++j)
504 split_dir_names[j - 1] = split_dir_names[j];
507 else if (i > 0 && split_dir_names[i] ==
".." && split_dir_names[i - 1] !=
"..")
509 for (
auto j = i + 1; j < n; ++j)
510 split_dir_names[j - 2] = split_dir_names[j];
520 split_dir_names.resize(n);
523 std::string base_dir = dir_name[0] ==
'/' ?
"" :
".";
524 for (i = n; i > 0; --i)
526 std::string cur_dir = base_dir;
528 for (j = 0; j < i; ++j)
529 cur_dir +=
"/" + split_dir_names[j];
534 auto code = rmdir(cur_dir.c_str());
537 std::string msg =
"Failed removing directory " + dir_name;
538 if (throw_on_failure)
539 throw std::invalid_argument(msg);
553 std::string replaced = camel_case_name;
555 pcrecpp::RE(
"(?!^)(?<![A-Z_])([A-Z]+)").GlobalReplace(
"_\\1", &replaced);
558 std::transform(replaced.begin(), replaced.end(), replaced.begin(), ::tolower);
565 pcrecpp::StringPiece input(underscore_name);
566 pcrecpp::RE re(
"([^_]*)(_|$)");
569 std::string us, not_us;
570 bool make_upper = leading_upper_case;
571 while (re.Consume(&input, ¬_us, &us))
573 if (not_us.length() > 0)
577 result += std::toupper(not_us[0]);
578 if (not_us.length() > 1)
579 result += not_us.substr(1);
597 return name.substr(
name.find_last_of(
'/') != std::string::npos ?
name.find_last_of(
'/') + 1 : 0);
603 return name.substr(0,
name.find_last_of(
'/') != std::string::npos ?
name.find_last_of(
'/') : 0);
616 if (!GetComputerNameEx(ComputerNamePhysicalDnsHostname,
hostname, &dwSize))
630 unsigned short ws_col;
641 char * pps_width = std::getenv(
"MOOSE_PPS_WIDTH");
642 if (pps_width != NULL)
644 std::stringstream ss(pps_width);
654 ioctl(0, TIOCGWINSZ, &w);
675 for (
const auto & elem_it : props)
677 Moose::out <<
"Element " << elem_it.first->id() <<
'\n';
680 for (
const auto & side_it : elem_it.second)
682 Moose::out <<
" Side " << side_it.first <<
'\n';
685 unsigned int cnt = 0;
686 for (
const auto & mat_prop : side_it.second)
690 Moose::out <<
" Property " << cnt <<
'\n';
694 for (
unsigned int qp = 0; qp < mp->size(); ++qp)
695 Moose::out <<
" prop[" << qp <<
"] = " << (*mp)[qp] <<
'\n';
701 Moose::out << std::flush;
707 pcrecpp::RE re(
"(\\33\\[3[0-7]m))", pcrecpp::DOTALL());
708 re.GlobalReplace(std::string(
""), &msg);
714 unsigned int line_width )
716 for (
auto i :
make_range(
int(message.length() / line_width)))
717 message.insert((i + 1) * (line_width + 2) - 2,
"\n");
722 std::string & message,
724 bool indent_first_line,
725 const std::string & post_prefix)
732 std::string colored_message;
733 std::string curr_color = COLOR_DEFAULT;
734 std::string line, color_code;
736 bool ends_in_newline = message.empty() ? true : message.back() ==
'\n';
740 std::istringstream iss(message);
741 for (std::string line; std::getline(iss, line);)
743 const static pcrecpp::RE match_color(
".*(\\33\\[3\\dm)((?!\\33\\[3\\d)[^\n])*");
744 pcrecpp::StringPiece line_piece(line);
745 match_color.FindAndConsume(&line_piece, &color_code);
747 if (!first || indent_first_line)
748 colored_message += color + prefix + post_prefix + curr_color;
750 colored_message += line;
753 if (!iss.eof() || ends_in_newline)
754 colored_message +=
"\n";
756 if (!color_code.empty())
757 curr_color = color_code;
761 message = colored_message;
764 std::list<std::string>
765 listDir(
const std::string path,
bool files_only)
767 std::list<std::string> files;
771 tinydir_open(&dir, path.c_str());
777 tinydir_readfile(&dir, &file);
779 if (!files_only || !file.is_dir)
780 files.push_back(path +
"/" + file.name);
790 std::list<std::string>
791 getFilesInDirs(
const std::list<std::string> & directory_list,
const bool files_only )
793 std::list<std::string> files;
795 for (
const auto & dir_name : directory_list)
796 files.splice(files.end(),
listDir(dir_name, files_only));
807 std::time_t newest_time = 0;
808 std::list<std::string> newest_restart_files;
811 for (
const auto & cp_file : checkpoint_files)
816 stat(cp_file.c_str(), &stats);
818 std::time_t mod_time = stats.st_mtime;
819 if (mod_time > newest_time)
821 newest_restart_files.clear();
822 newest_time = mod_time;
825 if (mod_time == newest_time)
826 newest_restart_files.push_back(cp_file);
831 int max_file_num = -1;
832 std::string max_file;
833 std::string max_prefix;
839 pcrecpp::RE re_file_num(
"(.*?(\\d+))-restart-\\d+.rd$");
842 for (
const auto & res_file : newest_restart_files)
847 std::string file_prefix;
849 re_file_num.FullMatch(res_file, &file_prefix, &file_num);
851 if (file_num > max_file_num)
857 max_file_num = file_num;
859 max_prefix = file_prefix;
864 if (max_file_num == -1)
874 if (search_string ==
"")
879 std::transform(search_string.begin(),
881 search_string.begin(),
882 (
int (*)(
int))std::toupper);
885 if (search_string.find(
"*") == std::string::npos)
886 return search_string ==
name;
889 std::vector<std::string> tokens;
893 for (
unsigned int i = 0; i < tokens.size() && pos != std::string::npos; ++i)
895 pos =
name.find(tokens[i], pos);
897 if (search_string[0] !=
'*' && i == 0 && pos != 0)
901 if (pos != std::string::npos && tokens.size() > 0)
904 size_t last_token_length = tokens.back().length();
905 if (*search_string.rbegin() ==
'*' || pos ==
name.size() - last_token_length)
916 const std::string & pattern,
920 if (p == pattern.size())
921 return c == candidate.size();
923 if (pattern[p] ==
'*')
925 for (; c < candidate.size(); ++c)
931 if (pattern[p] !=
'?' && pattern[p] != candidate[c])
934 return globCompare(candidate, pattern, c + 1, p + 1);
937 template <
typename T>
945 long double double_val;
946 std::stringstream double_ss(str);
947 double_ss >> double_val;
950 bool use_int =
false;
951 std::stringstream int_ss(str);
952 if (!(int_ss >> val).fail() && int_ss.eof())
955 if (double_ss.fail() || !double_ss.eof())
958 std::string(
"Unable to convert '") + str +
"' to type " +
demangle(
typeid(T).
name());
960 if (throw_on_failure)
961 throw std::invalid_argument(msg);
967 if (double_val == static_cast<T>(double_val))
968 return use_int ? val :
static_cast<T
>(double_val);
972 std::string(
"Unable to convert '") + str +
"' to type " +
demangle(
typeid(T).
name());
974 if (throw_on_failure)
975 throw std::invalid_argument(msg);
984 return convertStringToInt<short int>(str, throw_on_failure);
991 return convertStringToInt<unsigned short int>(str, throw_on_failure);
998 return convertStringToInt<int>(str, throw_on_failure);
1005 return convertStringToInt<unsigned int>(str, throw_on_failure);
1012 return convertStringToInt<long int>(str, throw_on_failure);
1019 return convertStringToInt<unsigned long int>(str, throw_on_failure);
1026 return convertStringToInt<long long int>(str, throw_on_failure);
1030 unsigned long long int 1033 return convertStringToInt<unsigned long long int>(str, throw_on_failure);
1039 std::string upper(
name);
1040 std::transform(upper.begin(), upper.end(), upper.begin(), ::toupper);
1047 std::string lower(
name);
1048 std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
1072 auto global_num_local_items = num_items / num_chunks;
1074 num_local_items = global_num_local_items;
1076 auto leftovers = num_items % num_chunks;
1078 if (chunk_id < leftovers)
1081 local_items_begin = num_local_items * chunk_id;
1085 (global_num_local_items + 1) * leftovers + global_num_local_items * (chunk_id - leftovers);
1087 local_items_end = local_items_begin + num_local_items;
1093 auto global_num_local_items = num_items / num_chunks;
1095 auto leftovers = num_items % num_chunks;
1097 auto first_item_past_first_part = leftovers * (global_num_local_items + 1);
1100 if (item_id < first_item_past_first_part)
1101 return item_id / (global_num_local_items + 1);
1104 auto new_item_id = item_id - first_item_past_first_part;
1107 return leftovers + (new_item_id / global_num_local_items);
1111 std::vector<std::string>
1114 std::vector<std::string> output;
1115 std::size_t count = 0;
1116 size_t prev = 0, pos = 0;
1120 output.push_back(str.substr(prev, pos - prev));
1123 }
while (pos != std::string::npos && count < max_count);
1125 if (pos != std::string::npos)
1126 output.push_back(str.substr(prev));
1131 std::vector<std::string>
1134 std::vector<std::string> output;
1135 std::size_t count = 0;
1136 size_t prev = str.length(), pos = str.length();
1140 output.insert(output.begin(), str.substr(pos +
delimiter.length(), prev - pos));
1143 }
while (pos != std::string::npos && pos > 0 && count < max_count);
1145 if (pos != std::string::npos)
1146 output.insert(output.begin(), str.substr(0, pos));
1156 auto err = symlink(target.c_str(), link.c_str());
1158 auto err = CreateSymbolicLink(target.c_str(), link.c_str(), 0);
1161 mooseError(
"Failed to create symbolic link (via 'symlink') from ", target,
" to ", link);
1169 if (lstat(link.c_str(), &sbuf) == 0)
1171 auto err = unlink(link.c_str());
1173 mooseError(
"Failed to remove symbolic link (via 'unlink') to ", link);
1176 auto attr = GetFileAttributesA(link.c_str());
1177 if (attr != INVALID_FILE_ATTRIBUTES)
1179 auto err = _unlink(link.c_str());
1181 mooseError(
"Failed to remove link/file (via '_unlink') to ", link);
1191 if (!stat(filename.c_str(), &buffer))
1192 return buffer.st_size;
1194 HANDLE hFile = CreateFile(filename.c_str(),
1196 FILE_SHARE_READ | FILE_SHARE_WRITE,
1199 FILE_ATTRIBUTE_NORMAL,
1201 if (hFile == INVALID_HANDLE_VALUE)
1205 if (GetFileSizeEx(hFile, &size))
1208 return size.QuadPart;
1219 return std::filesystem::absolute(path);
1236 std::string s = cpp_type;
1238 pcrecpp::RE(
"\\s(?=>)").GlobalReplace(
"", &s);
1239 pcrecpp::RE(
"std::__\\w+::").GlobalReplace(
"std::", &s);
1241 pcrecpp::RE(
"\\s*std::basic_string<char, std::char_traits<char>, std::allocator<char>>\\s*")
1242 .GlobalReplace(
"std::string", &s);
1244 pcrecpp::RE r(
"std::vector<([[:print:]]+),\\s?std::allocator<\\s?\\1\\s?>\\s?>");
1245 r.GlobalReplace(
"std::vector<\\1>", &s);
1247 r.GlobalReplace(
"std::vector<\\1>", &s);
1255 std::string::size_type n = sub.length();
1256 for (std::string::size_type i =
main.find(sub); i != std::string::npos; i =
main.find(sub))
1263 std::string copy_main =
main;
1264 std::string::size_type n = sub.length();
1265 for (std::string::size_type i = copy_main.find(sub); i != std::string::npos;
1266 i = copy_main.find(sub))
1267 copy_main.erase(i, n);
std::string name(const ElemQuality q)
bool parsesToReal(const std::string &input)
Check if the input string can be parsed into a Real.
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)
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 ...
std::string toLower(const std::string &name)
Convert supplied string to lower case.
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 ...
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".
std::string toUpper(const std::string &name)
Convert supplied string to upper case.
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()
This function returns the PATH of the running executable.
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
bool pathIsDirectory(const std::string &path)
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
std::string stripExtension(const std::string &s)
Removes any file extension from the given string s (i.e.
void removedirs(const std::string &dir_name, bool throw_on_failure=false)
Recursively remove directories from inner-most when the directories are empty.
void main(int argc, char *argv[])
Initialize, create and run a MooseApp.
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 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.
T convertStringToInt(const std::string &str, bool throw_on_failure)
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
int convert< int >(const std::string &str, bool throw_on_failure)
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 begining) If a suitable file isn't...
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...
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 trim(const std::string &str, const std::string &white_space=" \\\)
Standard scripting language trim function.
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.
unsigned int convert< unsigned int >(const std::string &str, bool throw_on_failure)
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
std::string demangle(const char *name)
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)
void clearSymlink(const std::string &link)
Remove a symbolic link, if the given filename is a link.
long long int convert< long long int >(const std::string &str, bool throw_on_failure)
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.
short int convert< short int >(const std::string &str, bool throw_on_failure)
std::filesystem::path pathjoin(const std::filesystem::path &p)
unsigned long int convert< unsigned long int >(const std::string &str, bool throw_on_failure)
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)
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.
long int convert< long int >(const std::string &str, bool throw_on_failure)
unsigned short int convert< unsigned short int >(const std::string &str, bool throw_on_failure)
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 occurences of from in str with to and returns the result.
auto min(const L &left, const R &right)
unsigned long long int convert< unsigned long long int >(const std::string &str, bool throw_on_failure)
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)