.. Documentation for the header file dolfin/function/Function.h .. _programmers_reference_cpp_function_function: Function.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:: Function *Parent class(es)* * :cpp:class:`GenericFunction` * :cpp:class:`Hierarchical` This class represents a function :math:`u_h` in a finite element function space :math:`V_h`, given by .. math:: u_h = \sum_{i=1}^{n} U_i \phi_i where :math:`\{\phi_i\}_{i=1}^{n}` is a basis for :math:`V_h`, and :math:`U` is a vector of expansion coefficients for :math:`u_h`. .. cpp:function:: explicit Function(std::shared_ptr V) Create function on given function space (shared data) *Arguments* V (:cpp:class:`FunctionSpace`) The function space. .. cpp:function:: Function(std::shared_ptr V, std::shared_ptr x) Create function on given function space with a given vector (shared data) *Warning: This constructor is intended for internal library use only* *Arguments* V (:cpp:class:`FunctionSpace`) The function space. x (:cpp:class:`GenericVector`) The vector. .. cpp:function:: Function(std::shared_ptr V, std::string filename) Create function from vector of dofs stored to file (shared data) *Arguments* V (:cpp:class:`FunctionSpace`) The function space. filename_dofdata (std::string) The name of the file containing the dofmap data. .. cpp:function:: Function(const Function& v) Copy constructor *Arguments* v (:cpp:class:`Function`) The object to be copied. .. cpp:function:: Function(const Function& v, std::size_t i) Sub-function constructor with shallow copy of vector (used in Python interface) *Arguments* v (:cpp:class:`Function`) The function to be copied. i (std::size_t) Index of subfunction. .. cpp:function:: const Function& operator= (const Function& v) Assignment from function *Arguments* v (:cpp:class:`Function`) Another function. .. cpp:function:: const Function& operator= (const Expression& v) Assignment from expression using interpolation *Arguments* v (:cpp:class:`Expression`) The expression. .. cpp:function:: void operator=(const FunctionAXPY& axpy) Assignment from linear combination of function *Arguments* v (:cpp:class:`FunctionAXPY`) A linear combination of other Functions .. cpp:function:: Function& operator[] (std::size_t i) const Extract subfunction *Arguments* i (std::size_t) Index of subfunction. *Returns* :cpp:class:`Function` The subfunction. .. cpp:function:: std::shared_ptr function_space() const override Return shared pointer to function space *Returns* :cpp:class:`FunctionSpace` Return the shared pointer. .. cpp:function:: std::shared_ptr vector() Return vector of expansion coefficients (non-const version) *Returns* :cpp:class:`GenericVector` The vector of expansion coefficients. .. cpp:function:: std::shared_ptr vector() const Return vector of expansion coefficients (const version) *Returns* :cpp:class:`GenericVector` The vector of expansion coefficients (const). .. cpp:function:: bool in(const FunctionSpace& V) const Check if function is a member of the given function space *Arguments* V (:cpp:class:`FunctionSpace`) The function space. *Returns* bool True if the function is in the function space. .. cpp:function:: std::size_t geometric_dimension() const Return geometric dimension *Returns* std::size_t The geometric dimension. .. cpp:function:: void eval(Array& values, const Array& x) const override Evaluate function at given coordinates @param values (Array) The values. @param x (Array) The coordinates. .. cpp:function:: void eval(Array& values, const Array& x, const Cell& dolfin_cell, const ufc::cell& ufc_cell) const Evaluate function at given coordinates in given cell *Arguments* @param values (Array) The values. @param x (Array) The coordinates. @param dolfin_cell (:cpp:class:`Cell`) The cell. @param ufc_cell (ufc::cell) The ufc::cell. .. cpp:function:: void eval(Eigen::Ref values, Eigen::Ref x) const override Evaluate function at given coordinates @param values (Eigen::Ref values) The values. @param x (Eigen::Ref x) The coordinates. .. cpp:function:: void eval(Eigen::Ref values, Eigen::Ref x, const dolfin::Cell& dolfin_cell, const ufc::cell& ufc_cell) const Evaluate function at given coordinates in given cell *Arguments* @param values (Eigen::Ref) The values. @param x (Eigen::Ref) The coordinates. @param dolfin_cell (:cpp:class:`Cell`) The cell. @param ufc_cell (ufc::cell) The ufc::cell. .. cpp:function:: void interpolate(const GenericFunction& v) Interpolate function (on possibly non-matching meshes) @param v (GenericFunction) The function to be interpolated. .. cpp:function:: void extrapolate(const Function& v) Extrapolate function (from a possibly lower-degree function space) *Arguments* v (:cpp:class:`Function`) The function to be extrapolated. .. cpp:function:: std::size_t value_rank() const override Return value rank *Returns* std::size_t The value rank. .. cpp:function:: std::size_t value_dimension(std::size_t i) const override Return value dimension for given axis *Arguments* i (std::size_t) The index of the axis. *Returns* std::size_t The value dimension. .. cpp:function:: std::vector value_shape() const override Return value shape *Returns* std::vector The value shape. .. cpp:function:: void eval(Array& values, const Array& x, const ufc::cell& cell) const override Evaluate at given point in given cell @param values (Array) The values at the point. @param x (Array) The coordinates of the point. @param cell (ufc::cell) The cell which contains the given point. .. cpp:function:: void eval(Eigen::Ref values, Eigen::Ref x, const ufc::cell& cell) const override Evaluate at given point in given cell @param values (Eigen::Ref) The values at the point. @param x (Eigen::Ref The coordinates of the point. @param cell (ufc::cell) The cell which contains the given point. .. cpp:function:: void restrict(double* w, const FiniteElement& element, const Cell& dolfin_cell, const double* coordinate_dofs, const ufc::cell& ufc_cell) const override Restrict function to local cell (compute expansion coefficients w) @param w (list of doubles) Expansion coefficients. @param element (:cpp:class:`FiniteElement`) The element. @param dolfin_cell (:cpp:class:`Cell`) The cell. @param coordinate_dofs (double *) The coordinates @param ufc_cell (ufc::cell). The ufc::cell. .. cpp:function:: void compute_vertex_values(std::vector& vertex_values, const Mesh& mesh) const override Compute values at all mesh vertices @param vertex_values (Array) The values at all vertices. @param mesh (:cpp:class:`Mesh`) The mesh. .. cpp:function:: void compute_vertex_values(std::vector& vertex_values) Compute values at all mesh vertices @param vertex_values (Array) The values at all vertices. .. cpp:function:: void set_allow_extrapolation(bool allow_extrapolation) Allow extrapolation when evaluating the Function @param allow_extrapolation (bool) Whether or not permit extrapolation. .. cpp:function:: bool get_allow_extrapolation() const Check if extrapolation is permitted when evaluating the Function @return bool True if extrapolation is permitted, otherwise false