.. Documentation for the header file dolfin/function/Constant.h .. _programmers_reference_cpp_function_constant: Constant.h ========== .. note:: The documentation on this page was automatically extracted from the DOLFIN C++ code and may need to be edited or expanded. .. cpp:class:: Constant *Parent class(es)* * :cpp:class:`Expression` This class represents a constant-valued expression. .. cpp:function:: explicit Constant(double value) Create scalar constant @param value (double) The scalar to create a Constant object from. @code{.cpp} Constant c(1.0); @endcode .. cpp:function:: Constant(double value0, double value1) Create vector constant (dim = 2) @param value0 (double) The first vector element. @param value1 (double) The second vector element. @code{.cpp} Constant B(0.0, 1.0); @endcode .. cpp:function:: Constant(double value0, double value1, double value2) Create vector constant (dim = 3) @param value0 (double) The first vector element. @param value1 (double) The second vector element. @param value2 (double) The third vector element. @code{.cpp} Constant T(0.0, 1.0, 0.0); @endcode .. cpp:function:: explicit Constant(std::vector values) Create vector-valued constant @param values (std::vector) Values to create a vector-valued constant from. .. cpp:function:: Constant(std::vector value_shape, std::vector values) Create tensor-valued constant for flattened array of values @param value_shape (std::vector) Shape of tensor. @param values (std::vector) Values to create tensor-valued constant from. .. cpp:function:: Constant(const Constant& constant) Copy constructor @param constant (Constant) Object to be copied. .. cpp:function:: const Constant& operator= (const Constant& constant) Assignment operator @param constant (Constant) Another constant. .. cpp:function:: const Constant& operator= (double constant) Assignment operator @param constant (double) Another constant. .. cpp:function:: operator double() const Cast to double (for scalar constants) @return double The scalar value. .. cpp:function:: std::vector values() const Return copy of this Constant's current values @return std::vector The vector of scalar values of the constant.