Wildmeshing Toolkit
Function.hpp
Go to the documentation of this file.
1 #pragma once
2 
5 #include <Eigen/Core>
6 
7 namespace wmtk::function {
8 
9 class Function
10 {
11 public:
13  virtual ~Function() {}
14 
21  virtual double get_value(const simplex::Simplex& variable_simplex) const = 0;
22 
33  virtual Eigen::VectorXd get_gradient(const simplex::Simplex& variable_simplex) const = 0;
34 
45  virtual Eigen::MatrixXd get_hessian(const simplex::Simplex& variable_simplex) const = 0;
46 
47  inline Mesh& mesh() { return m_mesh; }
48  inline const Mesh& mesh() const { return m_mesh; }
49  inline PrimitiveType attribute_type() const { return m_handle.primitive_type(); };
50  int64_t embedded_dimension() const;
51  inline const attribute::MeshAttributeHandle& attribute_handle() const { return m_handle; }
52  virtual std::vector<simplex::Simplex> domain(
53  const simplex::Simplex& variable_simplex) const = 0;
54 
55 
56 private:
59 };
60 } // namespace wmtk::function
int64_t embedded_dimension() const
Definition: Function.cpp:15
Function(Mesh &mesh, const attribute::MeshAttributeHandle &handle)
Definition: Function.cpp:7
const Mesh & mesh() const
Definition: Function.hpp:48
PrimitiveType attribute_type() const
Definition: Function.hpp:49
virtual Eigen::MatrixXd get_hessian(const simplex::Simplex &variable_simplex) const =0
get_hessian evaluates the hessian of the function f(x) defined wrt the variable x.
virtual std::vector< simplex::Simplex > domain(const simplex::Simplex &variable_simplex) const =0
attribute::MeshAttributeHandle m_handle
Definition: Function.hpp:58
virtual double get_value(const simplex::Simplex &variable_simplex) const =0
Given a function f(x), get_value evaluate the function at the input simplex.
virtual Eigen::VectorXd get_gradient(const simplex::Simplex &variable_simplex) const =0
get_gradient evaluates the gradient of the function f(x) defined wrt the variable x.
const attribute::MeshAttributeHandle & attribute_handle() const
Definition: Function.hpp:51