Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/v0.1.0/v0.9.0/cpp
DOLFINx  0.1.0
DOLFINx C++ interface
Namespaces | Classes | Functions
dolfinx::common Namespace Reference

Miscellaneous classes, functions and types. More...

Namespaces

 subsystem
 Function in this namesspace are convenience functtions for the initialisation and finalisation of various sub systems, such as MPI and PETSc.
 

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...
 
class  UniqueIdGenerator
 This is a singleton class that return IDs that are unique in the lifetime of a program. More...
 

Functions

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< U, V > 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...
 
std::string indent (std::string block)
 Indent string block.
 
template<typename T >
std::string container_to_string (const T &x, const int precision, const int linebreak)
 Convert a container to string.
 
template<class T >
std::size_t hash_local (const T &x)
 Return a hash of a given object.
 
template<class T >
std::int64_t hash_global (const MPI_Comm comm, const T &x)
 Return a hash for a distributed (MPI) object. A hash is computed on each process, and the hash of the std::vector of all local hash keys is returned. This function is collective.
 

Detailed Description

Miscellaneous classes, functions and types.

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

Function Documentation

◆ sort_unique()

template<typename U , typename V >
std::pair<U, V> 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 > > > dolfinx::common::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