Wildmeshing Toolkit
PerSimplexFunction.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <wmtk/Primitive.hpp>
4 
6 
7 #include <Eigen/Core>
8 
9 namespace wmtk::function {
10 
12 {
13 public:
15  const Mesh& mesh,
16  const PrimitiveType primitive_type,
17  const attribute::MeshAttributeHandle& variable_attribute_handle);
18  virtual ~PerSimplexFunction() {}
19 
27  virtual double get_value(const simplex::Simplex& domain_simplex) const = 0;
28  virtual Eigen::VectorXd get_gradient(
29  const simplex::Simplex& domain_simplex,
30  const simplex::Simplex& variable_simplex) const
31  {
32  throw std::runtime_error("Gradient not implemented");
33  }
34  virtual Eigen::MatrixXd get_hessian(
35  const simplex::Simplex& domain_simplex,
36  const simplex::Simplex& variable_simplex) const
37  {
38  throw std::runtime_error("Hessian not implemented");
39  }
40 
41  inline const Mesh& mesh() const { return m_mesh; }
43  {
44  assert(m_handle.is_valid());
45  return m_handle;
46  }
47 
48  int64_t embedded_dimension() const;
49 
50 private:
52  const Mesh& m_mesh;
53 
54 protected:
56 };
57 } // namespace wmtk::function
virtual Eigen::VectorXd get_gradient(const simplex::Simplex &domain_simplex, const simplex::Simplex &variable_simplex) const
const attribute::MeshAttributeHandle & attribute_handle() const
virtual double get_value(const simplex::Simplex &domain_simplex) const =0
This function is defined over a simplex (normally a triangle or tetrahedron).
PerSimplexFunction(const Mesh &mesh, const PrimitiveType primitive_type, const attribute::MeshAttributeHandle &variable_attribute_handle)
attribute::MeshAttributeHandle m_handle
virtual Eigen::MatrixXd get_hessian(const simplex::Simplex &domain_simplex, const simplex::Simplex &variable_simplex) const