dolfin/common

Documentation for C++ code found in dolfin/common/*.h

Type definitions

la_index

C++ documentation for la_index from dolfin/common/types.h:

type dolfin::la_index

Index type for compatibility with linear algebra backend(s)

Enumerations

TimingClear

C++ documentation for TimingClear from dolfin/common/timing.h:

enum dolfin::TimingClear

Parameter specifying whether to clear timing(s):

  • TimingClear::keep
  • TimingClear::clear
enumerator dolfin::TimingClear::keep = false
enumerator dolfin::TimingClear::clear = true

TimingType

C++ documentation for TimingType from dolfin/common/timing.h:

enum dolfin::TimingType

Timing types:

  • TimingType::wall wall-clock time
  • TimingType::user user (cpu) time
  • TimingType::system system (kernel) time

Precision of wall is around 1 microsecond, user and system are around 10 millisecond (on Linux).

enumerator dolfin::TimingType::wall = 0
enumerator dolfin::TimingType::user = 1
enumerator dolfin::TimingType::system = 2

Functions

container_to_string

C++ documentation for container_to_string from dolfin/common/utils.h:

std::string dolfin::container_to_string(const T &x, std::string delimiter, int precision, int linebreak = 0)

Return string representation of given container of ints, floats, etc.

Parameters:
  • x
  • delimiter
  • precision
  • linebreak

dolfin_version

C++ documentation for dolfin_version from dolfin/common/defines.h:

std::string dolfin::dolfin_version()

Return DOLFIN version string.

dump_timings_to_xml

C++ documentation for dump_timings_to_xml from dolfin/common/timing.h:

void dolfin::dump_timings_to_xml(std::string filename, TimingClear clear)

Dump a summary of timings and tasks to XML file, optionally clearing stored timings. MPI_MAX , MPI_MIN and MPI_AVG reductions are stored. Collective on MPI_COMM_WORLD . Arguments filename (std::string) output filename; must have .xml suffix; existing file is silently overwritten clear (TimingClear)

  • TimingClear::clear resets stored timings
  • TimingClear::keep leaves stored timings intact
Parameters:
  • filename
  • clear

git_commit_hash

C++ documentation for git_commit_hash from dolfin/common/defines.h:

std::string dolfin::git_commit_hash()

Return git changeset hash (returns “unknown” if changeset is not known)

has_cholmod

C++ documentation for has_cholmod from dolfin/common/defines.h:

bool dolfin::has_cholmod()

Return true if DOLFIN is compiled with Cholmod.

has_debug

C++ documentation for has_debug from dolfin/common/defines.h:

bool dolfin::has_debug()

Return true if DOLFIN is compiled in debugging mode, i.e., with assertions on

has_hdf5

C++ documentation for has_hdf5 from dolfin/common/defines.h:

bool dolfin::has_hdf5()

Return true if DOLFIN is compiled with HDF5.

has_hdf5_parallel

C++ documentation for has_hdf5_parallel from dolfin/common/defines.h:

bool dolfin::has_hdf5_parallel()

Return true if DOLFIN is compiled with Parallel HDF5.

has_mpi

C++ documentation for has_mpi from dolfin/common/defines.h:

bool dolfin::has_mpi()

Return true if DOLFIN is compiled with MPI .

has_openmp

C++ documentation for has_openmp from dolfin/common/defines.h:

bool dolfin::has_openmp()

Return true if DOLFIN is compiled with OpenMP.

has_parmetis

C++ documentation for has_parmetis from dolfin/common/defines.h:

bool dolfin::has_parmetis()

Return true if DOLFIN is compiled with ParMETIS .

has_petsc

C++ documentation for has_petsc from dolfin/common/defines.h:

bool dolfin::has_petsc()

Return true if DOLFIN is compiled with PETSc.

has_scotch

C++ documentation for has_scotch from dolfin/common/defines.h:

bool dolfin::has_scotch()

Return true if DOLFIN is compiled with Scotch.

has_slepc

C++ documentation for has_slepc from dolfin/common/defines.h:

bool dolfin::has_slepc()

Return true if DOLFIN is compiled with SLEPc.

has_umfpack

C++ documentation for has_umfpack from dolfin/common/defines.h:

bool dolfin::has_umfpack()

Return true if DOLFIN is compiled with Umfpack.

has_zlib

C++ documentation for has_zlib from dolfin/common/defines.h:

bool dolfin::has_zlib()

Return true if DOLFIN is compiled with ZLIB.

hash_global

C++ documentation for hash_global from dolfin/common/utils.h:

std::size_t dolfin::hash_global(const MPI_Comm mpi_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.

Parameters:
  • mpi_comm
  • x

hash_local

C++ documentation for hash_local from dolfin/common/utils.h:

std::size_t dolfin::hash_local(const T &x)

Return a hash of a given object.

Parameters:x

indent

C++ documentation for indent from dolfin/common/utils.h:

std::string dolfin::indent(std::string block)

Indent string block.

Parameters:block

init

C++ documentation for init from dolfin/common/init.h:

void dolfin::init(int argc, char *argv[])

Initialize DOLFIN (and PETSc) with command-line arguments. This should not be needed in most cases since the initialization is otherwise handled automatically.

Parameters:
  • argc
  • argv

list_timings

C++ documentation for list_timings from dolfin/common/timing.h:

void dolfin::list_timings(TimingClear clear, std::set<TimingType> type)

List a summary of timings and tasks, optionally clearing stored timings. MPI_AVG reduction is printed. Collective on MPI_COMM_WORLD . Arguments clear (TimingClear)

  • TimingClear::clear resets stored timings
  • TimingClear::keep leaves stored timings intact type (std::set<TimingType>) subset of { TimingType::wall, TimingType::user, TimingType::system }
Parameters:
  • clear
  • type

reference_to_no_delete_pointer

C++ documentation for reference_to_no_delete_pointer from dolfin/common/NoDeleter.h:

std::shared_ptr<T> dolfin::reference_to_no_delete_pointer(T &r)

Helper function to construct shared pointer with NoDeleter with cleaner syntax.

Parameters:r

sizeof_la_index

C++ documentation for sizeof_la_index from dolfin/common/defines.h:

std::size_t dolfin::sizeof_la_index()

Return sizeof the dolfin::la_index type.

tic

C++ documentation for tic from dolfin/common/timing.h:

void dolfin::tic()

Start timing (should not be used internally in DOLFIN!)

time

C++ documentation for time from dolfin/common/timing.h:

double dolfin::time()

Return wall time elapsed since some implementation dependent epoch.

timing

C++ documentation for timing from dolfin/common/timing.h:

std::tuple<std::size_t, double, double, double> dolfin::timing(std::string task, TimingClear clear)

Return timing (count, total wall time, total user time, total system time) for given task, optionally clearing all timings for the task Arguments task (std::string) name of a task clear (TimingClear)

  • TimingClear::clear resets stored timings
  • TimingClear::keep leaves stored timings intact

Returns std::tuple<std::size_t, double, double, double> (count, total wall time, total user time, total system time)

Parameters:
  • task
  • clear

timings

C++ documentation for timings from dolfin/common/timing.h:

Table dolfin::timings(TimingClear clear, std::set<TimingType> type)

Return a summary of timings and tasks in a Table , optionally clearing stored timings Arguments clear (TimingClear)

  • TimingClear::clear resets stored timings
  • TimingClear::keep leaves stored timings intact type (std::set<TimingType>) subset of { TimingType::wall, TimingType::user, TimingType::system }

Returns:cpp:any:Table Table with timings

Parameters:
  • clear
  • type

to_string

C++ documentation for to_string from dolfin/common/utils.h:

std::string dolfin::to_string(const double *x, std::size_t n)

Return string representation of given array.

Parameters:
  • x
  • n

toc

C++ documentation for toc from dolfin/common/timing.h:

double dolfin::toc()

Return elapsed wall time (should not be used internally in DOLFIN!)

ufc_signature

C++ documentation for ufc_signature from dolfin/common/defines.h:

std::string dolfin::ufc_signature()

Return UFC signature string.

Classes

Array

C++ documentation for Array from dolfin/common/Array.h:

class dolfin::Array

This class provides a simple wrapper for a pointer to an array. A purpose of this class is to enable the simple and safe exchange of data between C++ and Python.

dolfin::Array::Array(const Array &other) = delete

Disable copy construction, to avoid unanticipated sharing or copying of data. This means that an Array() must always be passed as reference, or as a (possibly shared) pointer.

Parameters:other
dolfin::Array::Array(std::size_t N)

Create array of size N. Array() has ownership.

Parameters:N
dolfin::Array::Array(std::size_t N, T *x)

Construct array from a pointer. Array() does not take ownership.

Parameters:
  • N
  • x
T *dolfin::Array::data()

Return pointer to data (non-const version)

const T *dolfin::Array::data() const

Return pointer to data (const version)

T &dolfin::Array::operator[](std::size_t i)

Access value of given entry (non-const version)

Parameters:i
const T &dolfin::Array::operator[](std::size_t i) const

Access value of given entry (const version)

Parameters:i
std::size_t dolfin::Array::size() const

Return size of array.

std::string dolfin::Array::str(bool verbose) const

Return informal string representation (pretty-print). Note that the Array class is not a subclass of Variable (for efficiency) which means that one needs to call str() directly instead of using the info() function on Array objects.

Parameters:verbose
dolfin::Array::~Array()

Destructor.

ArrayView

C++ documentation for ArrayView from dolfin/common/ArrayView.h:

class dolfin::ArrayView

This class provides a wrapper for a pointer to an array. It never owns the data, and will not be valid if the underlying data goes out-of-scope.

dolfin::ArrayView::ArrayView()

Constructor.

dolfin::ArrayView::ArrayView(V &v)

Construct array from a container with the the data() and size() functions

Parameters:v
dolfin::ArrayView::ArrayView(const ArrayView &x)

Copy constructor.

Parameters:x
dolfin::ArrayView::ArrayView(std::size_t N, T *x)

Construct array from a pointer. Array does not take ownership.

Parameters:
  • N
  • x
T *dolfin::ArrayView::begin()

Pointer to start of array.

const T *dolfin::ArrayView::begin() const

Pointer to start of array (const)

T *dolfin::ArrayView::data()

Return pointer to data (non-const version)

const T *dolfin::ArrayView::data() const

Return pointer to data (const version)

bool dolfin::ArrayView::empty() const

Test if array view is empty.

T *dolfin::ArrayView::end()

Pointer to beyond end of array.

const T *dolfin::ArrayView::end() const

Pointer to beyond end of array (const)

T &dolfin::ArrayView::operator[](std::size_t i)

Access value of given entry (non-const version)

Parameters:i
const T &dolfin::ArrayView::operator[](std::size_t i) const

Access value of given entry (const version)

Parameters:i
void dolfin::ArrayView::set(V &v)

Update object to point to new container.

Parameters:v
void dolfin::ArrayView::set(std::size_t N, T *x)

Update object to point to new data.

Parameters:
  • N
  • x
std::size_t dolfin::ArrayView::size() const

Return size of array.

dolfin::ArrayView::~ArrayView()

Destructor.

Hierarchical

C++ documentation for Hierarchical from dolfin/common/Hierarchical.h:

class dolfin::Hierarchical

This class provides storage and data access for hierarchical classes; that is, classes where an object may have a child and a parent. Note to developers: each subclass of Hierarchical that implements an assignment operator must call the base class assignment operator at the end of the subclass assignment operator. See the Mesh class for an example.

dolfin::Hierarchical::Hierarchical(T &self)

Constructor.

Parameters:self
T &dolfin::Hierarchical::child()

Return child in hierarchy. An error is thrown if the object has no child. ReturnsT The child object.

const T &dolfin::Hierarchical::child() const

Return child in hierarchy (const version).

std::shared_ptr<T> dolfin::Hierarchical::child_shared_ptr()

Return shared pointer to child. A zero pointer is returned if the object has no child. Returns shared_ptr<T> The child object.

std::shared_ptr<const T> dolfin::Hierarchical::child_shared_ptr() const

Return shared pointer to child (const version).

void dolfin::Hierarchical::clear_child()

Clear child.

std::size_t dolfin::Hierarchical::depth() const

Return depth of the hierarchy; that is, the total number of objects in the hierarchy linked to the current object via child-parent relationships, including the object itself. Returns std::size_t The depth of the hierarchy.

bool dolfin::Hierarchical::has_child() const

Check if the object has a child. Returns bool The return value is true iff the object has a child.

bool dolfin::Hierarchical::has_parent() const

Check if the object has a parent. Returns bool The return value is true iff the object has a parent.

T &dolfin::Hierarchical::leaf_node()

Return leaf node object in hierarchy. ReturnsT The leaf node object.

const T &dolfin::Hierarchical::leaf_node() const

Return leaf node object in hierarchy (const version).

std::shared_ptr<T> dolfin::Hierarchical::leaf_node_shared_ptr()

Return shared pointer to leaf node object in hierarchy. ReturnsT The leaf node object.

std::shared_ptr<const T> dolfin::Hierarchical::leaf_node_shared_ptr() const

Return shared pointer to leaf node object in hierarchy (const version).

const Hierarchical &dolfin::Hierarchical::operator=(const Hierarchical &hierarchical)

Assignment operator.

Parameters:hierarchical
T &dolfin::Hierarchical::parent()

Return parent in hierarchy. An error is thrown if the object has no parent. ReturnsObject The parent object.

const T &dolfin::Hierarchical::parent() const

Return parent in hierarchy (const version).

std::shared_ptr<T> dolfin::Hierarchical::parent_shared_ptr()

Return shared pointer to parent. A zero pointer is returned if the object has no parent. Returns shared_ptr<T> The parent object.

std::shared_ptr<const T> dolfin::Hierarchical::parent_shared_ptr() const

Return shared pointer to parent (const version).

T &dolfin::Hierarchical::root_node()

Return root node object in hierarchy. ReturnsT The root node object.

const T &dolfin::Hierarchical::root_node() const

Return root node object in hierarchy (const version).

std::shared_ptr<T> dolfin::Hierarchical::root_node_shared_ptr()

Return shared pointer to root node object in hierarchy. ReturnsT The root node object.

std::shared_ptr<const T> dolfin::Hierarchical::root_node_shared_ptr() const

Return shared pointer to root node object in hierarchy (const version).

void dolfin::Hierarchical::set_child(std::shared_ptr<T> child)

Set child.

Parameters:child
void dolfin::Hierarchical::set_parent(std::shared_ptr<T> parent)

Set parent.

Parameters:parent
dolfin::Hierarchical::~Hierarchical()

Destructor.

IndexSet

C++ documentation for IndexSet from dolfin/common/IndexSet.h:

class dolfin::IndexSet

This class provides an efficient data structure for index sets. The cost of checking whether a given index is in the set is O(1) and very very fast (optimal) at the cost of extra storage.

dolfin::IndexSet::IndexSet(std::size_t size)

Create index set of given size.

Parameters:size
void dolfin::IndexSet::clear()

Clear set.

bool dolfin::IndexSet::empty() const

Return true if set is empty.

void dolfin::IndexSet::fill()

Fill index set with indices 0, 1, 2, ..., size - 1.

std::size_t dolfin::IndexSet::find(std::size_t index) const

Return position (if any) for given index.

Parameters:index
bool dolfin::IndexSet::has_index(std::size_t index) const

Check whether index is in set.

Parameters:index
void dolfin::IndexSet::insert(std::size_t index)

Insert index into set.

Parameters:index
std::size_t &dolfin::IndexSet::operator[](std::size_t i)

Return given index.

Parameters:i
const std::size_t &dolfin::IndexSet::operator[](std::size_t i) const

Return given index (const version)

Parameters:i
std::size_t dolfin::IndexSet::size() const

Return size of set.

dolfin::IndexSet::~IndexSet()

Destructor.

MPI

C++ documentation for MPI from dolfin/common/MPI.h:

class dolfin::MPI

This class provides utility functions for easy communication with MPI and handles cases when DOLFIN is not configured with MPI .

void dolfin::MPI::all_gather(MPI_Comm comm, const T in_value, std::vector<T> &out_values)

Gather values, one primitive from each process (MPI_Allgather)

Parameters:
  • comm
  • in_value
  • out_values
void dolfin::MPI::all_gather(MPI_Comm comm, const std::string &in_values, std::vector<std::string> &out_values)

Gather values, one primitive from each process (MPI_Allgather). Specialization for std::string

Parameters:
  • comm
  • in_values
  • out_values
void dolfin::MPI::all_gather(MPI_Comm comm, const std::vector<T> &in_values, std::vector<T> &out_values)

Gather values from all processes. Same data count from each process (wrapper for MPI_Allgather)

Parameters:
  • comm
  • in_values
  • out_values
void dolfin::MPI::all_gather(MPI_Comm comm, const std::vector<T> &in_values, std::vector<std::vector<T>> &out_values)

Gather values from each process (variable count per process)

Parameters:
  • comm
  • in_values
  • out_values
T dolfin::MPI::all_reduce(MPI_Comm comm, const T &value, X op)

All reduce.

Parameters:
  • comm
  • value
  • op
void dolfin::MPI::all_to_all(MPI_Comm comm, std::vector<std::vector<T>> &in_values, std::vector<T> &out_values)

Send in_values[p0] to process p0 and receive values from all processes in out_values

Parameters:
  • comm
  • in_values
  • out_values
void dolfin::MPI::all_to_all(MPI_Comm comm, std::vector<std::vector<T>> &in_values, std::vector<std::vector<T>> &out_values)

Send in_values[p0] to process p0 and receive values from process p1 in out_values[p1]

Parameters:
  • comm
  • in_values
  • out_values
T dolfin::MPI::avg(MPI_Comm comm, const T &value)

Return average across comm; implemented only for T == Table .

Parameters:
  • comm
  • value
void dolfin::MPI::barrier(MPI_Comm comm)

Set a barrier (synchronization point)

Parameters:comm
void dolfin::MPI::broadcast(MPI_Comm comm, T &value, unsigned int broadcaster = 0)

Broadcast single primitive from broadcaster to all processes.

Parameters:
  • comm
  • value
  • broadcaster
void dolfin::MPI::broadcast(MPI_Comm comm, std::vector<T> &value, unsigned int broadcaster = 0)

Broadcast vector of value from broadcaster to all processes.

Parameters:
  • comm
  • value
  • broadcaster
std::pair<std::int64_t, std::int64_t> dolfin::MPI::compute_local_range(int process, std::int64_t N, int size)

Return local range for given process, splitting [0, N - 1] into size() portions of almost equal size

Parameters:
  • process
  • N
  • size
void dolfin::MPI::error_no_mpi(const char *where)
Parameters:where
void dolfin::MPI::gather(MPI_Comm comm, const std::string &in_values, std::vector<std::string> &out_values, unsigned int receiving_process = 0)

Gather strings on one process.

Parameters:
  • comm
  • in_values
  • out_values
  • receiving_process
void dolfin::MPI::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.

Parameters:
  • comm
  • in_values
  • out_values
  • receiving_process
std::size_t dolfin::MPI::global_offset(MPI_Comm comm, std::size_t range, bool exclusive)

Find global offset (index) (wrapper for MPI_(Ex)Scan with MPI_SUM as reduction op)

Parameters:
  • comm
  • range
  • exclusive
unsigned int dolfin::MPI::index_owner(MPI_Comm comm, std::size_t index, std::size_t N)

Return which process owns index (inverse of local_range)

Parameters:
  • comm
  • index
  • N
bool dolfin::MPI::is_broadcaster(MPI_Comm comm)

Determine whether we should broadcast (based on current parallel policy)

Parameters:comm
bool dolfin::MPI::is_receiver(MPI_Comm comm)

Determine whether we should receive (based on current parallel policy)

Parameters:comm
std::pair<std::int64_t, std::int64_t> dolfin::MPI::local_range(MPI_Comm comm, int process, std::int64_t N)

Return local range for given process, splitting [0, N - 1] into size() portions of almost equal size

Parameters:
  • comm
  • process
  • N
std::pair<std::int64_t, std::int64_t> dolfin::MPI::local_range(MPI_Comm comm, std::int64_t N)

Return local range for local process, splitting [0, N - 1] into size() portions of almost equal size

Parameters:
  • comm
  • N
T dolfin::MPI::max(MPI_Comm comm, const T &value)

Return global max value.

Parameters:
  • comm
  • value
T dolfin::MPI::min(MPI_Comm comm, const T &value)

Return global min value.

Parameters:
  • comm
  • value
unsigned int dolfin::MPI::rank(MPI_Comm comm)

Return process rank for the communicator.

Parameters:comm
void dolfin::MPI::scatter(MPI_Comm comm, const std::vector<T> &in_values, T &out_value, unsigned int sending_process = 0)

Scatter primitive in_values[i] to process i.

Parameters:
  • comm
  • in_values
  • out_value
  • sending_process
void dolfin::MPI::scatter(MPI_Comm comm, const std::vector<std::vector<T>> &in_values, std::vector<T> &out_value, unsigned int sending_process = 0)

Scatter vector in_values[i] to process i.

Parameters:
  • comm
  • in_values
  • out_value
  • sending_process
void dolfin::MPI::send_recv(MPI_Comm comm, const std::vector<T> &send_value, unsigned int dest, int send_tag, std::vector<T> &recv_value, unsigned int source, int recv_tag)

Send-receive data between processes (blocking)

Parameters:
  • comm
  • send_value
  • dest
  • send_tag
  • recv_value
  • source
  • recv_tag
void dolfin::MPI::send_recv(MPI_Comm comm, const std::vector<T> &send_value, unsigned int dest, std::vector<T> &recv_value, unsigned int source)

Send-receive data between processes.

Parameters:
  • comm
  • send_value
  • dest
  • recv_value
  • source
unsigned int dolfin::MPI::size(MPI_Comm comm)

Return size of the group (number of processes) associated with the communicator

Parameters:comm
T dolfin::MPI::sum(MPI_Comm comm, const T &value)

Sum values and return sum.

Parameters:
  • comm
  • value

Comm

C++ documentation for Comm from dolfin/common/MPI.h:

class dolfin::MPI::Comm
dolfin::MPI::Comm::Comm(MPI_Comm comm)

Duplicate communicator and wrap duplicate.

Parameters:comm
void dolfin::MPI::Comm::barrier() const

Set a barrier (synchronization point)

MPI_Comm dolfin::MPI::Comm::comm() const

Return the underlying MPI_Comm object.

void dolfin::MPI::Comm::free()

Free (destroy) communicator. Calls function ‘MPI_Comm_free’.

unsigned int dolfin::MPI::Comm::rank() const

Return process rank for the communicator.

void dolfin::MPI::Comm::reset(MPI_Comm comm)

Duplicate communivator, and free any previously created communicator

Parameters:comm
unsigned int dolfin::MPI::Comm::size() const

Return size of the group (number of processes) associated with the communicator. This function will also intialise MPI if it hasn’t already been intialised.

dolfin::MPI::Comm::~Comm()

Destructor (frees wrapped communicator)

NoDeleter

C++ documentation for NoDeleter from dolfin/common/NoDeleter.h:

class dolfin::NoDeleter

NoDeleter is a customised deleter intended for use with smart pointers.

void dolfin::NoDeleter::operator()(const void *)

Do nothing.

RangedIndexSet

C++ documentation for RangedIndexSet from dolfin/common/RangedIndexSet.h:

class dolfin::RangedIndexSet

This class provides an special-purpose data structure for testing if a given index within a range is set. It is very fast. The memory requirements are one bit per item in range, since it uses a (packed) std::vector<bool> for storage.

dolfin::RangedIndexSet::RangedIndexSet(std::pair<std::size_t, std::size_t> range)

Create a ranged set with range given as a (lower, upper) pair.

Parameters:range
dolfin::RangedIndexSet::RangedIndexSet(std::size_t upper_range)

Create a ranged set with 0 as lower range.

Parameters:upper_range
void dolfin::RangedIndexSet::clear()

Erase all indices from the set.

void dolfin::RangedIndexSet::erase(std::size_t i)

Erase an index from the set.

Parameters:i
bool dolfin::RangedIndexSet::has_index(std::size_t i) const

Check is the set contains the given index.

Parameters:i
bool dolfin::RangedIndexSet::in_range(std::size_t i) const

Return true if a given index is within range, i.e., if it can be stored in the set.

Parameters:i
bool dolfin::RangedIndexSet::insert(std::size_t i)

Insert a given index into the set. Returns true if the index was inserted (i.e., the index was not already in the set).

Parameters:i

Set

C++ documentation for Set from dolfin/common/Set.h:

class dolfin::Set

This is a set-like data structure. It is not ordered and it is based a std::vector. It uses linear search, and can be faster than std::set

dolfin::Set::Set()

Create empty set.

dolfin::Set::Set(const dolfin::Set<T> &x)

Copy constructor.

Parameters:x
dolfin::Set::Set(std::vector<T> &x)

Wrap std::vector as a set. Contents will be erased.

Parameters:x
const_iterator dolfin::Set::begin() const

Iterator to start of Set .

void dolfin::Set::clear()

Clear set.

type dolfin::Set::const_iterator

Const iterator.

const_iterator dolfin::Set::end() const

Iterator to beyond end of Set .

void dolfin::Set::erase(const T &x)

Erase an entry.

Parameters:x
iterator dolfin::Set::find(const T &x)

Find entry in set and return an iterator to the entry.

Parameters:x
const_iterator dolfin::Set::find(const T &x) const

Find entry in set and return an iterator to the entry (const)

Parameters:x
void dolfin::Set::insert(const InputIt first, const InputIt last)

Insert entries.

Parameters:
  • first
  • last
bool dolfin::Set::insert(const T &x)

Insert entry.

Parameters:x
type dolfin::Set::iterator

Iterator.

T dolfin::Set::operator[](std::size_t n) const

Index the nth entry in the set.

Parameters:n
std::vector<T> &dolfin::Set::set()

Return the vector that stores the data in the Set .

const std::vector<T> &dolfin::Set::set() const

Return the vector that stores the data in the Set .

std::size_t dolfin::Set::size() const

Set size.

void dolfin::Set::sort()

Sort set.

dolfin::Set::~Set()

Destructor.

SubSystemsManager

C++ documentation for SubSystemsManager from dolfin/common/SubSystemsManager.h:

class dolfin::SubSystemsManager : public std::string

This is a singleton class which manages the initialisation and finalisation of various sub systems, such as MPI and PETSc.

PetscErrorCode dolfin::SubSystemsManager::PetscDolfinErrorHandler(MPI_Comm comm, int line, const char *fun, const char *file, PetscErrorCode n, PetscErrorType p, const char *mess, void *ctx)

PETSc error handler. Logs everything known to DOLFIN logging system (with level TRACE) and stores the error message into pests_err_msg member.

Parameters:
  • comm
  • line
  • fun
  • file
  • n
  • p
  • mess
  • ctx
dolfin::SubSystemsManager::SubSystemsManager()
dolfin::SubSystemsManager::SubSystemsManager(const SubSystemsManager&) = delete
bool dolfin::SubSystemsManager::control_mpi
void dolfin::SubSystemsManager::finalize()

Finalize subsystems. This will be called by the destructor, but in special cases it may be necessary to call finalize() explicitly.

void dolfin::SubSystemsManager::finalize_mpi()
void dolfin::SubSystemsManager::finalize_petsc()
void dolfin::SubSystemsManager::init_mpi()

Initialise MPI .

int dolfin::SubSystemsManager::init_mpi(int argc, char *argv[], int required_thread_level)

Initialise MPI with required level of thread support.

Parameters:
  • argc
  • argv
  • required_thread_level
void dolfin::SubSystemsManager::init_petsc()

Initialize PETSc without command-line arguments.

void dolfin::SubSystemsManager::init_petsc(int argc, char *argv[])

Initialize PETSc with command-line arguments. Note that PETSc command-line arguments may also be filtered and sent to PETSc by parameters.parse(argc, argv).

Parameters:
  • argc
  • argv
bool dolfin::SubSystemsManager::mpi_finalized()

Check if MPI has been finalized (returns true if MPI has been finalised)

bool dolfin::SubSystemsManager::mpi_initialized()

Check if MPI has been initialised (returns true if MPI has been initialised, even if it is later finalised)

std::string dolfin::SubSystemsManager::petsc_err_msg

Last recorded PETSc error message.

bool dolfin::SubSystemsManager::petsc_initialized
bool dolfin::SubSystemsManager::responsible_mpi()

Return true if DOLFIN initialised MPI (and is therefore responsible for finalization)

bool dolfin::SubSystemsManager::responsible_petsc()

Return true if DOLFIN initialised PETSc (and is therefore responsible for finalization)

SubSystemsManager &dolfin::SubSystemsManager::singleton()

Singleton instance. Calling this ensures singleton instance of SubSystemsManager is initialized according to the “Construct on First Use” idiom.

dolfin::SubSystemsManager::~SubSystemsManager()

Timer

C++ documentation for Timer from dolfin/common/Timer.h:

class dolfin::Timer

A timer can be used for timing tasks. The basic usage is Timer timer(“Assembling over cells”); The timer is started at construction and timing ends when the timer is destroyed (goes out of scope). It is also possible to start and stop a timer explicitly by timer.start(); timer.stop(); Timings are stored globally and a summary may be printed by calling list_timings() ;

dolfin::Timer::Timer()

Create timer without logging.

dolfin::Timer::Timer(std::string task)

Create timer with logging.

Parameters:task
std::tuple<double, double, double> dolfin::Timer::elapsed() const

Return wall, user and system time in seconds. Wall-clock time has precision around 1 microsecond; user and system around 10 millisecond.

void dolfin::Timer::resume()

Resume timer. Not well-defined for logging timer.

void dolfin::Timer::start()

Zero and start timer.

double dolfin::Timer::stop()

Stop timer, return wall time elapsed and store timing data into logger

dolfin::Timer::~Timer()

Destructor.

UniqueIdGenerator

C++ documentation for UniqueIdGenerator from dolfin/common/UniqueIdGenerator.h:

class dolfin::UniqueIdGenerator

This is a singleton class that return IDs that are unique in the lifetime of a program.

dolfin::UniqueIdGenerator::UniqueIdGenerator()
std::size_t dolfin::UniqueIdGenerator::id()

Generate a unique ID.

std::size_t dolfin::UniqueIdGenerator::next_id
UniqueIdGenerator dolfin::UniqueIdGenerator::unique_id_generator

Variable

C++ documentation for Variable from dolfin/common/Variable.h:

class dolfin::Variable

Common base class for DOLFIN variables.

dolfin::Variable::Variable()

Create unnamed variable.

dolfin::Variable::Variable(const Variable &variable)

Copy constructor.

Parameters:variable
dolfin::Variable::Variable(const std::string name, const std::string label)

Create variable with given name and label.

Parameters:
  • name
  • label
std::size_t dolfin::Variable::id() const

Get unique identifier. Returnsstd::size_t The unique integer identifier associated with the object.

std::string dolfin::Variable::label() const

Return label (description)

std::string dolfin::Variable::name() const

Return name.

const Variable &dolfin::Variable::operator=(const Variable &variable)

Assignment operator.

Parameters:variable
Parameters dolfin::Variable::parameters

Parameters .

void dolfin::Variable::rename(const std::string name, const std::string label)

Rename variable.

Parameters:
  • name
  • label
std::string dolfin::Variable::str(bool verbose) const

Return informal string representation (pretty-print)

Parameters:verbose
const std::size_t dolfin::Variable::unique_id
dolfin::Variable::~Variable()

Destructor.