Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/dolfinx/v0.9.0/cpp/doxygen/d7/de1/namespacedolfinx_1_1common.html
DOLFINx  0.4.1
DOLFINx C++ interface
Classes | Functions
dolfinx::common Namespace Reference

Miscellaneous classes, functions and types. More...

Classes

class  IndexMap
 This class represents the distribution index arrays across processes. An index array is a contiguous collection of N+1 indices [0, 1, . . ., N] that are distributed across M processes. On a given process, the IndexMap stores a portion of the index set using local indices [0, 1, . . . , n], and a map from the local indices to a unique global index. More...
 
class  TimeLogger
 Timer logging. More...
 
class  TimeLogManager
 Logger initialisation. More...
 
class  Timer
 A timer can be used for timing tasks. The basic usage is. More...
 

Functions

std::vector< int32_t > compute_owned_indices (const xtl::span< const std::int32_t > &indices, const IndexMap &map)
 Given a vector of indices (local numbering, owned or ghost) and an index map, this function returns the indices owned by this process, including indices that might have been in the list of indices on another processes. More...
 
std::tuple< std::int64_t, std::vector< std::int32_t >, std::vector< std::vector< std::int64_t > >, std::vector< std::vector< int > > > stack_index_maps (const std::vector< std::pair< std::reference_wrapper< const common::IndexMap >, int >> &maps)
 Compute layout data and ghost indices for a stacked (concatenated) index map, i.e. 'splice' multiple maps into one. Communication is required to compute the new ghost indices. More...
 
template<typename U , typename V >
std::pair< std::vector< typename U::value_type >, std::vector< typename V::value_type > > sort_unique (const U &indices, const V &values)
 Sort two arrays based on the values in array indices. Any duplicate indices and the corresponding value are removed. In the case of duplicates, the entry with the smallest value is retained. More...
 
template<class T >
std::size_t hash_local (const T &x)
 Compute a hash of a given object. More...
 
template<class T >
std::size_t hash_global (MPI_Comm comm, const T &x)
 Compute a hash for a distributed (MPI) object. More...
 

Detailed Description

Miscellaneous classes, functions and types.

This namespace provides utility type functions for managing subsystems, convenience classes and library-wide typedefs.

Function Documentation

◆ compute_owned_indices()

std::vector< int32_t > compute_owned_indices ( const xtl::span< const std::int32_t > &  indices,
const IndexMap map 
)

Given a vector of indices (local numbering, owned or ghost) and an index map, this function returns the indices owned by this process, including indices that might have been in the list of indices on another processes.

Parameters
[in]indicesList of indices
[in]mapThe index map
Returns
Vector of indices owned by the process

◆ hash_global()

std::size_t dolfinx::common::hash_global ( MPI_Comm  comm,
const T &  x 
)

Compute a hash for a distributed (MPI) object.

A hash is computed on each process for the local part of the obejct. Then, a hash of the std::vector containing each local hash key in rank order is returned.

Note
Collective
Parameters
[in]commThe communicator on which to compute the hash.
[in]xThe object to compute a hash of.
Returns
The hash values.

◆ hash_local()

std::size_t dolfinx::common::hash_local ( const T &  x)

Compute a hash of a given object.

The hash is computed using Boost container hash (https://www.boost.org/doc/libs/release/libs/container_hash/).

Parameters
[in]xThe object to compute a hash of.
Returns
The hash values.

◆ sort_unique()

std::pair<std::vector<typename U::value_type>, std::vector<typename V::value_type> > dolfinx::common::sort_unique ( const U &  indices,
const V &  values 
)

Sort two arrays based on the values in array indices. Any duplicate indices and the corresponding value are removed. In the case of duplicates, the entry with the smallest value is retained.

Parameters
[in]indicesArray of indices
[in]valuesArray of values
Returns
Sorted (indices, values), with sorting based on indices

◆ stack_index_maps()

std::tuple< std::int64_t, std::vector< std::int32_t >, std::vector< std::vector< std::int64_t > >, std::vector< std::vector< int > > > stack_index_maps ( const std::vector< std::pair< std::reference_wrapper< const common::IndexMap >, int >> &  maps)

Compute layout data and ghost indices for a stacked (concatenated) index map, i.e. 'splice' multiple maps into one. Communication is required to compute the new ghost indices.

Parameters
[in]mapsList of (index map, block size) pairs
Returns
The (0) global offset of a stacked map for this rank, (1) local offset for each submap in the stacked map, and (2) new indices for the ghosts for each submap (3) owner rank of each ghost entry for each submap

Build arrays from old ghost index to composite ghost index for each field