Loading...
Searching...
No Matches
dolfin::Scalar Class Reference

`#include <Scalar.h>`

Inheritance diagram for dolfin::Scalar:
[legend]
Collaboration diagram for dolfin::Scalar:
[legend]

## Public Member Functions

| Scalar ()
| Create zero scalar.
| Scalar (MPI_Comm comm)
| Create zero scalar.
virtual | ~Scalar ()
| Destructor.
virtual void | init (const TensorLayout &tensor_layout)
| Initialize zero tensor using sparsity pattern.
virtual bool | empty () const
| Return true if empty.
virtual std::size_t | rank () const
| Return tensor rank (number of dimensions).
virtual std::size_t | size (std::size_t dim) const
| Return size of given dimension.
virtual std::pair< std::int64_t, std::int64_t > | local_range (std::size_t dim) const
| Return local ownership range.
virtual void | get (double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows) const
| Get block of values.
virtual void | set (const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)
| Set block of values using global indices.
virtual 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.
virtual void | add (const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)
| Add block of values using global indices.
virtual 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.
virtual void | add (const double *block, const std::vector< ArrayView< const dolfin::la_index > > &rows)
| Add block of values using global indices.
virtual void | add_local (const double *block, const std::vector< ArrayView< const dolfin::la_index > > &rows)
| Add block of values using local indices.
virtual void | zero ()
| Set all entries to zero and keep any sparse structure.
virtual void | apply (std::string mode)
| Finalize assembly of tensor.
virtual MPI_Comm | mpi_comm () const
| Return MPI communicator.
virtual std::string | str (bool verbose) const
| Return informal string representation (pretty-print).
virtual std::shared_ptr< Scalar > | copy () const
| Return copy of scalar.
virtual GenericLinearAlgebraFactory & | factory () const
| Return a factory for the default linear algebra backend.
double | get_scalar_value () const
void | add_local_value (double value)
Public Member Functions inherited from dolfin::GenericTensor
virtual | ~GenericTensor ()
| Destructor.
Public Member Functions inherited from dolfin::LinearAlgebraObject
virtual const LinearAlgebraObject * | instance () const
| Return concrete instance / unwrap (const version).
virtual LinearAlgebraObject * | instance ()
| Return concrete instance / unwrap (non-const version).
virtual std::shared_ptr< const LinearAlgebraObject > | shared_instance () const
| Return concrete shared ptr instance / unwrap (const version).
virtual std::shared_ptr< LinearAlgebraObject > | shared_instance ()
| Return concrete shared ptr instance / unwrap (non-const version).
Public Member Functions inherited from dolfin::Variable
| Variable ()
| Create unnamed variable.
| Variable (const std::string name, const std::string label)
| Create variable with given name and label.
| Variable (const Variable &variable)
| Copy constructor.
virtual | ~Variable ()
| Destructor.
const Variable & | operator= (const Variable &variable)
| Assignment operator.
void | rename (const std::string name, const std::string label)
| Rename variable.
std::string | name () const
| Return name.
std::string | label () const
| Return label (description).
std::size_t | id () const

## Additional Inherited Members

Public Attributes inherited from dolfin::Variable
Parameters | parameters
| Parameters.

## Detailed Description

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

## Member Function Documentation

## add() [1/2]

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

inline virtual

Add block of values using global indices.

Implements dolfin::GenericTensor.

## add() [2/2]

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

inline virtual

Add block of values using global indices.

Implements dolfin::GenericTensor.

## add_local() [1/2]

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

inline virtual

Add block of values using local indices.

Implements dolfin::GenericTensor.

## add_local() [2/2]

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

inline virtual

Add block of values using local indices.

Implements dolfin::GenericTensor.

## add_local_value()

void dolfin::Scalar::add_local_value | ( | double | value | ) |

inline

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

## apply()

virtual void dolfin::Scalar::apply | ( | std::string | mode | ) |

inline virtual

Finalize assembly of tensor.

Implements dolfin::GenericTensor.

## empty()

virtual bool dolfin::Scalar::empty | ( |  | ) | const

inline virtual

Return true if empty.

Implements dolfin::GenericTensor.

## factory()

virtual GenericLinearAlgebraFactory & dolfin::Scalar::factory | ( |  | ) | const

inline virtual

Return a factory for the default linear algebra backend.

Implements dolfin::GenericTensor.

## get()

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

inline virtual

Get block of values.

Implements dolfin::GenericTensor.

## get_scalar_value()

double dolfin::Scalar::get_scalar_value | ( |  | ) | const

inline

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

## init()

virtual void dolfin::Scalar::init | ( | const TensorLayout & | tensor_layout | ) |

inline virtual

Initialize zero tensor using sparsity pattern.

Implements dolfin::GenericTensor.

## local_range()

virtual std::pair< std::int64_t, std::int64_t > dolfin::Scalar::local_range | ( | std::size_t | dim | ) | const

inline virtual

Return local ownership range.

Implements dolfin::GenericTensor.

## mpi_comm()

virtual MPI_Comm dolfin::Scalar::mpi_comm | ( |  | ) | const

inline virtual

Return MPI communicator.

Implements dolfin::LinearAlgebraObject.

## rank()

virtual std::size_t dolfin::Scalar::rank | ( |  | ) | const

inline virtual

Return tensor rank (number of dimensions).

Implements dolfin::GenericTensor.

## set()

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

inline virtual

Set block of values using global indices.

Implements dolfin::GenericTensor.

## set_local()

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

inline virtual

Set block of values using local indices.

Implements dolfin::GenericTensor.

## size()

virtual std::size_t dolfin::Scalar::size | ( | std::size_t | dim | ) | const

inline virtual

Return size of given dimension.

Implements dolfin::GenericTensor.

## str()

virtual std::string dolfin::Scalar::str | ( | bool | verbose | ) | const

inline virtual

Return informal string representation (pretty-print).

Implements dolfin::GenericTensor.

## zero()

virtual void dolfin::Scalar::zero | ( |  | ) |

inline virtual

Set all entries to zero and keep any sparse structure.

Implements dolfin::GenericTensor.

The documentation for this class was generated from the following file:

- /build/dolfin-lFBzDh/dolfin-2019.2.0~legacy20240219.1c52e83/dolfin/la/Scalar.h