Loading...
Searching...
No Matches
Expression.h
// Copyright (C) 2009 Anders Logg
//
// This file is part of DOLFIN.
//
// DOLFIN is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// DOLFIN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
//
// First added: 2009-09-28
// Last changed: 2011-08-15
#ifndef __EXPRESSION_H
#define __EXPRESSION_H
#include <vector>
#include <ufc.h>
#include <Eigen/Dense>
#include <dolfin/common/Array.h>
#include "GenericFunction.h"
namespace dolfin
{
class Mesh;
class Expression : public GenericFunction
{
public:
Expression();
explicit Expression(std::size_t dim);
Expression(std::size_t dim0, std::size_t dim1);
explicit Expression(std::vector<std::size_t> value_shape);
Expression(const Expression& expression);
virtual ~Expression();
//--- Implementation of GenericFunction interface ---
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 eval(Array<double>& values, const Array<double>& x) const override;
virtual void eval(Eigen::Ref<Eigen::VectorXd> values,
Eigen::Ref<const Eigen::VectorXd> x) 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;
protected:
// Value shape
std::vector<std::size_t> _value_shape;
};
}
#endif
dolfin::Array
Definition Array.h:42
dolfin::Cell
A Cell is a MeshEntity of topological codimension 0.
Definition Cell.h:43
dolfin::Expression::~Expression
virtual ~Expression()
Destructor.
Definition Expression.cpp:62
dolfin::Expression::function_space
virtual std::shared_ptr< const FunctionSpace > function_space() const override
Definition Expression.cpp:202
dolfin::Expression::value_shape
virtual std::vector< std::size_t > value_shape() const override
Definition Expression.cpp:119
dolfin::Expression::value_rank
virtual std::size_t value_rank() const override
Definition Expression.cpp:102
dolfin::Expression::restrict
virtual void restrict(double *w, const FiniteElement &element, const Cell &dolfin_cell, const double *coordinate_dofs, const ufc::cell &ufc_cell) const override
Definition Expression.cpp:154
dolfin::Expression::value_dimension
virtual std::size_t value_dimension(std::size_t i) const override
Definition Expression.cpp:107
dolfin::Expression::eval
virtual void eval(Array< double > &values, const Array< double > &x, const ufc::cell &cell) const override
Definition Expression.cpp:67
dolfin::Expression::set_generic_function
virtual void set_generic_function(std::string name, std::shared_ptr< GenericFunction > f)
Definition Expression.cpp:139
dolfin::Expression::set_property
virtual void set_property(std::string name, double value)
Definition Expression.cpp:124
dolfin::Expression::compute_vertex_values
virtual void compute_vertex_values(std::vector< double > &vertex_values, const Mesh &mesh) const override
Definition Expression.cpp:165
dolfin::Expression::get_property
virtual double get_property(std::string name) const
Definition Expression.cpp:131
dolfin::Expression::get_generic_function
virtual std::shared_ptr< dolfin::GenericFunction > get_generic_function(std::string name) const
Definition Expression.cpp:146
dolfin::Expression::Expression
Expression()
Create scalar expression.
Definition Expression.cpp:32
dolfin::FiniteElement
This is a wrapper for a UFC finite element (ufc::finite_element).
Definition FiniteElement.h:36
dolfin::GenericFunction::GenericFunction
GenericFunction()
Constructor.
Definition GenericFunction.cpp:31
dolfin::Mesh
Definition Mesh.h:84
dolfin::Variable::name
std::string name() const
Return name.
Definition Variable.cpp:71
dolfin
Definition adapt.h:30