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

This class represents a constant-valued expression. More...

`#include <Constant.h>`

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

## Public Member Functions

| Constant (double value)
| Constant (double value0, double value1)
| Constant (double value0, double value1, double value2)
| Constant (std::vector< double > values)
| Constant (std::vector< std::size_t > value_shape, std::vector< double > values)
| Constant (const Constant &constant)
| ~Constant ()
| Destructor.
const Constant & | operator= (const Constant &constant)
const Constant & | operator= (double constant)
| operator double () const
std::vector< double > | values () const
void | eval (Array< double > &values, const Array< double > &x) const override
void | eval (Eigen::Ref< Eigen::VectorXd > values, Eigen::Ref< const Eigen::VectorXd > x) const override
virtual std::string | str (bool verbose) const override
| Return informal string representation (pretty-print).
Public Member Functions inherited from dolfin::Expression
| Expression ()
| Create scalar expression.
| Expression (std::size_t dim)
| Expression (std::size_t dim0, std::size_t dim1)
| Expression (std::vector< std::size_t > value_shape)
| Expression (const Expression &expression)
virtual | ~Expression ()
| Destructor.
virtual void | eval (Array< double > &values, const Array< double > &x, const ufc::cell &cell) const override
virtual void | eval (Eigen::Ref< Eigen::VectorXd > values, Eigen::Ref< const Eigen::VectorXd > x, const ufc::cell &cell) const override
virtual std::size_t | value_rank () const override
virtual std::size_t | value_dimension (std::size_t i) const override
virtual std::vector< std::size_t > | value_shape () const override
virtual void | set_property (std::string name, double value)
virtual double | get_property (std::string name) const
virtual void | set_generic_function (std::string name, std::shared_ptr< GenericFunction > f)
virtual std::shared_ptr< dolfin::GenericFunction > | get_generic_function (std::string name) const
virtual void | restrict (double *w, const FiniteElement &element, const Cell &dolfin_cell, const double *coordinate_dofs, const ufc::cell &ufc_cell) const override
virtual void | compute_vertex_values (std::vector< double > &vertex_values, const Mesh &mesh) const override
virtual std::shared_ptr< const FunctionSpace > | function_space () const override
Public Member Functions inherited from dolfin::GenericFunction
| GenericFunction ()
| Constructor.
virtual | ~GenericFunction ()
| Destructor.
virtual void | update () const
| Update off-process ghost coefficients.
double | operator() (double x) const
| Evaluation at given point (scalar function).
double | operator() (double x, double y) const
| Evaluation at given point (scalar function).
double | operator() (double x, double y, double z) const
| Evaluation at given point (scalar function).
double | operator() (const Point &p) const
| Evaluation at given point (scalar function).
void | operator() (Array< double > &values, double x) const
| Evaluation at given point (vector-valued function).
void | operator() (Array< double > &values, double x, double y) const
| Evaluation at given point (vector-valued function).
void | operator() (Array< double > &values, double x, double y, double z) const
| Evaluation at given point (vector-valued function).
void | operator() (Array< double > &values, const Point &p) const
| Evaluation at given point (vector-valued function).
std::size_t | value_size () const
| Evaluation at given point.
virtual void | evaluate (double *values, const double *coordinates, const ufc::cell &cell) const override
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.
Protected Member Functions inherited from dolfin::GenericFunction
void | restrict_as_ufc_function (double *w, const FiniteElement &element, const Cell &dolfin_cell, const double *coordinate_dofs, const ufc::cell &ufc_cell) const
| Restrict as UFC function (by calling eval).
Protected Attributes inherited from dolfin::Expression
std::vector< std::size_t > | _value_shape

## Detailed Description

This class represents a constant-valued expression.

## Constructor & Destructor Documentation

## Constant() [1/6]

Constant::Constant | ( | double | value | ) |

explicit

Create scalar constant

Parameters

  value | (double) The scalar to create a Constant object from.

Constant c(1.0);
dolfin::Constant::Constant
Constant(double value)
Definition Constant.cpp:29

## Constant() [2/6]

Constant::Constant | ( | double | value0,
|  | double | value1 )

Create vector constant (dim = 2)

Parameters

  value0 | (double) The first vector element.
  value1 | (double) The second vector element.

Constant B(0.0, 1.0);

## Constant() [3/6]

Constant::Constant | ( | double | value0,
|  | double | value1,
|  | double | value2 )

Create vector constant (dim = 3)

Parameters

  value0 | (double) The first vector element.
  value1 | (double) The second vector element.
  value2 | (double) The third vector element.

Constant T(0.0, 1.0, 0.0);

## Constant() [4/6]

Constant::Constant | ( | std::vector< double > | values | ) |

explicit

Create vector-valued constant

Parameters

  values | (std::vector<double>) Values to create a vector-valued constant from.

## Constant() [5/6]

Constant::Constant | ( | std::vector< std::size_t > | value_shape,
|  | std::vector< double > | values )

Create tensor-valued constant for flattened array of values

Parameters

  value_shape | (std::vector<std::size_t>) Shape of tensor.
  values | (std::vector<double>) Values to create tensor-valued constant from.

## Constant() [6/6]

Constant::Constant | ( | const Constant & | constant | ) |

Copy constructor

Parameters

  constant | (Constant) Object to be copied.

## Member Function Documentation

## eval() [1/2]

void Constant::eval | ( | Array< double > & | values,
|  | const Array< double > & | x ) const

override virtual

Evaluate at given point (deprecated)

Parameters

  values | (Array<double>) The values at the point.
  x | (Array<double>) The coordinates of the point.

Reimplemented from dolfin::Expression.

## eval() [2/2]

void Constant::eval | ( | Eigen::Ref< Eigen::VectorXd > | values,
|  | Eigen::Ref< const Eigen::VectorXd > | x ) const

override virtual

Evaluate at given point.

Parameters

  values | (Eigen::Ref<Eigen::VectorXd>) The values at the point.
  x | (Eigen::Ref<const Eigen::VectorXd>) The coordinates of the point.

Reimplemented from dolfin::Expression.

## operator double()

Constant::operator double | ( |  | ) | const

Cast to double (for scalar constants)

Returns
  double The scalar value.

## operator=() [1/2]

const Constant & Constant::operator= | ( | const Constant & | constant | ) |

Assignment operator

Parameters

  constant | (Constant) Another constant.

## operator=() [2/2]

const Constant & Constant::operator= | ( | double | constant | ) |

Assignment operator

Parameters

  constant | (double) Another constant.

## str()

std::string Constant::str | ( | bool | verbose | ) | const

override virtual

Return informal string representation (pretty-print).

Reimplemented from dolfin::Variable.

## values()

std::vector< double > Constant::values | ( |  | ) | const

Return copy of this Constant's current values

Returns
  std::vector<double> The vector of scalar values of the constant.

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

- /build/dolfin-lFBzDh/dolfin-2019.2.0~legacy20240219.1c52e83/dolfin/function/Constant.h
- /build/dolfin-lFBzDh/dolfin-2019.2.0~legacy20240219.1c52e83/dolfin/function/Constant.cpp