24#ifndef __DOLFIN_UTILS_H
25#define __DOLFIN_UTILS_H
32#include <boost/functional/hash.hpp>
33#include <dolfin/common/MPI.h>
39 std::string
indent(std::string block);
45 int precision,
int linebreak=0)
48 s.precision(precision);
54 for (
auto it = x.begin() + 1; it != x.end(); ++it)
55 s << delimiter << *it;
59 for (
unsigned int i = 0 ; i != x.size(); ++i)
61 if ((i + 1)%linebreak == 0)
62 s << x[i] << std::endl;
64 s << x[i] << delimiter;
72 std::string
to_string(
const double* x, std::size_t n);
92 std::vector<std::size_t> all_hashes;
93 std::vector<std::size_t> local_hash_tmp(1, local_hash);
97 boost::hash<std::vector<std::size_t>> hash;
98 std::size_t global_hash = hash(all_hashes);
static void broadcast(MPI_Comm comm, std::vector< T > &value, unsigned int broadcaster=0)
Broadcast vector of value from broadcaster to all processes.
Definition MPI.h:320
static void gather(MPI_Comm comm, const std::vector< T > &in_values, std::vector< T > &out_values, unsigned int receiving_process=0)
Gather values on one process.
Definition MPI.h:598
std::size_t hash_global(const MPI_Comm mpi_comm, const T &x)
Definition utils.h:86
std::string container_to_string(const T &x, std::string delimiter, int precision, int linebreak=0)
Definition utils.h:44
std::string to_string(const double *x, std::size_t n)
Return string representation of given array.
Definition utils.cpp:42
std::string indent(std::string block)
Indent string block.
Definition utils.cpp:26
std::size_t hash_local(const T &x)
Return a hash of a given object.
Definition utils.h:76