Scalar.h

Note

The documentation on this page was automatically extracted from the DOLFIN C++ code and may need to be edited or expanded.

class Scalar

Parent class(es)

This class represents a real-valued scalar quantity and implements the GenericTensor interface for scalars.

Scalar()

Create zero scalar

Scalar(MPI_Comm comm)

Create zero scalar

void init(const TensorLayout &tensor_layout)

Initialize zero tensor using sparsity pattern

bool empty() const

Return true if empty

std::size_t rank() const

Return tensor rank (number of dimensions)

std::size_t size(std::size_t dim) const

Return size of given dimension

std::pair<std::int64_t, std::int64_t> local_range(std::size_t dim) const

Return local ownership range

void get(double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows) const

Get block of values

void set(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)

Set block of values using global indices

void set_local(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)

Set block of values using local indices

void add(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)

Add block of values using global indices

void add_local(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)

Add block of values using local indices

void add(const double *block, const std::vector<ArrayView<const dolfin::la_index>> &rows)

Add block of values using global indices

void add_local(const double *block, const std::vector<ArrayView<const dolfin::la_index>> &rows)

Add block of values using local indices

void zero()

Set all entries to zero and keep any sparse structure

void apply(std::string mode)

Finalize assembly of tensor

MPI_Comm mpi_comm() const

Return MPI communicator

std::string str(bool verbose) const

Return informal string representation (pretty-print)

std::shared_ptr<Scalar> copy() const

Return copy of scalar

GenericLinearAlgebraFactory &factory() const

Return a factory for the default linear algebra backend

double get_scalar_value() const

Get final value (assumes prior apply(), not part of GenericTensor interface)

void add_local_value(double value)

Add to local increment (added for testing, remove if we add a better way from python)