Constant.h

Note

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

class Constant

Parent class(es)

This class represents a constant-valued expression.

explicit Constant(double value)

Create scalar constant

Arguments
value (double)
The scalar to create a Constant object from.
Example
Constant c(1.0);
Constant(double value0, double value1)

Create vector constant (dim = 2)

Arguments
value0 (double)
The first vector element.
value1 (double)
The second vector element.
Example
Constant B(0.0, 1.0);
Constant(double value0, double value1, double value2)

Create vector constant (dim = 3)

Arguments
value0 (double)
The first vector element.
value1 (double)
The second vector element.
value2 (double)
The third vector element.
Example
Constant T(0.0, 1.0, 0.0);
explicit Constant(std::vector<double> values)

Create vector-valued constant

Arguments
values (std::vector<double>)
Values to create a vector-valued constant from.
Constant(std::vector<std::size_t> value_shape, std::vector<double> values)

Create tensor-valued constant for flattened array of values

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

Copy constructor

Arguments
constant (Constant)
Object to be copied.
const Constant& operator=(const Constant& constant)

Assignment operator

Arguments
constant (Constant)
Another constant.
const Constant& operator=(double constant)

Assignment operator

Arguments
constant (double)
Another constant.
operator double() const

Cast to double (for scalar constants)

Returns
double
The scalar value.

Previous topic

DOLFIN function module

Next topic

Expression.h

This Page