DOLFIN
DOLFIN C++ interface
Public Member Functions | Friends | List of all members
dolfin::Function Class Reference

#include <Function.h>

Inheritance diagram for dolfin::Function:
Inheritance graph
[legend]
Collaboration diagram for dolfin::Function:
Collaboration graph
[legend]

Public Member Functions

 Function (std::shared_ptr< const FunctionSpace > V)
 
 Function (std::shared_ptr< const FunctionSpace > V, std::shared_ptr< GenericVector > x)
 
 Function (std::shared_ptr< const FunctionSpace > V, std::string filename)
 
 Function (const Function &v)
 
 Function (const Function &v, std::size_t i)
 
virtual ~Function ()
 Destructor.
 
const Functionoperator= (const Function &v)
 
const Functionoperator= (const Expression &v)
 
void operator= (const FunctionAXPY &axpy)
 
Functionoperator[] (std::size_t i) const
 
virtual std::shared_ptr< const FunctionSpacefunction_space () const override
 
std::shared_ptr< GenericVectorvector ()
 
std::shared_ptr< const GenericVectorvector () const
 
bool in (const FunctionSpace &V) const
 
std::size_t geometric_dimension () const
 
void eval (Array< double > &values, const Array< double > &x) const override
 
void eval (Array< double > &values, const Array< double > &x, const Cell &dolfin_cell, const ufc::cell &ufc_cell) const
 
void eval (Eigen::Ref< Eigen::VectorXd > values, Eigen::Ref< const Eigen::VectorXd > x) const override
 
void eval (Eigen::Ref< Eigen::VectorXd > values, Eigen::Ref< const Eigen::VectorXd > x, const dolfin::Cell &dolfin_cell, const ufc::cell &ufc_cell) const
 
void interpolate (const GenericFunction &v)
 
void extrapolate (const Function &v)
 
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 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 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
 
void compute_vertex_values (std::vector< double > &vertex_values)
 
void set_allow_extrapolation (bool allow_extrapolation)
 
bool get_allow_extrapolation () const
 
- 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. More...
 
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 Variableoperator= (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
 
virtual std::string str (bool verbose) const
 Return informal string representation (pretty-print)
 
- Public Member Functions inherited from dolfin::Hierarchical< Function >
 Hierarchical (Function &self)
 Constructor.
 
virtual ~Hierarchical ()
 Destructor.
 
std::size_t depth () const
 
bool has_parent () const
 
bool has_child () const
 
Functionparent ()
 
const Functionparent () const
 Return parent in hierarchy (const version).
 
std::shared_ptr< Functionparent_shared_ptr ()
 
std::shared_ptr< const Functionparent_shared_ptr () const
 Return shared pointer to parent (const version).
 
Functionchild ()
 
const Functionchild () const
 Return child in hierarchy (const version).
 
std::shared_ptr< Functionchild_shared_ptr ()
 
std::shared_ptr< const Functionchild_shared_ptr () const
 Return shared pointer to child (const version).
 
Functionroot_node ()
 
const Functionroot_node () const
 Return root node object in hierarchy (const version).
 
std::shared_ptr< Functionroot_node_shared_ptr ()
 
std::shared_ptr< const Functionroot_node_shared_ptr () const
 Return shared pointer to root node object in hierarchy (const version).
 
Functionleaf_node ()
 
const Functionleaf_node () const
 Return leaf node object in hierarchy (const version).
 
std::shared_ptr< Functionleaf_node_shared_ptr ()
 
std::shared_ptr< const Functionleaf_node_shared_ptr () const
 Return shared pointer to leaf node object in hierarchy (const version).
 
void set_parent (std::shared_ptr< Function > parent)
 Set parent.
 
void clear_child ()
 Clear child.
 
void set_child (std::shared_ptr< Function > child)
 Set child.
 
const Hierarchicaloperator= (const Hierarchical &hierarchical)
 Assignment operator.
 
void _debug () const
 Function useful for debugging the hierarchy.
 

Friends

class FunctionSpace
 
class FunctionAssigner
 

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)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Function() [1/5]

Function::Function ( std::shared_ptr< const FunctionSpace V)
explicit

Create function on given function space (shared data)

Arguments V (FunctionSpace) The function space.

◆ Function() [2/5]

Function::Function ( std::shared_ptr< const FunctionSpace V,
std::shared_ptr< GenericVector 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 (FunctionSpace) The function space. x (GenericVector) The vector.

◆ Function() [3/5]

Function::Function ( std::shared_ptr< const FunctionSpace V,
std::string  filename 
)

Create function from vector of dofs stored to file (shared data)

Arguments V (FunctionSpace) The function space. filename_dofdata (std::string) The name of the file containing the dofmap data.

◆ Function() [4/5]

Function::Function ( const Function v)

Copy constructor

Arguments v (Function) The object to be copied.

◆ Function() [5/5]

Function::Function ( const Function v,
std::size_t  i 
)

Sub-function constructor with shallow copy of vector (used in Python interface)

Arguments v (Function) The function to be copied. i (std::size_t) Index of subfunction.

Member Function Documentation

◆ compute_vertex_values() [1/2]

void Function::compute_vertex_values ( std::vector< double > &  vertex_values,
const Mesh mesh 
) const
overridevirtual

Compute values at all mesh vertices

Parameters
vertex_values(Array<double>) The values at all vertices.
mesh(Mesh) The mesh.

Implements dolfin::GenericFunction.

◆ compute_vertex_values() [2/2]

void Function::compute_vertex_values ( std::vector< double > &  vertex_values)

Compute values at all mesh vertices

Parameters
vertex_values(Array<double>) The values at all vertices.

◆ eval() [1/6]

void Function::eval ( Array< double > &  values,
const Array< double > &  x 
) const
overridevirtual

Evaluate function at given coordinates

Parameters
values(Array<double>) The values.
x(Array<double>) The coordinates.

Reimplemented from dolfin::GenericFunction.

◆ eval() [2/6]

void Function::eval ( Array< double > &  values,
const Array< double > &  x,
const Cell dolfin_cell,
const ufc::cell &  ufc_cell 
) const

Evaluate function at given coordinates in given cell

Arguments

Parameters
values(Array<double>) The values.
x(Array<double>) The coordinates.
dolfin_cell(Cell) The cell.
ufc_cell(ufc::cell) The ufc::cell.

◆ eval() [3/6]

void Function::eval ( Eigen::Ref< Eigen::VectorXd >  values,
Eigen::Ref< const Eigen::VectorXd >  x 
) const
overridevirtual

Evaluate function at given coordinates

Parameters
values(Eigen::Ref<Eigen::VectorXd> values) The values.
x(Eigen::Ref<const Eigen::VectorXd> x) The coordinates.

Reimplemented from dolfin::GenericFunction.

◆ eval() [4/6]

void Function::eval ( Eigen::Ref< Eigen::VectorXd >  values,
Eigen::Ref< const Eigen::VectorXd >  x,
const dolfin::Cell dolfin_cell,
const ufc::cell &  ufc_cell 
) const

Evaluate function at given coordinates in given cell

Arguments

Parameters
values(Eigen::Ref<Eigen::VectorXd>) The values.
x(Eigen::Ref<const Eigen::VectorXd>) The coordinates.
dolfin_cell(Cell) The cell.
ufc_cell(ufc::cell) The ufc::cell.

◆ eval() [5/6]

void Function::eval ( Array< double > &  values,
const Array< double > &  x,
const ufc::cell &  cell 
) const
overridevirtual

Evaluate at given point in given cell

Parameters
values(Array<double>) The values at the point.
x(Array<double>) The coordinates of the point.
cell(ufc::cell) The cell which contains the given point.

Reimplemented from dolfin::GenericFunction.

◆ eval() [6/6]

void Function::eval ( Eigen::Ref< Eigen::VectorXd >  values,
Eigen::Ref< const Eigen::VectorXd >  x,
const ufc::cell &  cell 
) const
overridevirtual

Evaluate at given point in given cell

Parameters
values(Eigen::Ref<Eigen::VectorXd>) The values at the point.
x(Eigen::Ref<const Eigen::VectorXd> The coordinates of the point.
cell(ufc::cell) The cell which contains the given point.

Reimplemented from dolfin::GenericFunction.

◆ extrapolate()

void Function::extrapolate ( const Function v)

Extrapolate function (from a possibly lower-degree function space)

Arguments v (Function) The function to be extrapolated.

◆ function_space()

virtual std::shared_ptr<const FunctionSpace> dolfin::Function::function_space ( ) const
inlineoverridevirtual

Return shared pointer to function space

Returns FunctionSpace Return the shared pointer.

Implements dolfin::GenericFunction.

◆ geometric_dimension()

std::size_t Function::geometric_dimension ( ) const

Return geometric dimension

Returns std::size_t The geometric dimension.

◆ get_allow_extrapolation()

bool dolfin::Function::get_allow_extrapolation ( ) const
inline

Check if extrapolation is permitted when evaluating the Function

Returns
bool True if extrapolation is permitted, otherwise false

◆ in()

bool Function::in ( const FunctionSpace V) const

Check if function is a member of the given function space

Arguments V (FunctionSpace) The function space.

Returns bool True if the function is in the function space.

◆ interpolate()

void Function::interpolate ( const GenericFunction v)

Interpolate function (on possibly non-matching meshes)

Parameters
v(GenericFunction) The function to be interpolated.

◆ operator=() [1/3]

const Function & Function::operator= ( const Function v)

Assignment from function

Arguments v (Function) Another function.

◆ operator=() [2/3]

const Function & Function::operator= ( const Expression v)

Assignment from expression using interpolation

Arguments v (Expression) The expression.

◆ operator=() [3/3]

void Function::operator= ( const FunctionAXPY axpy)

Assignment from linear combination of function

Arguments v (FunctionAXPY) A linear combination of other Functions

◆ operator[]()

Function & Function::operator[] ( std::size_t  i) const

Extract subfunction

Arguments i (std::size_t) Index of subfunction. Returns Function The subfunction.

◆ restrict()

void Function::restrict ( double *  w,
const FiniteElement element,
const Cell dolfin_cell,
const double *  coordinate_dofs,
const ufc::cell &  ufc_cell 
) const
overridevirtual

Restrict function to local cell (compute expansion coefficients w)

Parameters
w(list of doubles) Expansion coefficients.
element(FiniteElement) The element.
dolfin_cell(Cell) The cell.
coordinate_dofs(double *) The coordinates
ufc_cell(ufc::cell). The ufc::cell.

Implements dolfin::GenericFunction.

◆ set_allow_extrapolation()

void dolfin::Function::set_allow_extrapolation ( bool  allow_extrapolation)
inline

Allow extrapolation when evaluating the Function

Parameters
allow_extrapolation(bool) Whether or not permit extrapolation.

◆ value_dimension()

std::size_t Function::value_dimension ( std::size_t  i) const
overridevirtual

Return value dimension for given axis

Arguments i (std::size_t) The index of the axis.

Returns std::size_t The value dimension.

Implements dolfin::GenericFunction.

◆ value_rank()

std::size_t Function::value_rank ( ) const
overridevirtual

Return value rank

Returns std::size_t The value rank.

Implements dolfin::GenericFunction.

◆ value_shape()

std::vector< std::size_t > Function::value_shape ( ) const
overridevirtual

Return value shape

Returns std::vector<std::size_t> The value shape.

Implements dolfin::GenericFunction.

◆ vector() [1/2]

std::shared_ptr< GenericVector > Function::vector ( )

Return vector of expansion coefficients (non-const version)

Returns GenericVector The vector of expansion coefficients.

◆ vector() [2/2]

std::shared_ptr< const GenericVector > Function::vector ( ) const

Return vector of expansion coefficients (const version)

Returns GenericVector The vector of expansion coefficients (const).


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