DOLFINx 0.12.0.0
DOLFINx C++
Loading...
Searching...
No Matches
dolfinx Namespace Reference

Top-level namespace. More...

Namespaces

namespace  common
 Miscellaneous classes, functions and types.
namespace  fem
 Finite element method functionality.
namespace  geometry
 Geometry data structures and algorithms.
namespace  graph
 Graph data structures and algorithms.
namespace  io
 Support for file IO.
namespace  la
 Linear algebra interface.
namespace  mesh
 Mesh data structures and algorithms on meshes.
namespace  MPI
 MPI support functionality.
namespace  nls
 Nonlinear solvers.
namespace  refinement
 Mesh refinement algorithms.

Classes

struct  _unsigned_projection
class  Table
 This class provides storage and pretty-printing for tables. More...

Concepts

concept  scalar
concept  MDSpanRank2
 mdspan/mdarray namespace

Functions

consteval std::string_view version ()
 Return DOLFINx version string.
consteval std::string_view ufcx_signature ()
 Return UFC signature string.
consteval std::string_view git_commit_hash ()
consteval bool has_debug ()
consteval bool has_petsc ()
 Return true if DOLFINx is compiled with PETSc.
consteval bool has_slepc ()
 Return true if DOLFINx is compiled with SLEPc.
consteval bool has_parmetis ()
 Return true if DOLFINx is compiled with ParMETIS.
consteval bool has_kahip ()
 Return true if DOLFINx is compiled with KaHIP.
consteval bool has_adios2 ()
 Return true if DOLFINX is compiled with ADIOS2.
consteval bool has_ptscotch ()
 Return true if DOLFINX is compiled with PT-SCOTCH.
consteval bool has_superlu_dist ()
 Return true if DOLFINx is compiled with SuperLU_DIST.
consteval bool has_complex_ufcx_kernels ()
void init_logging (int argc, char *argv[])
 Optional initialisation of the logging backend.
template<int BITS = 8, typename P = std::identity, std::ranges::random_access_range R>
constexpr void radix_sort (R &&range, P proj={})
 Sort a range with radix sorting algorithm. The bucket size is determined by the number of bits to sort at a time (2^BITS).
template<typename T, int BITS = 16>
std::vector< std::int32_t > sort_by_perm (std::span< const T > x, std::size_t shape1, std::optional< std::size_t > ncols=std::nullopt)
 Compute the permutation array that sorts a 2D array by row.
template<typename T, int BITS = 16>
std::vector< std::int32_t > sort_by_perm (std::span< std::span< const T > > x)
 Compute the permutation array that sorts a 2D array, stored column-major, by row. Overload of the row-major sort_by_perm() above, selected when x is passed as spans of columns rather than one flattened span.
Table timing_table ()
 Return a summary of timings and tasks in a Table.
void list_timings (MPI_Comm comm, Table::Reduction reduction=Table::Reduction::max)
 List a summary of timings and tasks.
std::pair< int, std::chrono::duration< double, std::ratio< 1 > > > timing (std::string_view task)
 Return timing (count, total wall time) for given task.
std::map< std::string, std::pair< int, std::chrono::duration< double, std::ratio< 1 > > >, std::less<> > timings ()
 Logged elapsed times.

Variables

constexpr _unsigned_projection unsigned_projection {}
 Projection from signed to signed int.

Detailed Description

Top-level namespace.

Function Documentation

◆ git_commit_hash()

std::string_view git_commit_hash ( )
consteval

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

◆ has_complex_ufcx_kernels()

bool has_complex_ufcx_kernels ( )
consteval

Return true if DOLFINx supports UFCx kernels with arguments of type C99 _Complex. When DOLFINx was built with MSVC this returns false. This returning false does not preclude using DOLFINx with kernels accepting std::complex.

◆ has_debug()

bool has_debug ( )
consteval

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

◆ init_logging()

void init_logging ( int argc,
char * argv[] )

Optional initialisation of the logging backend.

The log verbosity can be controlled from the command line using SPDLOG_LEVEL=<level>, where <level> is info, warn, debug, etc.

The full spdlog API can be used in applications to control the log system. See https://github.com/gabime/spdlog for the spdlog documentation.

Parameters
[in]argcNumber of command line arguments.
[in]argvCommand line argument vector.

◆ list_timings()

void list_timings ( MPI_Comm comm,
Table::Reduction reduction = Table::Reduction::max )

List a summary of timings and tasks.

MPI_AVG reduction is printed.

Parameters
[in]commMPI Communicator.
[in]reductionMPI Reduction to apply (min, max or average).

◆ radix_sort()

template<int BITS = 8, typename P = std::identity, std::ranges::random_access_range R>
void radix_sort ( R && range,
P proj = {} )
constexpr

Sort a range with radix sorting algorithm. The bucket size is determined by the number of bits to sort at a time (2^BITS).

This allows usage with standard range containers of integral types, for example

std::array<std::int16_t, 3> a{2, 3, 1};
dolfinx::radix_sort(a); // a = {1, 2, 3}
constexpr void radix_sort(R &&range, P proj={})
Sort a range with radix sorting algorithm. The bucket size is determined by the number of bits to sor...
Definition sort.h:81

Additionally the projection based approach of the STL library is adapted, which allows for versatile usage, for example the easy realization of an argsort

std::array<std::int16_t, 3> a{2, 3, 1};
std::array<std::int16_t, 3> i{0, 1, 2};
dolfinx::radix_sort(i, [&a](auto i){ return a[i]; }); // yields i = {2, 0,
1} and a[i] = {1, 2, 3};
Template Parameters
BITSThe number of bits to sort at a time.
PProjection type to be applied on range elements to produce a sorting index.
RType of the range to sort.
Parameters
[in,out]rangeThe range to sort.
[in]projElement projection.
Note
Stable: elements that compare equal under proj retain their relative order from the input range.

◆ sort_by_perm() [1/2]

template<typename T, int BITS = 16>
std::vector< std::int32_t > sort_by_perm ( std::span< const T > x,
std::size_t shape1,
std::optional< std::size_t > ncols = std::nullopt )

Compute the permutation array that sorts a 2D array by row.

Parameters
[in]xThe flattened 2D array to compute the permutation array for (row-major storage).
[in]shape1The number of columns of x.
[in]ncolsNumber of leading columns of x (columns 0 to ncols - 1) to sort by; column 0 is the most significant. std::nullopt (the default) sorts by all shape1 columns. Pass a value less than shape1 to exclude trailing payload columns (e.g. an attached index carried alongside the sort key) from the comparison entirely, saving one radix-sort pass per excluded column.
Returns
The permutation array such that x[perm[i]] <= x[perm[i +1]] when compared on the leading ncols columns.
Precondition
x.size() must be a multiple of shape1.
ncols <= shape1.
Note
Stable: rows that compare equal on the leading ncols columns retain their relative order from the input.
This function is suitable for small values of shape1. Each column of x is copied into an array that is then sorted.

◆ sort_by_perm() [2/2]

template<typename T, int BITS = 16>
std::vector< std::int32_t > sort_by_perm ( std::span< std::span< const T > > x)

Compute the permutation array that sorts a 2D array, stored column-major, by row. Overload of the row-major sort_by_perm() above, selected when x is passed as spans of columns rather than one flattened span.

Parameters
[in]xColumns to sort by, most (x[0]) to least (x.back()) significant. To exclude a column from the sort key, omit it – there is no separate ncols as in the row-major overload.
Returns
Permutation array such that x[k][perm[i]] <= x[k][perm[i + 1]] for every column k.
Precondition
All spans in x have equal length.
Note
Stable: rows that compare equal on every included column retain their relative order from the input.
Columns are already contiguous, so (unlike the row-major overload) no column needs copying before it is sorted.

◆ timing()

std::pair< int, std::chrono::duration< double, std::ratio< 1 > > > timing ( std::string_view task)

Return timing (count, total wall time) for given task.

Parameters
[in]taskName of a task
Returns
The (count, total wall time) for the task.

◆ timing_table()

dolfinx::Table timing_table ( )

Return a summary of timings and tasks in a Table.

Returns
Table with timings.

◆ timings()

std::map< std::string, std::pair< int, std::chrono::duration< double, std::ratio< 1 > > >, std::less<> > timings ( )

Logged elapsed times.

Returns
Elapsed [task id: (count, total wall time)].