3 #include <AMReX_Config.H>
30 #include <type_traits>
42 template <
typename T>
bool is_it (std::string
const& s, T& v);
45 const std::vector<std::string>&
Tokenize (
const std::string& instr,
46 const std::string& separators);
90 bool callbarrier =
true);
98 bool callbarrier =
true);
102 bool callbarrier =
true);
153 const Vector<int> &refratios);
162 explicit expect (std::string str_);
163 explicit expect (
const char* istr_);
165 [[nodiscard]]
const std::string&
the_string( )
const;
174 StreamRetry(std::string filename,
bool abortonretryfailure,
int maxtries);
202 template <
typename T> Long
bytesOf (
const std::vector<T>& v);
203 template <
typename Key,
typename T,
class Compare> Long
bytesOf (
const std::map<Key,T,Compare>& m);
212 void Sleep (
double sleepsec);
216 std::chrono::high_resolution_clock,
217 std::chrono::steady_clock>;
218 double second () noexcept;
220 template<typename T>
void hash_combine (uint64_t & seed, const T & val) noexcept;
221 template<typename T> uint64_t
hash_vector (const
Vector<T> & vec, uint64_t seed = 0xDEADBEEFDEADBEEF) noexcept;
225 template <typename T>
228 std::istringstream ss(s);
231 std::getline(ss, left);
241 if(myLocalId == rootId) {
246 if(myLocalId != rootId) {
266 #define BL_LANG_FORT 1
269 #ifdef BL_FORT_USE_UNDERSCORE
270 #undef BL_FORT_USE_UNDERSCORE
279 #define BL_FORT_USE_UNDERSCORE 1
282 #ifdef BL_FORT_USE_UPPERCASE
283 #undef BL_FORT_USE_UPPERCASE
292 #define BL_FORT_USE_UPPERCASE 1
295 #ifdef BL_FORT_USE_LOWERCASE
296 #undef BL_FORT_USE_LOWERCASE
305 #define BL_FORT_USE_LOWERCASE 1
317 #define BL_IGNORE_MAX 100000
320 template <
typename T>
324 return sizeof(v) + v.capacity()*
sizeof(T);
327 template <
typename Key,
typename T,
class Compare>
370 seed ^= std::hash<T>()(val) + 0x9e3779b9 + (seed<<6) + (seed>>2);
377 for (
const auto &
x: vec) {
#define BL_ASSERT(EX)
Definition: AMReX_BLassert.H:39
void amrex_free(void *p)
Definition: AMReX_Utility.cpp:936
void * amrex_malloc(std::size_t size)
Definition: AMReX_Utility.cpp:930
int MPI_Comm
Definition: AMReX_ccse-mpi.H:47
Definition: AMReX_Utility.H:171
std::ostream::pos_type spos
Definition: AMReX_Utility.H:185
bool TryFileOutput()
Definition: AMReX_Utility.cpp:632
int maxTries
Definition: AMReX_Utility.H:181
static void ClearStreamErrors()
Definition: AMReX_Utility.H:178
std::string fileName
Definition: AMReX_Utility.H:183
static int nStreamErrors
Definition: AMReX_Utility.H:188
StreamRetry(std::ostream &os, std::string suffix, int maxtries)
Definition: AMReX_Utility.cpp:565
std::string suffix
Definition: AMReX_Utility.H:186
bool abortOnRetryFailure
Definition: AMReX_Utility.H:182
int tries
Definition: AMReX_Utility.H:181
bool TryOutput()
Definition: AMReX_Utility.cpp:581
static int NStreamErrors()
Definition: AMReX_Utility.H:177
std::ostream * sros
Definition: AMReX_Utility.H:184
Long size() const noexcept
Definition: AMReX_Vector.H:50
T * dataPtr() noexcept
get access to the underlying data pointer
Definition: AMReX_Vector.H:46
Definition: AMReX_Utility.H:159
friend std::istream & operator>>(std::istream &, const expect &exp)
std::string istr
Definition: AMReX_Utility.H:167
expect(std::string str_)
Definition: AMReX_Utility.cpp:542
const std::string & the_string() const
Definition: AMReX_Utility.cpp:553
std::tuple< IntVectND< 3 >, Direction, Kind > Key
Definition: AMReX_FFT_Helper.H:1132
AMREX_GPU_HOST_DEVICE Long size(T const &b) noexcept
integer version
Definition: AMReX_GpuRange.H:26
void Bcast(void *, int, MPI_Datatype, int, MPI_Comm)
Definition: AMReX_ParallelDescriptor.cpp:1282
Definition: AMReX_Amr.cpp:49
void SyncStrings(const Vector< std::string > &localStrings, Vector< std::string > &syncedStrings, bool &alreadySynced)
Definition: AMReX_Utility.cpp:677
double InvNormDistBest(double p)
This function returns an approximation of the inverse cumulative standard normal distribution functio...
Definition: AMReX_Utility.cpp:393
void FileOpenFailed(const std::string &file)
Output a message and abort when couldn't open the file.
Definition: AMReX_Utility.cpp:131
bool is_integer(const char *str)
Useful C++ Utility Functions.
Definition: AMReX_Utility.cpp:35
int CRRBetweenLevels(int fromlevel, int tolevel, const Vector< int > &refratios)
Definition: AMReX_Utility.cpp:238
void BroadcastStringArray(Vector< std::string > &bSA, int myLocalId, int rootId, const MPI_Comm &localComm)
Definition: AMReX_Utility.cpp:899
Vector< std::string > UnSerializeStringArray(const Vector< char > &charArray)
Definition: AMReX_Utility.cpp:853
std::conditional_t< std::chrono::high_resolution_clock::is_steady, std::chrono::high_resolution_clock, std::chrono::steady_clock > MaxResSteadyClock
Definition: AMReX_Utility.H:217
bool FileExists(const std::string &filename)
Check if a file already exists. Return true if the filename is an existing file, directory,...
Definition: AMReX_Utility.cpp:139
bool is_it(std::string const &s, T &v)
Return true and store value in v if string s is type T.
Definition: AMReX_Utility.H:226
const std::vector< std::string > & Tokenize(const std::string &instr, const std::string &separators)
Splits "instr" into separate pieces based on "separators".
Definition: AMReX_Utility.cpp:61
double second() noexcept
Definition: AMReX_Utility.cpp:922
uint64_t hash_vector(const Vector< T > &vec, uint64_t seed=0xDEADBEEFDEADBEEF) noexcept
Definition: AMReX_Utility.H:375
Long bytesOf(const std::vector< T > &v)
void UtilCreateCleanDirectory(const std::string &path, bool callbarrier=true)
Create a new directory, renaming the old one if it exists.
Definition: AMReX_Utility.cpp:161
void CreateDirectoryFailed(const std::string &dir)
Output a message and abort when couldn't create the directory.
Definition: AMReX_Utility.cpp:123
void BroadcastArray(Vector< T > &aT, int myLocalId, int rootId, const MPI_Comm &localComm)
Definition: AMReX_Utility.H:238
bool UtilCreateDirectory(const std::string &path, mode_t mode, bool verbose=false)
Creates the specified directories. path may be either a full pathname or a relative pathname....
Definition: AMReX_Utility.cpp:116
void BroadcastString(std::string &bStr, int myLocalId, int rootId, const MPI_Comm &localComm)
Definition: AMReX_Utility.cpp:883
Vector< char > SerializeStringArray(const Vector< std::string > &stringArray)
Definition: AMReX_Utility.cpp:839
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex< T > exp(const GpuComplex< T > &a_z) noexcept
Complex expotential function.
Definition: AMReX_GpuComplex.H:334
void hash_combine(uint64_t &seed, const T &val) noexcept
Definition: AMReX_Utility.H:368
int verbose
Definition: AMReX_DistributionMapping.cpp:36
void Sleep(double sleepsec)
Definition: AMReX_Utility.cpp:913
void UtilRenameDirectoryToOld(const std::string &path, bool callbarrier=true)
Rename a current directory if it exists.
Definition: AMReX_Utility.cpp:211
static const Long gcc_map_node_extra_bytes
Definition: AMReX_Utility.H:201
double InvNormDist(double p)
This function returns an approximation of the inverse cumulative standard normal distribution functio...
Definition: AMReX_Utility.cpp:272
void UtilCreateDirectoryDestructive(const std::string &path, bool callbarrier=true)
Definition: AMReX_Utility.cpp:186
std::string UniqueString()
Create a (probably) unique string.
Definition: AMReX_Utility.cpp:145
std::istream & operator>>(std::istream &is, BoxND< dim > &bx)
Read from istream.
Definition: AMReX_Box.H:1700
void BroadcastBool(bool &bBool, int myLocalId, int rootId, const MPI_Comm &localComm)
Definition: AMReX_Utility.cpp:868
void OutOfMemory()
Aborts after printing message indicating out-of-memory; i.e. operator new has failed....
Definition: AMReX_Utility.cpp:232