Reference documentation for deal.II version Git a7d922cd5a 2021-01-15 21:19:32 -0700
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
utilities.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2005 - 2020 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 
22 
23 #include <functional>
24 #include <string>
25 #include <tuple>
26 #include <type_traits>
27 #include <typeinfo>
28 #include <utility>
29 #include <vector>
30 
31 #ifdef DEAL_II_WITH_TRILINOS
32 # include <Epetra_Comm.h>
33 # include <Epetra_Map.h>
34 # include <Teuchos_Comm.hpp>
35 # include <Teuchos_RCP.hpp>
36 # ifdef DEAL_II_WITH_MPI
37 # include <Epetra_MpiComm.h>
38 # else
39 # include <Epetra_SerialComm.h>
40 # endif
41 #endif
42 
44 
45 #include <boost/archive/binary_iarchive.hpp>
46 #include <boost/archive/binary_oarchive.hpp>
47 #include <boost/core/demangle.hpp>
48 #include <boost/iostreams/device/array.hpp>
49 #include <boost/iostreams/device/back_inserter.hpp>
50 #include <boost/iostreams/filtering_streambuf.hpp>
51 #include <boost/serialization/array.hpp>
52 #include <boost/serialization/complex.hpp>
53 #include <boost/serialization/vector.hpp>
54 
55 #ifdef DEAL_II_WITH_ZLIB
56 # include <boost/iostreams/filter/gzip.hpp>
57 #endif
58 
60 
62 
63 // forward declare Point
64 #ifndef DOXYGEN
65 template <int dim, typename Number>
66 class Point;
67 #endif
68 
76 namespace Utilities
77 {
84  std::string
86 
103  template <int dim, typename Number>
104  std::vector<std::array<std::uint64_t, dim>>
106  const std::vector<Point<dim, Number>> &points,
107  const int bits_per_dim = 64);
108 
112  template <int dim>
113  std::vector<std::array<std::uint64_t, dim>>
115  const std::vector<std::array<std::uint64_t, dim>> &points,
116  const int bits_per_dim = 64);
117 
133  template <int dim>
134  std::uint64_t
135  pack_integers(const std::array<std::uint64_t, dim> &index,
136  const int bits_per_dim);
137 
150  std::string
151  compress(const std::string &input);
152 
166  std::string
167  decompress(const std::string &compressed_input);
168 
182  std::string
183  encode_base64(const std::vector<unsigned char> &binary_input);
184 
193  std::vector<unsigned char>
194  decode_base64(const std::string &base64_input);
195 
217  std::string
218  int_to_string(const unsigned int value,
219  const unsigned int digits = numbers::invalid_unsigned_int);
220 
232  template <typename number>
233  std::string
234  to_string(const number value,
235  const unsigned int digits = numbers::invalid_unsigned_int);
236 
241  unsigned int
242  needed_digits(const unsigned int max_number);
243 
252  template <typename Number>
253  Number
254  truncate_to_n_digits(const Number number, const unsigned int n_digits);
255 
260  int
261  string_to_int(const std::string &s);
262 
274  std::string
275  dim_string(const int dim, const int spacedim);
276 
281  std::vector<int>
282  string_to_int(const std::vector<std::string> &s);
283 
288  double
289  string_to_double(const std::string &s);
290 
291 
296  std::vector<double>
297  string_to_double(const std::vector<std::string> &s);
298 
299 
342  std::vector<std::string>
343  split_string_list(const std::string &s, const std::string &delimiter = ",");
344 
345 
350  std::vector<std::string>
351  split_string_list(const std::string &s, const char delimiter);
352 
353 
363  std::vector<std::string>
364  break_text_into_lines(const std::string &original_text,
365  const unsigned int width,
366  const char delimiter = ' ');
367 
372  bool
373  match_at_string_start(const std::string &name, const std::string &pattern);
374 
383  std::pair<int, unsigned int>
384  get_integer_at_position(const std::string &name, const unsigned int position);
385 
390  std::string
391  replace_in_string(const std::string &input,
392  const std::string &from,
393  const std::string &to);
394 
400  std::string
401  trim(const std::string &input);
402 
428  double
429  generate_normal_random_number(const double a, const double sigma);
430 
438  template <class T>
439  std::string
440  type_to_string(const T &t);
441 
450  template <int N, typename T>
451  T
452  fixed_power(const T t);
453 
459  template <typename T>
460  constexpr T
461  pow(const T base, const int iexp)
462  {
463 #if defined(DEBUG) && !defined(DEAL_II_CXX14_CONSTEXPR_BUG)
464  // Up to __builtin_expect this is the same code as in the 'Assert' macro.
465  // The call to __builtin_expect turns out to be problematic.
466  if (!(iexp >= 0))
469  __FILE__,
470  __LINE__,
471  __PRETTY_FUNCTION__,
472  "iexp>=0",
473  "ExcMessage(\"The exponent must not be negative!\")",
474  ExcMessage("The exponent must not be negative!"));
475 #endif
476  // The "exponentiation by squaring" algorithm used below has to be
477  // compressed to one statement due to C++11's restrictions on constexpr
478  // functions. A more descriptive version would be:
479  //
480  // <code>
481  // if (iexp <= 0)
482  // return 1;
483  //
484  // // avoid overflow of one additional recursion with pow(base * base, 0)
485  // if (iexp == 1)
486  // return base;
487  //
488  // // if the current exponent is not divisible by two,
489  // // we need to account for that.
490  // const unsigned int prefactor = (iexp % 2 == 1) ? base : 1;
491  //
492  // // a^b = (a*a)^(b/2) for b even
493  // // a^b = a*(a*a)^((b-1)/2 for b odd
494  // return prefactor * ::Utilities::pow(base*base, iexp/2);
495  // </code>
496 
497  static_assert(std::is_integral<T>::value, "Only integral types supported");
498 
499  return iexp <= 0 ?
500  1 :
501  (iexp == 1 ? base :
502  (((iexp % 2 == 1) ? base : 1) *
503  ::Utilities::pow(base * base, iexp / 2)));
504  }
505 
527  template <typename Iterator, typename T>
528  Iterator
529  lower_bound(Iterator first, Iterator last, const T &val);
530 
531 
537  template <typename Iterator, typename T, typename Comp>
538  Iterator
539  lower_bound(Iterator first, Iterator last, const T &val, const Comp comp);
540 
546  template <typename Integer>
547  std::vector<Integer>
548  reverse_permutation(const std::vector<Integer> &permutation);
549 
555  template <typename Integer>
556  std::vector<Integer>
557  invert_permutation(const std::vector<Integer> &permutation);
558 
574  template <typename T>
575  size_t
576  pack(const T & object,
577  std::vector<char> &dest_buffer,
578  const bool allow_compression = true);
579 
588  template <typename T>
589  std::vector<char>
590  pack(const T &object, const bool allow_compression = true);
591 
622  template <typename T>
623  T
624  unpack(const std::vector<char> &buffer, const bool allow_compression = true);
625 
634  template <typename T>
635  T
636  unpack(const std::vector<char>::const_iterator &cbegin,
637  const std::vector<char>::const_iterator &cend,
638  const bool allow_compression = true);
639 
672  template <typename T, int N>
673  void
674  unpack(const std::vector<char> &buffer,
675  T (&unpacked_object)[N],
676  const bool allow_compression = true);
677 
686  template <typename T, int N>
687  void
688  unpack(const std::vector<char>::const_iterator &cbegin,
689  const std::vector<char>::const_iterator &cend,
690  T (&unpacked_object)[N],
691  const bool allow_compression = true);
692 
750  template <typename To, typename From>
751  std::unique_ptr<To>
752  dynamic_unique_cast(std::unique_ptr<From> &&p)
753  {
754  // Let's see if we can cast from 'From' to 'To'. If so, do the cast,
755  // and then release the pointer from the old
756  // owner
757  if (To *cast = dynamic_cast<To *>(p.get()))
758  {
759  std::unique_ptr<To> result(cast);
760  p.release();
761  return result;
762  }
763  else
764  throw std::bad_cast();
765  }
766 
772  namespace System
773  {
781  double
782  get_cpu_load();
783 
817  const std::string
819 
824  struct MemoryStats
825  {
829  unsigned long int VmPeak;
830 
834  unsigned long int VmSize;
835 
839  unsigned long int VmHWM;
840 
845  unsigned long int VmRSS;
846  };
847 
848 
853  void
855 
856 
860  std::string
861  get_hostname();
862 
863 
867  std::string
868  get_time();
869 
874  std::string
875  get_date();
876 
891  void
892  posix_memalign(void **memptr, std::size_t alignment, std::size_t size);
893  } // namespace System
894 
895 
896 #ifdef DEAL_II_WITH_TRILINOS
897 
902  namespace Trilinos
903  {
913  const Epetra_Comm &
914  comm_world();
915 
925  const Epetra_Comm &
926  comm_self();
927 
936  const Teuchos::RCP<const Teuchos::Comm<int>> &
938 
971  Epetra_Comm *
972  duplicate_communicator(const Epetra_Comm &communicator);
973 
996  void
997  destroy_communicator(Epetra_Comm &communicator);
998 
1007  unsigned int
1008  get_n_mpi_processes(const Epetra_Comm &mpi_communicator);
1009 
1016  unsigned int
1017  get_this_mpi_process(const Epetra_Comm &mpi_communicator);
1018 
1029  Epetra_Map
1030  duplicate_map(const Epetra_BlockMap &map, const Epetra_Comm &comm);
1031  } // namespace Trilinos
1032 
1033 #endif
1034 
1035 
1036 } // namespace Utilities
1037 
1038 
1039 // --------------------- inline functions
1040 
1041 namespace Utilities
1042 {
1043  template <int N, typename T>
1044  inline T
1045  fixed_power(const T x)
1046  {
1047  Assert(
1048  !std::is_integral<T>::value || (N >= 0),
1049  ExcMessage(
1050  "The non-type template parameter N must be a non-negative integer for integral type T"));
1051 
1052  if (N == 0)
1053  return T(1.);
1054  else if (N < 0)
1055  return T(1.) / fixed_power<-N>(x);
1056  else
1057  // Use exponentiation by squaring:
1058  return ((N % 2 == 1) ? x * fixed_power<N / 2>(x * x) :
1059  fixed_power<N / 2>(x * x));
1060  }
1061 
1062 
1063 
1064  template <class T>
1065  inline std::string
1066  type_to_string(const T &t)
1067  {
1068  return boost::core::demangle(typeid(t).name());
1069  }
1070 
1071 
1072 
1073  template <typename Iterator, typename T>
1074  inline Iterator
1075  lower_bound(Iterator first, Iterator last, const T &val)
1076  {
1077  return Utilities::lower_bound(first, last, val, std::less<T>());
1078  }
1079 
1080 
1081 
1082  template <typename Iterator, typename T, typename Comp>
1083  inline Iterator
1084  lower_bound(Iterator first, Iterator last, const T &val, const Comp comp)
1085  {
1086  // verify that the two iterators are properly ordered. since
1087  // we need operator- for the iterator type anyway, do the
1088  // test as follows, rather than via 'last >= first'
1089  Assert(last - first >= 0,
1090  ExcMessage(
1091  "The given iterators do not satisfy the proper ordering."));
1092 
1093  unsigned int len = static_cast<unsigned int>(last - first);
1094 
1095  if (len == 0)
1096  return first;
1097 
1098  while (true)
1099  {
1100  // if length equals 8 or less,
1101  // then do a rolled out
1102  // search. use a switch without
1103  // breaks for that and roll-out
1104  // the loop somehow
1105  if (len < 8)
1106  {
1107  switch (len)
1108  {
1109  case 7:
1110  if (!comp(*first, val))
1111  return first;
1112  ++first;
1114  case 6:
1115  if (!comp(*first, val))
1116  return first;
1117  ++first;
1119  case 5:
1120  if (!comp(*first, val))
1121  return first;
1122  ++first;
1124  case 4:
1125  if (!comp(*first, val))
1126  return first;
1127  ++first;
1129  case 3:
1130  if (!comp(*first, val))
1131  return first;
1132  ++first;
1134  case 2:
1135  if (!comp(*first, val))
1136  return first;
1137  ++first;
1139  case 1:
1140  if (!comp(*first, val))
1141  return first;
1142  return first + 1;
1143  default:
1144  // indices seem
1145  // to not be
1146  // sorted
1147  // correctly!? or
1148  // did len
1149  // become==0
1150  // somehow? that
1151  // shouldn't have
1152  // happened
1153  Assert(false, ExcInternalError());
1154  }
1155  }
1156 
1157 
1158 
1159  const unsigned int half = len >> 1;
1160  const Iterator middle = first + half;
1161 
1162  // if the value is larger than
1163  // that pointed to by the
1164  // middle pointer, then the
1165  // insertion point must be
1166  // right of it
1167  if (comp(*middle, val))
1168  {
1169  first = middle + 1;
1170  len -= half + 1;
1171  }
1172  else
1173  len = half;
1174  }
1175  }
1176 
1177 
1178  // --------------------- non-inline functions
1179 
1180  template <typename T>
1181  size_t
1182  pack(const T & object,
1183  std::vector<char> &dest_buffer,
1184  const bool allow_compression)
1185  {
1186  std::size_t size = 0;
1187 
1188  // see if the object is small and copyable via memcpy. if so, use
1189  // this fast path. otherwise, we have to go through the BOOST
1190  // serialization machinery
1191 #ifdef DEAL_II_HAVE_CXX17
1192  if constexpr (std::is_trivially_copyable<T>() && sizeof(T) < 256)
1193 #else
1194  if (std::is_trivially_copyable<T>() && sizeof(T) < 256)
1195 #endif
1196  {
1197  (void)allow_compression;
1198  const std::size_t previous_size = dest_buffer.size();
1199  dest_buffer.resize(previous_size + sizeof(T));
1200 
1201  std::memcpy(dest_buffer.data() + previous_size, &object, sizeof(T));
1202 
1203  size = sizeof(T);
1204  }
1205  else
1206  {
1207  // use buffer as the target of a compressing
1208  // stream into which we serialize the current object
1209  const std::size_t previous_size = dest_buffer.size();
1210  {
1211  boost::iostreams::filtering_ostreambuf fosb;
1212 #ifdef DEAL_II_WITH_ZLIB
1213  if (allow_compression)
1214  fosb.push(boost::iostreams::gzip_compressor());
1215 #else
1216  (void)allow_compression;
1217 #endif
1218  fosb.push(boost::iostreams::back_inserter(dest_buffer));
1219 
1220  boost::archive::binary_oarchive boa(fosb);
1221  boa << object;
1222  // the stream object has to be destroyed before the return statement
1223  // to ensure that all data has been written in the buffer
1224  }
1225  size = dest_buffer.size() - previous_size;
1226  }
1227 
1228  return size;
1229  }
1230 
1231 
1232  template <typename T>
1233  std::vector<char>
1234  pack(const T &object, const bool allow_compression)
1235  {
1236  std::vector<char> buffer;
1237  pack<T>(object, buffer, allow_compression);
1238  return buffer;
1239  }
1240 
1241 
1242  template <typename T>
1243  T
1244  unpack(const std::vector<char>::const_iterator &cbegin,
1245  const std::vector<char>::const_iterator &cend,
1246  const bool allow_compression)
1247  {
1248  T object;
1249 
1250  // see if the object is small and copyable via memcpy. if so, use
1251  // this fast path. otherwise, we have to go through the BOOST
1252  // serialization machinery
1253 #ifdef DEAL_II_HAVE_CXX17
1254  if constexpr (std::is_trivially_copyable<T>() && sizeof(T) < 256)
1255 #else
1256  if (std::is_trivially_copyable<T>() && sizeof(T) < 256)
1257 #endif
1258  {
1259  (void)allow_compression;
1260  Assert(std::distance(cbegin, cend) == sizeof(T), ExcInternalError());
1261  std::memcpy(&object, &*cbegin, sizeof(T));
1262  }
1263  else
1264  {
1265  // decompress the buffer section into the object
1266  boost::iostreams::filtering_istreambuf fisb;
1267 #ifdef DEAL_II_WITH_ZLIB
1268  if (allow_compression)
1269  fisb.push(boost::iostreams::gzip_decompressor());
1270 #else
1271  (void)allow_compression;
1272 #endif
1273  fisb.push(boost::iostreams::array_source(&*cbegin, &*cend));
1274 
1275  boost::archive::binary_iarchive bia(fisb);
1276  bia >> object;
1277  }
1278 
1279  return object;
1280  }
1281 
1282 
1283  template <typename T>
1284  T
1285  unpack(const std::vector<char> &buffer, const bool allow_compression)
1286  {
1287  return unpack<T>(buffer.cbegin(), buffer.cend(), allow_compression);
1288  }
1289 
1290 
1291  template <typename T, int N>
1292  void
1293  unpack(const std::vector<char>::const_iterator &cbegin,
1294  const std::vector<char>::const_iterator &cend,
1295  T (&unpacked_object)[N],
1296  const bool allow_compression)
1297  {
1298  // see if the object is small and copyable via memcpy. if so, use
1299  // this fast path. otherwise, we have to go through the BOOST
1300  // serialization machinery
1301  if (std::is_trivially_copyable<T>() && sizeof(T) * N < 256)
1302  {
1303  Assert(std::distance(cbegin, cend) == sizeof(T) * N,
1304  ExcInternalError());
1305  std::memcpy(unpacked_object, &*cbegin, sizeof(T) * N);
1306  }
1307  else
1308  {
1309  // decompress the buffer section into the object
1310  boost::iostreams::filtering_istreambuf fisb;
1311 #ifdef DEAL_II_WITH_ZLIB
1312  if (allow_compression)
1313  fisb.push(boost::iostreams::gzip_decompressor());
1314 #else
1315  (void)allow_compression;
1316 #endif
1317  fisb.push(boost::iostreams::array_source(&*cbegin, &*cend));
1318 
1319  boost::archive::binary_iarchive bia(fisb);
1320  bia >> unpacked_object;
1321  }
1322  }
1323 
1324 
1325  template <typename T, int N>
1326  void
1327  unpack(const std::vector<char> &buffer,
1328  T (&unpacked_object)[N],
1329  const bool allow_compression)
1330  {
1331  unpack<T, N>(buffer.cbegin(),
1332  buffer.cend(),
1333  unpacked_object,
1334  allow_compression);
1335  }
1336 
1337 
1338 
1339  template <typename Integer>
1340  std::vector<Integer>
1341  reverse_permutation(const std::vector<Integer> &permutation)
1342  {
1343  const std::size_t n = permutation.size();
1344 
1345  std::vector<Integer> out(n);
1346  for (std::size_t i = 0; i < n; ++i)
1347  out[i] = n - 1 - permutation[i];
1348 
1349  return out;
1350  }
1351 
1352 
1353 
1354  template <typename Integer>
1355  std::vector<Integer>
1356  invert_permutation(const std::vector<Integer> &permutation)
1357  {
1358  const std::size_t n = permutation.size();
1359 
1360  std::vector<Integer> out(n, numbers::invalid_unsigned_int);
1361 
1362  for (std::size_t i = 0; i < n; ++i)
1363  {
1364  AssertIndexRange(permutation[i], n);
1365  out[permutation[i]] = i;
1366  }
1367 
1368  // check that we have actually reached
1369  // all indices
1370  for (std::size_t i = 0; i < n; ++i)
1372  ExcMessage("The given input permutation had duplicate entries!"));
1373 
1374  return out;
1375  }
1376 } // namespace Utilities
1377 
1378 
1380 
1381 #ifndef DOXYGEN
1382 namespace boost
1383 {
1384  namespace serialization
1385  {
1386  // Provides boost and c++11 with a way to serialize tuples and pairs
1387  // automatically.
1388  template <int N>
1389  struct Serialize
1390  {
1391  template <class Archive, typename... Args>
1392  static void
1393  serialize(Archive &ar, std::tuple<Args...> &t, const unsigned int version)
1394  {
1395  ar &std::get<N - 1>(t);
1396  Serialize<N - 1>::serialize(ar, t, version);
1397  }
1398  };
1399 
1400  template <>
1401  struct Serialize<0>
1402  {
1403  template <class Archive, typename... Args>
1404  static void
1405  serialize(Archive &ar, std::tuple<Args...> &t, const unsigned int version)
1406  {
1407  (void)ar;
1408  (void)t;
1409  (void)version;
1410  }
1411  };
1412 
1413  template <class Archive, typename... Args>
1414  void
1415  serialize(Archive &ar, std::tuple<Args...> &t, const unsigned int version)
1416  {
1417  Serialize<sizeof...(Args)>::serialize(ar, t, version);
1418  }
1419  } // namespace serialization
1420 } // namespace boost
1421 #endif
1422 
1423 #endif
Iterator lower_bound(Iterator first, Iterator last, const T &val)
Definition: utilities.h:1075
std::vector< std::string > split_string_list(const std::string &s, const std::string &delimiter=",")
Definition: utilities.cc:704
std::string encode_base64(const std::vector< unsigned char > &binary_input)
Definition: utilities.cc:436
void posix_memalign(void **memptr, std::size_t alignment, std::size_t size)
Definition: utilities.cc:1050
static const unsigned int invalid_unsigned_int
Definition: types.h:196
Number truncate_to_n_digits(const Number number, const unsigned int n_digits)
Definition: utilities.cc:581
std::uint64_t pack_integers(const std::array< std::uint64_t, dim > &index, const int bits_per_dim)
Definition: utilities.cc:369
std::string type_to_string(const T &t)
Definition: utilities.h:1066
std::vector< unsigned char > decode_base64(const std::string &base64_input)
Definition: utilities.cc:449
std::string dealii_version_string()
Definition: utilities.cc:97
unsigned int get_n_mpi_processes(const Epetra_Comm &mpi_communicator)
Definition: utilities.cc:1175
std::string trim(const std::string &input)
Definition: utilities.cc:531
#define AssertIndexRange(index, range)
Definition: exceptions.h:1691
std::pair< int, unsigned int > get_integer_at_position(const std::string &name, const unsigned int position)
Definition: utilities.cc:853
std::vector< Integer > reverse_permutation(const std::vector< Integer > &permutation)
Definition: utilities.h:1341
std::vector< std::string > break_text_into_lines(const std::string &original_text, const unsigned int width, const char delimiter=' ')
Definition: utilities.cc:758
std::string decompress(const std::string &compressed_input)
Definition: utilities.cc:414
const Epetra_Comm & comm_self()
Definition: utilities.cc:1113
Definition: point.h:110
std::string get_date()
Definition: utilities.cc:1035
std::string to_string(const number value, const unsigned int digits=numbers::invalid_unsigned_int)
Definition: utilities.cc:482
void get_memory_stats(MemoryStats &stats)
Definition: utilities.cc:970
constexpr T pow(const T base, const int iexp)
Definition: utilities.h:461
std::unique_ptr< To > dynamic_unique_cast(std::unique_ptr< From > &&p)
Definition: utilities.h:752
double string_to_double(const std::string &s)
Definition: utilities.cc:656
#define DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
Definition: config.h:393
double get_cpu_load()
Definition: utilities.cc:936
const Teuchos::RCP< const Teuchos::Comm< int > > & tpetra_comm_self()
Definition: utilities.cc:1097
T fixed_power(const T t)
Definition: utilities.h:1045
static ::ExceptionBase & ExcMessage(std::string arg1)
std::string compress(const std::string &input)
Definition: utilities.cc:392
Epetra_Comm * duplicate_communicator(const Epetra_Comm &communicator)
Definition: utilities.cc:1129
static const char T
double generate_normal_random_number(const double a, const double sigma)
Definition: utilities.cc:895
#define Assert(cond, exc)
Definition: exceptions.h:1466
unsigned long int VmSize
Definition: utilities.h:834
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:380
bool match_at_string_start(const std::string &name, const std::string &pattern)
Definition: utilities.cc:838
std::vector< Integer > invert_permutation(const std::vector< Integer > &permutation)
Definition: utilities.h:1356
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
Definition: utilities.cc:473
size_t pack(const T &object, std::vector< char > &dest_buffer, const bool allow_compression=true)
Definition: utilities.h:1182
std::string replace_in_string(const std::string &input, const std::string &from, const std::string &to)
Definition: utilities.cc:512
std::string dim_string(const int dim, const int spacedim)
Definition: utilities.cc:558
Point< 2 > first
Definition: grid_out.cc:4359
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:148
void destroy_communicator(Epetra_Comm &communicator)
Definition: utilities.cc:1156
Definition: cuda.h:32
void issue_error_noreturn(ExceptionHandling handling, const char *file, int line, const char *function, const char *cond, const char *exc_name, ExceptionType e)
Definition: exceptions.h:1353
*braid_SplitCommworld & comm
std::string get_hostname()
Definition: utilities.cc:1004
unsigned long int VmHWM
Definition: utilities.h:839
#define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
Definition: config.h:430
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:379
const Epetra_Comm & comm_world()
Definition: utilities.cc:1081
static const char N
T unpack(const std::vector< char > &buffer, const bool allow_compression=true)
Definition: utilities.h:1285
int string_to_int(const std::string &s)
Definition: utilities.cc:608
unsigned long int VmRSS
Definition: utilities.h:845
unsigned int get_this_mpi_process(const Epetra_Comm &mpi_communicator)
Definition: utilities.cc:1182
const std::string get_current_vectorization_level()
Definition: utilities.cc:944
#define DEAL_II_FALLTHROUGH
Definition: config.h:154
Epetra_Map duplicate_map(const Epetra_BlockMap &map, const Epetra_Comm &comm)
Definition: utilities.cc:1190
std::string get_time()
Definition: utilities.cc:1019
unsigned long int VmPeak
Definition: utilities.h:829
unsigned int needed_digits(const unsigned int max_number)
Definition: utilities.cc:568
static ::ExceptionBase & ExcInternalError()