Reference documentation for deal.II version Git 10f3285 2019-01-18 22:14:04 -0700
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
utilities.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2005 - 2018 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_utilities_h
17 #define dealii_utilities_h
18 
19 #include <deal.II/base/config.h>
20 
21 #include <deal.II/base/exceptions.h>
22 
23 #include <functional>
24 #include <string>
25 #include <tuple>
26 #include <type_traits>
27 #include <utility>
28 #include <vector>
29 
30 #ifdef DEAL_II_WITH_TRILINOS
31 # include <Epetra_Comm.h>
32 # include <Epetra_Map.h>
33 # ifdef DEAL_II_WITH_MPI
34 # include <Epetra_MpiComm.h>
35 # else
36 # include <Epetra_SerialComm.h>
37 # endif
38 #endif
39 
40 #include <boost/archive/binary_iarchive.hpp>
41 #include <boost/archive/binary_oarchive.hpp>
42 #include <boost/serialization/array.hpp>
43 #include <boost/serialization/complex.hpp>
44 #include <boost/serialization/vector.hpp>
45 
46 #ifdef DEAL_II_WITH_ZLIB
47 # include <boost/iostreams/device/back_inserter.hpp>
48 # include <boost/iostreams/filter/gzip.hpp>
49 # include <boost/iostreams/filtering_stream.hpp>
50 # include <boost/iostreams/stream.hpp>
51 #endif
52 
53 DEAL_II_NAMESPACE_OPEN
54 
55 // forward declare Point
56 template <int dim, typename Number>
57 class Point;
58 
67 namespace Utilities
68 {
75  std::string
77 
91  template <int dim, typename Number>
92  std::vector<std::array<std::uint64_t, dim>>
94  const std::vector<Point<dim, Number>> &points,
95  const int bits_per_dim = 64);
96 
100  template <int dim>
101  std::vector<std::array<std::uint64_t, dim>>
103  const std::vector<std::array<std::uint64_t, dim>> &points,
104  const int bits_per_dim = 64);
105 
121  template <int dim>
122  std::uint64_t
123  pack_integers(const std::array<std::uint64_t, dim> &index,
124  const int bits_per_dim);
125 
142  std::string
143  int_to_string(const unsigned int value,
144  const unsigned int digits = numbers::invalid_unsigned_int);
145 
156  template <typename number>
157  std::string
158  to_string(const number value,
159  const unsigned int digits = numbers::invalid_unsigned_int);
160 
165  unsigned int
166  needed_digits(const unsigned int max_number);
167 
172  int
173  string_to_int(const std::string &s);
174 
186  std::string
187  dim_string(const int dim, const int spacedim);
188 
193  std::vector<int>
194  string_to_int(const std::vector<std::string> &s);
195 
200  double
201  string_to_double(const std::string &s);
202 
203 
208  std::vector<double>
209  string_to_double(const std::vector<std::string> &s);
210 
211 
254  std::vector<std::string>
255  split_string_list(const std::string &s, const std::string &delimiter = ",");
256 
257 
262  std::vector<std::string>
263  split_string_list(const std::string &s, const char delimiter);
264 
265 
275  std::vector<std::string>
276  break_text_into_lines(const std::string &original_text,
277  const unsigned int width,
278  const char delimiter = ' ');
279 
284  bool
285  match_at_string_start(const std::string &name, const std::string &pattern);
286 
295  std::pair<int, unsigned int>
296  get_integer_at_position(const std::string &name, const unsigned int position);
297 
302  std::string
303  replace_in_string(const std::string &input,
304  const std::string &from,
305  const std::string &to);
306 
312  std::string
313  trim(const std::string &input);
314 
340  double
341  generate_normal_random_number(const double a, const double sigma);
342 
343 
352  template <int N, typename T>
353  T
354  fixed_power(const T t);
355 
380  template <int a, int N>
381  struct DEAL_II_DEPRECATED fixed_int_power
382  {
383  static const int value = a * fixed_int_power<a, N - 1>::value;
384  };
385 
393  template <int a>
394  struct DEAL_II_DEPRECATED fixed_int_power<a, 0>
395  {
396  static const int value = 1;
397  };
398 
404  constexpr unsigned int
405  pow(const unsigned int base, const int iexp)
406  {
407 #ifdef DEAL_II_WITH_CXX14
408 # ifdef DEAL_II_HAVE_CXX14_CONSTEXPR_CAN_CALL_NONCONSTEXPR
409 # if defined(DEAL_II_HAVE_BUILTIN_EXPECT) && defined(__INTEL_COMPILER)
410  if (!(iexp >= 0))
411  ::deal_II_exceptions::internals::issue_error_noreturn(
413  __FILE__,
414  __LINE__,
415  __PRETTY_FUNCTION__,
416  "iexp>=0",
417  "ExcMessage(\"The exponent must not be negative!\")",
418  ExcMessage("The exponent must not be negative!"));
419 # else
420  Assert(iexp >= 0, ExcMessage("The exponent must not be negative!"));
421 # endif
422 # endif
423 #endif
424  // The "exponentiation by squaring" algorithm used below has to be
425  // compressed to one statement due to C++11's restrictions on constexpr
426  // functions. A more descriptive version would be:
427  //
428  // <code>
429  // if (iexp <= 0)
430  // return 1;
431  //
432  // // if the current exponent is not divisible by two,
433  // // we need to account for that.
434  // const unsigned int prefactor = (iexp % 2 == 1) ? base : 1;
435  //
436  // // a^b = (a*a)^(b/2) for b evenb
437  // // a^b = a*(a*a)^((b-1)/2 for b odd
438  // return prefactor * ::Utilities::pow(base*base, iexp/2);
439  // </code>
440 
441  return iexp <= 0 ? 1 :
442  (((iexp % 2 == 1) ? base : 1) *
443  ::Utilities::pow(base * base, iexp / 2));
444  }
445 
467  template <typename Iterator, typename T>
468  Iterator
469  lower_bound(Iterator first, Iterator last, const T &val);
470 
471 
477  template <typename Iterator, typename T, typename Comp>
478  Iterator
479  lower_bound(Iterator first, Iterator last, const T &val, const Comp comp);
480 
486  std::vector<unsigned int>
487  reverse_permutation(const std::vector<unsigned int> &permutation);
488 
494  std::vector<unsigned int>
495  invert_permutation(const std::vector<unsigned int> &permutation);
496 
502  std::vector<unsigned long long int>
503  reverse_permutation(const std::vector<unsigned long long int> &permutation);
504 
510  std::vector<unsigned long long int>
511  invert_permutation(const std::vector<unsigned long long int> &permutation);
512 
530  template <typename T>
531  size_t
532  pack(const T & object,
533  std::vector<char> &dest_buffer,
534  const bool allow_compression = true);
535 
546  template <typename T>
547  std::vector<char>
548  pack(const T &object, const bool allow_compression = true);
549 
582  template <typename T>
583  T
584  unpack(const std::vector<char> &buffer, const bool allow_compression = true);
585 
596  template <typename T>
597  T
598  unpack(const std::vector<char>::const_iterator &cbegin,
599  const std::vector<char>::const_iterator &cend,
600  const bool allow_compression = true);
601 
636  template <typename T, int N>
637  void
638  unpack(const std::vector<char> &buffer,
639  T (&unpacked_object)[N],
640  const bool allow_compression = true);
641 
652  template <typename T, int N>
653  void
654  unpack(const std::vector<char>::const_iterator &cbegin,
655  const std::vector<char>::const_iterator &cend,
656  T (&unpacked_object)[N],
657  const bool allow_compression = true);
658 
716  template <typename To, typename From>
717  std::unique_ptr<To>
718  dynamic_unique_cast(std::unique_ptr<From> &&p)
719  {
720  // Let's see if we can cast from 'From' to 'To'. If so, do the cast,
721  // and then release the pointer from the old
722  // owner
723  if (To *cast = dynamic_cast<To *>(p.get()))
724  {
725  std::unique_ptr<To> result(cast);
726  p.release();
727  return result;
728  }
729  else
730  throw std::bad_cast();
731  }
732 
738  namespace System
739  {
747  double
748  get_cpu_load();
749 
783  const std::string
785 
790  struct MemoryStats
791  {
795  unsigned long int VmPeak;
796 
800  unsigned long int VmSize;
801 
805  unsigned long int VmHWM;
806 
811  unsigned long int VmRSS;
812  };
813 
814 
819  void
821 
822 
826  std::string
827  get_hostname();
828 
829 
833  std::string
834  get_time();
835 
840  std::string
841  get_date();
842 
857  void
858  posix_memalign(void **memptr, std::size_t alignment, std::size_t size);
859  } // namespace System
860 
861 
862 #ifdef DEAL_II_WITH_TRILINOS
863 
868  namespace Trilinos
869  {
879  const Epetra_Comm &
880  comm_world();
881 
891  const Epetra_Comm &
892  comm_self();
893 
926  Epetra_Comm *
927  duplicate_communicator(const Epetra_Comm &communicator);
928 
951  void
952  destroy_communicator(Epetra_Comm &communicator);
953 
962  unsigned int
963  get_n_mpi_processes(const Epetra_Comm &mpi_communicator);
964 
971  unsigned int
972  get_this_mpi_process(const Epetra_Comm &mpi_communicator);
973 
984  Epetra_Map
985  duplicate_map(const Epetra_BlockMap &map, const Epetra_Comm &comm);
986  } // namespace Trilinos
987 
988 #endif
989 
990 
991 } // namespace Utilities
992 
993 
994 // --------------------- inline functions
995 
996 namespace Utilities
997 {
998  template <int N, typename T>
999  inline T
1000  fixed_power(const T n)
1001  {
1002  Assert(N >= 0, ExcNotImplemented());
1003  switch (N)
1004  {
1005  case 0:
1006  return ::internal::NumberType<T>::value(1);
1007  case 1:
1008  return n;
1009  case 2:
1010  return n * n;
1011  case 3:
1012  return n * n * n;
1013  case 4:
1014  return n * n * n * n;
1015  default:
1016  T result = n;
1017  for (int d = 1; d < N; ++d)
1018  result *= n;
1019  return result;
1020  }
1021  }
1022 
1023 
1024 
1025  template <typename Iterator, typename T>
1026  inline Iterator
1027  lower_bound(Iterator first, Iterator last, const T &val)
1028  {
1029  return Utilities::lower_bound(first, last, val, std::less<T>());
1030  }
1031 
1032 
1033 
1034  template <typename Iterator, typename T, typename Comp>
1035  inline Iterator
1036  lower_bound(Iterator first, Iterator last, const T &val, const Comp comp)
1037  {
1038  // verify that the two iterators are properly ordered. since
1039  // we need operator- for the iterator type anyway, do the
1040  // test as follows, rather than via 'last >= first'
1041  Assert(last - first >= 0,
1042  ExcMessage(
1043  "The given iterators do not satisfy the proper ordering."));
1044 
1045  unsigned int len = static_cast<unsigned int>(last - first);
1046 
1047  if (len == 0)
1048  return first;
1049 
1050  while (true)
1051  {
1052  // if length equals 8 or less,
1053  // then do a rolled out
1054  // search. use a switch without
1055  // breaks for that and roll-out
1056  // the loop somehow
1057  if (len < 8)
1058  {
1059  switch (len)
1060  {
1061  case 7:
1062  if (!comp(*first, val))
1063  return first;
1064  ++first;
1065  DEAL_II_FALLTHROUGH;
1066  case 6:
1067  if (!comp(*first, val))
1068  return first;
1069  ++first;
1070  DEAL_II_FALLTHROUGH;
1071  case 5:
1072  if (!comp(*first, val))
1073  return first;
1074  ++first;
1075  DEAL_II_FALLTHROUGH;
1076  case 4:
1077  if (!comp(*first, val))
1078  return first;
1079  ++first;
1080  DEAL_II_FALLTHROUGH;
1081  case 3:
1082  if (!comp(*first, val))
1083  return first;
1084  ++first;
1085  DEAL_II_FALLTHROUGH;
1086  case 2:
1087  if (!comp(*first, val))
1088  return first;
1089  ++first;
1090  DEAL_II_FALLTHROUGH;
1091  case 1:
1092  if (!comp(*first, val))
1093  return first;
1094  return first + 1;
1095  default:
1096  // indices seem
1097  // to not be
1098  // sorted
1099  // correctly!? or
1100  // did len
1101  // become==0
1102  // somehow? that
1103  // shouldn't have
1104  // happened
1105  Assert(false, ExcInternalError());
1106  }
1107  }
1108 
1109 
1110 
1111  const unsigned int half = len >> 1;
1112  const Iterator middle = first + half;
1113 
1114  // if the value is larger than
1115  // that pointed to by the
1116  // middle pointer, then the
1117  // insertion point must be
1118  // right of it
1119  if (comp(*middle, val))
1120  {
1121  first = middle + 1;
1122  len -= half + 1;
1123  }
1124  else
1125  len = half;
1126  }
1127  }
1128 
1129 
1130  // --------------------- non-inline functions
1131 
1132  template <typename T>
1133  size_t
1134  pack(const T & object,
1135  std::vector<char> &dest_buffer,
1136  const bool allow_compression)
1137  {
1138  // the data is never compressed when we can't use zlib.
1139  (void)allow_compression;
1140 
1141  std::size_t size = 0;
1142 
1143  // see if the object is small and copyable via memcpy. if so, use
1144  // this fast path. otherwise, we have to go through the BOOST
1145  // serialization machinery
1146  //
1147  // we have to work around the fact that GCC 4.8.x claims to be C++
1148  // conforming, but is not actually as it does not implement
1149  // std::is_trivially_copyable.
1150 #if __GNUG__ && __GNUC__ < 5
1151  if (__has_trivial_copy(T) && sizeof(T) < 256)
1152 #else
1153 # ifdef DEAL_II_WITH_CXX17
1154  if constexpr (std::is_trivially_copyable<T>() && sizeof(T) < 256)
1155 # else
1156  if (std::is_trivially_copyable<T>() && sizeof(T) < 256)
1157 # endif
1158 #endif
1159  {
1160  const std::size_t previous_size = dest_buffer.size();
1161  dest_buffer.resize(previous_size + sizeof(T));
1162 
1163  std::memcpy(dest_buffer.data() + previous_size, &object, sizeof(T));
1164 
1165  size = sizeof(T);
1166  }
1167  else
1168  {
1169  // use buffer as the target of a compressing
1170  // stream into which we serialize the current object
1171  const std::size_t previous_size = dest_buffer.size();
1172 #ifdef DEAL_II_WITH_ZLIB
1173  if (allow_compression)
1174  {
1175  boost::iostreams::filtering_ostream out;
1176  out.push(
1177  boost::iostreams::gzip_compressor(boost::iostreams::gzip_params(
1178  boost::iostreams::gzip::best_compression)));
1179  out.push(boost::iostreams::back_inserter(dest_buffer));
1180 
1181  boost::archive::binary_oarchive archive(out);
1182  archive << object;
1183  out.flush();
1184  }
1185  else
1186 #endif
1187  {
1188  std::ostringstream out;
1189  boost::archive::binary_oarchive archive(out);
1190  archive << object;
1191 
1192  const std::string &s = out.str();
1193  dest_buffer.reserve(dest_buffer.size() + s.size());
1194  std::move(s.begin(), s.end(), std::back_inserter(dest_buffer));
1195  }
1196 
1197  size = dest_buffer.size() - previous_size;
1198  }
1199 
1200  return size;
1201  }
1202 
1203 
1204  template <typename T>
1205  std::vector<char>
1206  pack(const T &object, const bool allow_compression)
1207  {
1208  std::vector<char> buffer;
1209  pack<T>(object, buffer, allow_compression);
1210  return buffer;
1211  }
1212 
1213 
1214  template <typename T>
1215  T
1216  unpack(const std::vector<char>::const_iterator &cbegin,
1217  const std::vector<char>::const_iterator &cend,
1218  const bool allow_compression)
1219  {
1220  T object;
1221 
1222  // the data is never compressed when we can't use zlib.
1223  (void)allow_compression;
1224 
1225  // see if the object is small and copyable via memcpy. if so, use
1226  // this fast path. otherwise, we have to go through the BOOST
1227  // serialization machinery
1228  //
1229  // we have to work around the fact that GCC 4.8.x claims to be C++
1230  // conforming, but is not actually as it does not implement
1231  // std::is_trivially_copyable.
1232 #if __GNUG__ && __GNUC__ < 5
1233  if (__has_trivial_copy(T) && sizeof(T) < 256)
1234 #else
1235 # ifdef DEAL_II_WITH_CXX17
1236  if constexpr (std::is_trivially_copyable<T>() && sizeof(T) < 256)
1237 # else
1238  if (std::is_trivially_copyable<T>() && sizeof(T) < 256)
1239 # endif
1240 #endif
1241  {
1242  Assert(std::distance(cbegin, cend) == sizeof(T), ExcInternalError());
1243  std::memcpy(&object, &*cbegin, sizeof(T));
1244  }
1245  else
1246  {
1247  std::string decompressed_buffer;
1248 
1249  // first decompress the buffer
1250 #ifdef DEAL_II_WITH_ZLIB
1251  if (allow_compression)
1252  {
1253  boost::iostreams::filtering_ostream decompressing_stream;
1254  decompressing_stream.push(boost::iostreams::gzip_decompressor());
1255  decompressing_stream.push(
1256  boost::iostreams::back_inserter(decompressed_buffer));
1257  decompressing_stream.write(&*cbegin, std::distance(cbegin, cend));
1258  }
1259  else
1260 #endif
1261  {
1262  decompressed_buffer.assign(cbegin, cend);
1263  }
1264 
1265  // then restore the object from the buffer
1266  std::istringstream in(decompressed_buffer);
1267  boost::archive::binary_iarchive archive(in);
1268 
1269  archive >> object;
1270  }
1271 
1272  return object;
1273  }
1274 
1275 
1276  template <typename T>
1277  T
1278  unpack(const std::vector<char> &buffer, const bool allow_compression)
1279  {
1280  return unpack<T>(buffer.cbegin(), buffer.cend(), allow_compression);
1281  }
1282 
1283 
1284  template <typename T, int N>
1285  void
1286  unpack(const std::vector<char>::const_iterator &cbegin,
1287  const std::vector<char>::const_iterator &cend,
1288  T (&unpacked_object)[N],
1289  const bool allow_compression)
1290  {
1291  // see if the object is small and copyable via memcpy. if so, use
1292  // this fast path. otherwise, we have to go through the BOOST
1293  // serialization machinery
1294  //
1295  // we have to work around the fact that GCC 4.8.x claims to be C++
1296  // conforming, but is not actually as it does not implement
1297  // std::is_trivially_copyable.
1298  if (
1299 #if __GNUG__ && __GNUC__ < 5
1300  __has_trivial_copy(T)
1301 #else
1302  std::is_trivially_copyable<T>()
1303 #endif
1304  && sizeof(T) * N < 256)
1305  {
1306  Assert(std::distance(cbegin, cend) == sizeof(T) * N,
1307  ExcInternalError());
1308  std::memcpy(unpacked_object, &*cbegin, sizeof(T) * N);
1309  }
1310  else
1311  {
1312  std::string decompressed_buffer;
1313 
1314  // first decompress the buffer
1315  (void)allow_compression;
1316 #ifdef DEAL_II_WITH_ZLIB
1317  if (allow_compression)
1318  {
1319  boost::iostreams::filtering_ostream decompressing_stream;
1320  decompressing_stream.push(boost::iostreams::gzip_decompressor());
1321  decompressing_stream.push(
1322  boost::iostreams::back_inserter(decompressed_buffer));
1323  decompressing_stream.write(&*cbegin, std::distance(cbegin, cend));
1324  }
1325  else
1326 #endif
1327  {
1328  decompressed_buffer.assign(cbegin, cend);
1329  }
1330 
1331  // then restore the object from the buffer
1332  std::istringstream in(decompressed_buffer);
1333  boost::archive::binary_iarchive archive(in);
1334 
1335  archive >> unpacked_object;
1336  }
1337  }
1338 
1339 
1340  template <typename T, int N>
1341  void
1342  unpack(const std::vector<char> &buffer,
1343  T (&unpacked_object)[N],
1344  const bool allow_compression)
1345  {
1346  unpack<T, N>(buffer.cbegin(),
1347  buffer.cend(),
1348  unpacked_object,
1349  allow_compression);
1350  }
1351 
1352 } // namespace Utilities
1353 
1354 
1355 DEAL_II_NAMESPACE_CLOSE
1356 
1357 #ifndef DOXYGEN
1358 namespace boost
1359 {
1360  namespace serialization
1361  {
1362  // Provides boost and c++11 with a way to serialize tuples and pairs
1363  // automatically
1364  template <int N>
1365  struct Serialize
1366  {
1367  template <class Archive, typename... Args>
1368  static void
1369  serialize(Archive &ar, std::tuple<Args...> &t, const unsigned int version)
1370  {
1371  ar &std::get<N - 1>(t);
1372  Serialize<N - 1>::serialize(ar, t, version);
1373  }
1374  };
1375 
1376  template <>
1377  struct Serialize<0>
1378  {
1379  template <class Archive, typename... Args>
1380  static void
1381  serialize(Archive &ar, std::tuple<Args...> &t, const unsigned int version)
1382  {
1383  (void)ar;
1384  (void)t;
1385  (void)version;
1386  }
1387  };
1388 
1389  template <class Archive, typename... Args>
1390  void
1391  serialize(Archive &ar, std::tuple<Args...> &t, const unsigned int version)
1392  {
1393  Serialize<sizeof...(Args)>::serialize(ar, t, version);
1394  }
1395  } // namespace serialization
1396 } // namespace boost
1397 #endif
1398 
1399 #endif
Iterator lower_bound(Iterator first, Iterator last, const T &val)
Definition: utilities.h:1027
std::vector< std::string > split_string_list(const std::string &s, const std::string &delimiter=",")
Definition: utilities.cc:479
void posix_memalign(void **memptr, std::size_t alignment, std::size_t size)
Definition: utilities.cc:936
static const unsigned int invalid_unsigned_int
Definition: types.h:173
std::uint64_t pack_integers(const std::array< std::uint64_t, dim > &index, const int bits_per_dim)
Definition: utilities.cc:273
std::string dealii_version_string()
Definition: utilities.cc:86
unsigned int get_n_mpi_processes(const Epetra_Comm &mpi_communicator)
Definition: utilities.cc:1045
std::string trim(const std::string &input)
Definition: utilities.cc:343
std::pair< int, unsigned int > get_integer_at_position(const std::string &name, const unsigned int position)
Definition: utilities.cc:628
const Epetra_Comm & comm_self()
Definition: utilities.cc:983
Definition: point.h:106
std::string get_date()
Definition: utilities.cc:921
std::string to_string(const number value, const unsigned int digits=numbers::invalid_unsigned_int)
Definition: utilities.cc:305
void get_memory_stats(MemoryStats &stats)
Definition: utilities.cc:856
std::unique_ptr< To > dynamic_unique_cast(std::unique_ptr< From > &&p)
Definition: utilities.h:718
double string_to_double(const std::string &s)
Definition: utilities.cc:440
double get_cpu_load()
Definition: utilities.cc:822
T fixed_power(const T t)
Definition: utilities.h:1000
static::ExceptionBase & ExcMessage(std::string arg1)
Epetra_Comm * duplicate_communicator(const Epetra_Comm &communicator)
Definition: utilities.cc:999
double generate_normal_random_number(const double a, const double sigma)
Definition: utilities.cc:670
#define Assert(cond, exc)
Definition: exceptions.h:1407
constexpr unsigned int pow(const unsigned int base, const int iexp)
Definition: utilities.h:405
unsigned long int VmSize
Definition: utilities.h:800
bool match_at_string_start(const std::string &name, const std::string &pattern)
Definition: utilities.cc:613
std::vector< unsigned int > invert_permutation(const std::vector< unsigned int > &permutation)
Definition: utilities.cc:703
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
Definition: utilities.cc:296
size_t pack(const T &object, std::vector< char > &dest_buffer, const bool allow_compression=true)
Definition: utilities.h:1134
std::string replace_in_string(const std::string &input, const std::string &from, const std::string &to)
Definition: utilities.cc:324
std::string dim_string(const int dim, const int spacedim)
Definition: utilities.cc:370
std::vector< std::array< std::uint64_t, dim > > inverse_Hilbert_space_filling_curve(const std::vector< Point< dim, Number >> &points, const int bits_per_dim=64)
Definition: utilities.cc:95
void destroy_communicator(Epetra_Comm &communicator)
Definition: utilities.cc:1026
Definition: cuda.h:31
std::vector< std::string > break_text_into_lines(const std::string &original_text, const unsigned int width, const char delimiter= ' ')
Definition: utilities.cc:533
std::string get_hostname()
Definition: utilities.cc:890
unsigned long int VmHWM
Definition: utilities.h:805
const Epetra_Comm & comm_world()
Definition: utilities.cc:967
T unpack(const std::vector< char > &buffer, const bool allow_compression=true)
Definition: utilities.h:1278
int string_to_int(const std::string &s)
Definition: utilities.cc:401
std::vector< unsigned int > reverse_permutation(const std::vector< unsigned int > &permutation)
Definition: utilities.cc:689
static::ExceptionBase & ExcNotImplemented()
unsigned long int VmRSS
Definition: utilities.h:811
unsigned int get_this_mpi_process(const Epetra_Comm &mpi_communicator)
Definition: utilities.cc:1052
const std::string get_current_vectorization_level()
Definition: utilities.cc:830
Epetra_Map duplicate_map(const Epetra_BlockMap &map, const Epetra_Comm &comm)
Definition: utilities.cc:1060
std::string get_time()
Definition: utilities.cc:905
unsigned long int VmPeak
Definition: utilities.h:795
unsigned int needed_digits(const unsigned int max_number)
Definition: utilities.cc:380
static::ExceptionBase & ExcInternalError()