Reference documentation for deal.II version 9.3.3
\(\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 - 2021 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
65template <int dim, typename Number>
66class Point;
67#endif
68
76namespace 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
696 bool
697 get_bit(const unsigned char number, const unsigned int n);
698
699
703 void
704 set_bit(unsigned char &number, const unsigned int n, const bool x);
705
706
764 template <typename To, typename From>
765 std::unique_ptr<To>
766 dynamic_unique_cast(std::unique_ptr<From> &&p);
767
771 template <typename T>
772 T &
774
778 template <typename T>
779 T &
780 get_underlying_value(std::shared_ptr<T> &p);
781
785 template <typename T>
786 T &
787 get_underlying_value(const std::shared_ptr<T> &p);
788
792 template <typename T>
793 T &
794 get_underlying_value(std::unique_ptr<T> &p);
795
799 template <typename T>
800 T &
801 get_underlying_value(const std::unique_ptr<T> &p);
802
808 namespace System
809 {
817 double
818 get_cpu_load();
819
853 const std::string
855
861 {
865 unsigned long int VmPeak;
866
870 unsigned long int VmSize;
871
875 unsigned long int VmHWM;
876
881 unsigned long int VmRSS;
882 };
883
884
889 void
891
892
896 std::string
897 get_hostname();
898
899
903 std::string
904 get_time();
905
910 std::string
911 get_date();
912
927 void
928 posix_memalign(void **memptr, std::size_t alignment, std::size_t size);
929 } // namespace System
930
931
932#ifdef DEAL_II_WITH_TRILINOS
938 namespace Trilinos
939 {
949 const Epetra_Comm &
950 comm_world();
951
961 const Epetra_Comm &
962 comm_self();
963
972 const Teuchos::RCP<const Teuchos::Comm<int>> &
974
1007 Epetra_Comm *
1008 duplicate_communicator(const Epetra_Comm &communicator);
1009
1032 void
1033 destroy_communicator(Epetra_Comm &communicator);
1034
1043 unsigned int
1044 get_n_mpi_processes(const Epetra_Comm &mpi_communicator);
1045
1052 unsigned int
1053 get_this_mpi_process(const Epetra_Comm &mpi_communicator);
1054
1065 Epetra_Map
1066 duplicate_map(const Epetra_BlockMap &map, const Epetra_Comm &comm);
1067 } // namespace Trilinos
1068
1069#endif
1070
1071
1072} // namespace Utilities
1073
1074
1075// --------------------- inline functions
1076
1077namespace Utilities
1078{
1079 template <int N, typename T>
1080 inline T
1082 {
1083 Assert(
1084 !std::is_integral<T>::value || (N >= 0),
1085 ExcMessage(
1086 "The non-type template parameter N must be a non-negative integer for integral type T"));
1087
1088 if (N == 0)
1089 return T(1.);
1090 else if (N < 0)
1091 return T(1.) / fixed_power<-N>(x);
1092 else
1093 // Use exponentiation by squaring:
1094 return ((N % 2 == 1) ? x * fixed_power<N / 2>(x * x) :
1095 fixed_power<N / 2>(x * x));
1096 }
1097
1098
1099
1100 template <class T>
1101 inline std::string
1103 {
1104 return boost::core::demangle(typeid(t).name());
1105 }
1106
1107
1108
1109 template <typename Iterator, typename T>
1110 inline Iterator
1111 lower_bound(Iterator first, Iterator last, const T &val)
1112 {
1113 return Utilities::lower_bound(first, last, val, std::less<T>());
1114 }
1115
1116
1117
1118 template <typename Iterator, typename T, typename Comp>
1119 inline Iterator
1120 lower_bound(Iterator first, Iterator last, const T &val, const Comp comp)
1121 {
1122 // verify that the two iterators are properly ordered. since
1123 // we need operator- for the iterator type anyway, do the
1124 // test as follows, rather than via 'last >= first'
1125 Assert(last - first >= 0,
1126 ExcMessage(
1127 "The given iterators do not satisfy the proper ordering."));
1128
1129 unsigned int len = static_cast<unsigned int>(last - first);
1130
1131 if (len == 0)
1132 return first;
1133
1134 while (true)
1135 {
1136 // if length equals 8 or less,
1137 // then do a rolled out
1138 // search. use a switch without
1139 // breaks for that and roll-out
1140 // the loop somehow
1141 if (len < 8)
1142 {
1143 switch (len)
1144 {
1145 case 7:
1146 if (!comp(*first, val))
1147 return first;
1148 ++first;
1150 case 6:
1151 if (!comp(*first, val))
1152 return first;
1153 ++first;
1155 case 5:
1156 if (!comp(*first, val))
1157 return first;
1158 ++first;
1160 case 4:
1161 if (!comp(*first, val))
1162 return first;
1163 ++first;
1165 case 3:
1166 if (!comp(*first, val))
1167 return first;
1168 ++first;
1170 case 2:
1171 if (!comp(*first, val))
1172 return first;
1173 ++first;
1175 case 1:
1176 if (!comp(*first, val))
1177 return first;
1178 return first + 1;
1179 default:
1180 // indices seem
1181 // to not be
1182 // sorted
1183 // correctly!? or
1184 // did len
1185 // become==0
1186 // somehow? that
1187 // shouldn't have
1188 // happened
1189 Assert(false, ExcInternalError());
1190 }
1191 }
1192
1193
1194
1195 const unsigned int half = len >> 1;
1196 const Iterator middle = first + half;
1197
1198 // if the value is larger than
1199 // that pointed to by the
1200 // middle pointer, then the
1201 // insertion point must be
1202 // right of it
1203 if (comp(*middle, val))
1204 {
1205 first = middle + 1;
1206 len -= half + 1;
1207 }
1208 else
1209 len = half;
1210 }
1211 }
1212
1213
1214 // --------------------- non-inline functions
1215
1216 template <typename T>
1217 size_t
1218 pack(const T & object,
1219 std::vector<char> &dest_buffer,
1220 const bool allow_compression)
1221 {
1222 std::size_t size = 0;
1223
1224 // see if the object is small and copyable via memcpy. if so, use
1225 // this fast path. otherwise, we have to go through the BOOST
1226 // serialization machinery
1227#ifdef DEAL_II_HAVE_CXX17
1228 if constexpr (std::is_trivially_copyable<T>() && sizeof(T) < 256)
1229#else
1230 if (std::is_trivially_copyable<T>() && sizeof(T) < 256)
1231#endif
1232 {
1233 (void)allow_compression;
1234 const std::size_t previous_size = dest_buffer.size();
1235 dest_buffer.resize(previous_size + sizeof(T));
1236
1237 std::memcpy(dest_buffer.data() + previous_size, &object, sizeof(T));
1238
1239 size = sizeof(T);
1240 }
1241 else
1242 {
1243 // use buffer as the target of a compressing
1244 // stream into which we serialize the current object
1245 const std::size_t previous_size = dest_buffer.size();
1246 {
1247 boost::iostreams::filtering_ostreambuf fosb;
1248#ifdef DEAL_II_WITH_ZLIB
1249 if (allow_compression)
1250 fosb.push(boost::iostreams::gzip_compressor());
1251#else
1252 (void)allow_compression;
1253#endif
1254 fosb.push(boost::iostreams::back_inserter(dest_buffer));
1255
1256 boost::archive::binary_oarchive boa(fosb);
1257 boa << object;
1258 // the stream object has to be destroyed before the return statement
1259 // to ensure that all data has been written in the buffer
1260 }
1261 size = dest_buffer.size() - previous_size;
1262 }
1263
1264 return size;
1265 }
1266
1267
1268 template <typename T>
1269 std::vector<char>
1270 pack(const T &object, const bool allow_compression)
1271 {
1272 std::vector<char> buffer;
1273 pack<T>(object, buffer, allow_compression);
1274 return buffer;
1275 }
1276
1277
1278 template <typename T>
1279 T
1280 unpack(const std::vector<char>::const_iterator &cbegin,
1281 const std::vector<char>::const_iterator &cend,
1282 const bool allow_compression)
1283 {
1284 T object;
1285
1286 // see if the object is small and copyable via memcpy. if so, use
1287 // this fast path. otherwise, we have to go through the BOOST
1288 // serialization machinery
1289#ifdef DEAL_II_HAVE_CXX17
1290 if constexpr (std::is_trivially_copyable<T>() && sizeof(T) < 256)
1291#else
1292 if (std::is_trivially_copyable<T>() && sizeof(T) < 256)
1293#endif
1294 {
1295 (void)allow_compression;
1296 Assert(std::distance(cbegin, cend) == sizeof(T), ExcInternalError());
1297 std::memcpy(&object, &*cbegin, sizeof(T));
1298 }
1299 else
1300 {
1301 // decompress the buffer section into the object
1302 boost::iostreams::filtering_istreambuf fisb;
1303#ifdef DEAL_II_WITH_ZLIB
1304 if (allow_compression)
1305 fisb.push(boost::iostreams::gzip_decompressor());
1306#else
1307 (void)allow_compression;
1308#endif
1309 fisb.push(boost::iostreams::array_source(&*cbegin, &*cend));
1310
1311 boost::archive::binary_iarchive bia(fisb);
1312 bia >> object;
1313 }
1314
1315 return object;
1316 }
1317
1318
1319 template <typename T>
1320 T
1321 unpack(const std::vector<char> &buffer, const bool allow_compression)
1322 {
1323 return unpack<T>(buffer.cbegin(), buffer.cend(), allow_compression);
1324 }
1325
1326
1327 template <typename T, int N>
1328 void
1329 unpack(const std::vector<char>::const_iterator &cbegin,
1330 const std::vector<char>::const_iterator &cend,
1331 T (&unpacked_object)[N],
1332 const bool allow_compression)
1333 {
1334 // see if the object is small and copyable via memcpy. if so, use
1335 // this fast path. otherwise, we have to go through the BOOST
1336 // serialization machinery
1337 if (std::is_trivially_copyable<T>() && sizeof(T) * N < 256)
1338 {
1339 Assert(std::distance(cbegin, cend) == sizeof(T) * N,
1341 std::memcpy(unpacked_object, &*cbegin, sizeof(T) * N);
1342 }
1343 else
1344 {
1345 // decompress the buffer section into the object
1346 boost::iostreams::filtering_istreambuf fisb;
1347#ifdef DEAL_II_WITH_ZLIB
1348 if (allow_compression)
1349 fisb.push(boost::iostreams::gzip_decompressor());
1350#else
1351 (void)allow_compression;
1352#endif
1353 fisb.push(boost::iostreams::array_source(&*cbegin, &*cend));
1354
1355 boost::archive::binary_iarchive bia(fisb);
1356 bia >> unpacked_object;
1357 }
1358 }
1359
1360
1361 template <typename T, int N>
1362 void
1363 unpack(const std::vector<char> &buffer,
1364 T (&unpacked_object)[N],
1365 const bool allow_compression)
1366 {
1367 unpack<T, N>(buffer.cbegin(),
1368 buffer.cend(),
1369 unpacked_object,
1370 allow_compression);
1371 }
1372
1373
1374
1375 inline bool
1376 get_bit(const unsigned char number, const unsigned int n)
1377 {
1378 AssertIndexRange(n, 8);
1379
1380 // source:
1381 // https://stackoverflow.com/questions/47981/how-do-you-set-clear-and-toggle-a-single-bit
1382 // "Checking a bit"
1383 return (number >> n) & 1U;
1384 }
1385
1386
1387
1388 inline void
1389 set_bit(unsigned char &number, const unsigned int n, const bool x)
1390 {
1391 AssertIndexRange(n, 8);
1392
1393 // source:
1394 // https://stackoverflow.com/questions/47981/how-do-you-set-clear-and-toggle-a-single-bit
1395 // "Changing the nth bit to x"
1396 number ^= (-static_cast<unsigned char>(x) ^ number) & (1U << n);
1397 }
1398
1399
1400
1401 template <typename To, typename From>
1402 inline std::unique_ptr<To>
1403 dynamic_unique_cast(std::unique_ptr<From> &&p)
1404 {
1405 // Let's see if we can cast from 'From' to 'To'. If so, do the cast,
1406 // and then release the pointer from the old
1407 // owner
1408 if (To *cast = dynamic_cast<To *>(p.get()))
1409 {
1410 std::unique_ptr<To> result(cast);
1411 p.release();
1412 return result;
1413 }
1414 else
1415 throw std::bad_cast();
1416 }
1417
1418
1419
1420 template <typename T>
1421 inline T &
1423 {
1424 return p;
1425 }
1426
1427
1428
1429 template <typename T>
1430 inline T &
1431 get_underlying_value(std::shared_ptr<T> &p)
1432 {
1433 return *p;
1434 }
1435
1436
1437
1438 template <typename T>
1439 inline T &
1440 get_underlying_value(const std::shared_ptr<T> &p)
1441 {
1442 return *p;
1443 }
1444
1445
1446
1447 template <typename T>
1448 inline T &
1449 get_underlying_value(std::unique_ptr<T> &p)
1450 {
1451 return *p;
1452 }
1453
1454
1455
1456 template <typename T>
1457 inline T &
1458 get_underlying_value(const std::unique_ptr<T> &p)
1459 {
1460 return *p;
1461 }
1462
1463
1464
1465 template <typename Integer>
1466 std::vector<Integer>
1467 reverse_permutation(const std::vector<Integer> &permutation)
1468 {
1469 const std::size_t n = permutation.size();
1470
1471 std::vector<Integer> out(n);
1472 for (std::size_t i = 0; i < n; ++i)
1473 out[i] = n - 1 - permutation[i];
1474
1475 return out;
1476 }
1477
1478
1479
1480 template <typename Integer>
1481 std::vector<Integer>
1482 invert_permutation(const std::vector<Integer> &permutation)
1483 {
1484 const std::size_t n = permutation.size();
1485
1486 std::vector<Integer> out(n, numbers::invalid_unsigned_int);
1487
1488 for (std::size_t i = 0; i < n; ++i)
1489 {
1490 AssertIndexRange(permutation[i], n);
1491 out[permutation[i]] = i;
1492 }
1493
1494 // check that we have actually reached
1495 // all indices
1496 for (std::size_t i = 0; i < n; ++i)
1498 ExcMessage("The given input permutation had duplicate entries!"));
1499
1500 return out;
1501 }
1502} // namespace Utilities
1503
1504
1506
1507#ifndef DOXYGEN
1508namespace boost
1509{
1510 namespace serialization
1511 {
1512 // Provides boost and c++11 with a way to serialize tuples and pairs
1513 // automatically.
1514 template <int N>
1515 struct Serialize
1516 {
1517 template <class Archive, typename... Args>
1518 static void
1519 serialize(Archive &ar, std::tuple<Args...> &t, const unsigned int version)
1520 {
1521 ar &std::get<N - 1>(t);
1522 Serialize<N - 1>::serialize(ar, t, version);
1523 }
1524 };
1525
1526 template <>
1527 struct Serialize<0>
1528 {
1529 template <class Archive, typename... Args>
1530 static void
1531 serialize(Archive &ar, std::tuple<Args...> &t, const unsigned int version)
1532 {
1533 (void)ar;
1534 (void)t;
1535 (void)version;
1536 }
1537 };
1538
1539 template <class Archive, typename... Args>
1540 void
1541 serialize(Archive &ar, std::tuple<Args...> &t, const unsigned int version)
1542 {
1543 Serialize<sizeof...(Args)>::serialize(ar, t, version);
1544 }
1545 } // namespace serialization
1546} // namespace boost
1547#endif
1548
1549#endif
Definition: point.h:111
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:402
#define DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
Definition: config.h:416
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:403
#define DEAL_II_FALLTHROUGH
Definition: config.h:171
#define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
Definition: config.h:454
Point< 2 > first
Definition: grid_out.cc:4587
#define Assert(cond, exc)
Definition: exceptions.h:1465
#define AssertIndexRange(index, range)
Definition: exceptions.h:1690
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)
static const char T
static const char N
void get_memory_stats(MemoryStats &stats)
Definition: utilities.cc:970
std::string get_hostname()
Definition: utilities.cc:1004
std::string get_time()
Definition: utilities.cc:1019
void posix_memalign(void **memptr, std::size_t alignment, std::size_t size)
Definition: utilities.cc:1050
double get_cpu_load()
Definition: utilities.cc:936
const std::string get_current_vectorization_level()
Definition: utilities.cc:944
std::string get_date()
Definition: utilities.cc:1035
void destroy_communicator(Epetra_Comm &communicator)
Definition: utilities.cc:1156
Epetra_Map duplicate_map(const Epetra_BlockMap &map, const Epetra_Comm &comm)
Definition: utilities.cc:1190
unsigned int get_this_mpi_process(const Epetra_Comm &mpi_communicator)
Definition: utilities.cc:1182
unsigned int get_n_mpi_processes(const Epetra_Comm &mpi_communicator)
Definition: utilities.cc:1175
const Epetra_Comm & comm_self()
Definition: utilities.cc:1113
const Teuchos::RCP< const Teuchos::Comm< int > > & tpetra_comm_self()
Definition: utilities.cc:1097
Epetra_Comm * duplicate_communicator(const Epetra_Comm &communicator)
Definition: utilities.cc:1129
const Epetra_Comm & comm_world()
Definition: utilities.cc:1081
constexpr T pow(const T base, const int iexp)
Definition: utilities.h:461
std::vector< std::string > split_string_list(const std::string &s, const std::string &delimiter=",")
Definition: utilities.cc:704
T & get_underlying_value(T &p)
Definition: utilities.h:1422
Number truncate_to_n_digits(const Number number, const unsigned int n_digits)
Definition: utilities.cc:581
std::string type_to_string(const T &t)
Definition: utilities.h:1102
size_t pack(const T &object, std::vector< char > &dest_buffer, const bool allow_compression=true)
Definition: utilities.h:1218
std::string dim_string(const int dim, const int spacedim)
Definition: utilities.cc:558
std::uint64_t pack_integers(const std::array< std::uint64_t, dim > &index, const int bits_per_dim)
Definition: utilities.cc:369
bool get_bit(const unsigned char number, const unsigned int n)
Definition: utilities.h:1376
std::pair< int, unsigned int > get_integer_at_position(const std::string &name, const unsigned int position)
Definition: utilities.cc:853
std::string encode_base64(const std::vector< unsigned char > &binary_input)
Definition: utilities.cc:436
std::unique_ptr< To > dynamic_unique_cast(std::unique_ptr< From > &&p)
Definition: utilities.h:1403
std::string replace_in_string(const std::string &input, const std::string &from, const std::string &to)
Definition: utilities.cc:512
std::vector< unsigned char > decode_base64(const std::string &base64_input)
Definition: utilities.cc:449
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 to_string(const number value, const unsigned int digits=numbers::invalid_unsigned_int)
Definition: utilities.cc:482
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
std::string compress(const std::string &input)
Definition: utilities.cc:392
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
Definition: utilities.cc:473
bool match_at_string_start(const std::string &name, const std::string &pattern)
Definition: utilities.cc:838
T unpack(const std::vector< char > &buffer, const bool allow_compression=true)
Definition: utilities.h:1321
T fixed_power(const T t)
Definition: utilities.h:1081
std::string decompress(const std::string &compressed_input)
Definition: utilities.cc:414
unsigned int needed_digits(const unsigned int max_number)
Definition: utilities.cc:568
Iterator lower_bound(Iterator first, Iterator last, const T &val)
Definition: utilities.h:1111
double string_to_double(const std::string &s)
Definition: utilities.cc:656
std::string dealii_version_string()
Definition: utilities.cc:97
void set_bit(unsigned char &number, const unsigned int n, const bool x)
Definition: utilities.h:1389
std::string trim(const std::string &input)
Definition: utilities.cc:531
double generate_normal_random_number(const double a, const double sigma)
Definition: utilities.cc:895
std::vector< Integer > reverse_permutation(const std::vector< Integer > &permutation)
Definition: utilities.h:1467
std::vector< Integer > invert_permutation(const std::vector< Integer > &permutation)
Definition: utilities.h:1482
int string_to_int(const std::string &s)
Definition: utilities.cc:608
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:1352
static const unsigned int invalid_unsigned_int
Definition: types.h:196
*braid_SplitCommworld & comm
unsigned long int VmRSS
Definition: utilities.h:881
unsigned long int VmPeak
Definition: utilities.h:865
unsigned long int VmSize
Definition: utilities.h:870
unsigned long int VmHWM
Definition: utilities.h:875