27 #include <unordered_set>
28 #include <unordered_map>
48 void copyDoubleArray3D(
double *copy ,
const double *source ,
const int start = 0 ,
const int end = 3 );
50 template<
typename T >
60 for(
const T &element : vec ){
69 template <
typename T ,
size_t N >
77 for(
size_t i = 0; i < N; ++i ) {
78 vec.push_back( arr[i] );
92 if( start > vec.size() || end > vec.size() || start > end ) {
93 allAbortWithMessage( MPI_COMM_WORLD ,
"Invalid range used in getSubVectorFromVector in utilities.h." );
97 std::vector< T > sub_vector( vec.begin( ) + start , vec.begin( ) + end );
102 template <
typename T ,
typename Hash >
111 return set.count( element ) > 0;
116 template<
typename KeyType ,
typename ValueType ,
typename Hash >
117 bool mappingExists(
const std::unordered_map< KeyType , ValueType , Hash > &map,
const KeyType &key ) {
125 return map.count( key ) > 0;
130 template <
typename T >
139 return std::find( vec.begin( ), vec.end( ), element ) != vec.end();
147 const int getStringPosInStringVec(
const std::string &string2check ,
const std::vector< std::string > &strings );
164 inline std::size_t
operator()(
const std::pair<int,int> & v)
const {
165 return v.first*31+v.second;
176 typedef std::unordered_set< INT_PAIR , PairHash >
PAIR_SET;
bool mappingExists(const std::unordered_map< KeyType, ValueType, Hash > &map, const KeyType &key)
Definition: utilities.h:117
const double string2Double(std::string &string)
Definition: utilities.cpp:246
std::unordered_map< int, INT2INT_MAP > INT2INTSMAP_MAP
Definition: utilities.h:182
const bool stringIsBool(const std::string &string)
Definition: utilities.cpp:190
const unsigned long int string2UnsignedLongInt(std::string &string)
Definition: utilities.cpp:200
std::unordered_set< int > INT_SET
Definition: utilities.h:183
double doubleArrSum(double *arr, const int &size)
Definition: utilities.cpp:27
std::unordered_set< INT_PAIR, PairHash > PAIR_SET
Definition: utilities.h:176
const int getStringPosInStringVec(const std::string &string2check, const std::vector< std::string > &strings)
Definition: utilities.cpp:141
bool stringIsIntNumber(const std::string &string)
Definition: utilities.cpp:175
std::unordered_map< INT_PAIR, int, PairHash > INTPAIR2INT_MAP
Definition: utilities.h:179
const int boolString2Int(std::string &string)
Definition: utilities.cpp:289
void pushArrayToVector(const T *arr, std::vector< T > &vec)
Definition: utilities.h:70
std::vector< DOUBLE2INTPAIR > DOUBLE2INTPAIR_VEC
Definition: utilities.h:192
std::unordered_set< LAMMPS_NS::tagint > TAGINT_SET
Definition: utilities.h:185
const bool string2Bool(std::string &string)
Definition: utilities.cpp:269
bool elementIsInVector(const std::vector< T > &vec, const T &element)
Definition: utilities.h:131
const std::string getConcatenatedStringWithSpacesFromStringsVector(const std::vector< std::string > &strings, size_t start=-1, size_t end=-1)
Definition: utilities.cpp:101
void copyDoubleArray3D(double *copy, const double *source, const int start, const int end)
Definition: utilities.cpp:46
std::unordered_map< int, int > INT2INT_MAP
Definition: utilities.h:181
std::pair< double, int > DOUBLE2INTPAIR
Definition: utilities.h:191
bool elementIsInUnorderedSet(const std::unordered_set< T, Hash > &set, const T &element)
Definition: utilities.h:103
const std::string getConcatenatedStringFromStringsVector(const std::vector< std::string > &strings, size_t start=-1, size_t end=-1)
Definition: utilities.cpp:64
std::pair< int, int > INT_PAIR
Definition: utilities.h:175
std::vector< T > getSubVectorFromVector(const std::vector< T > &vec, size_t start, size_t end)
Definition: utilities.h:84
std::unordered_map< INT_PAIR, double, PairHash > INTPAIR2DOUBLE_MAP
Definition: utilities.h:178
const int string2Int(std::string &string)
Definition: utilities.cpp:223
bool stringIsNumber(const std::string &string)
Definition: utilities.cpp:161
void allAbortWithMessage(MPI_Comm communicator, const std::string &message)
Definition: papreca_error.cpp:62
T getSumOfVecElements(const std::vector< T > &vec)
Definition: utilities.h:51
std::array< double, 3 > ARRAY3D
Definition: utilities.h:188
Functions that enable the communication of error/warning messages to the terminal and coordinate the ...
Utility hash function (struct) for custom typedefs.
Definition: utilities.h:158
std::size_t operator()(const std::pair< int, int > &v) const
Definition: utilities.h:164