Wildmeshing Toolkit
|
This is an extension of the PerSimplexFunction class that uses autodiff encoding for differentiations. More...
#include <PerSimplexAutodiffFunction.hpp>
Public Types | |
using | DScalar = DScalar2< double, Eigen::Matrix< double, -1, 1 >, Eigen::Matrix< double, -1, -1 > > |
using | Scalar = typename DScalar::Scalar |
using | DSVec = Eigen::VectorX< DScalar > |
Public Member Functions | |
PerSimplexAutodiffFunction (const Mesh &mesh, const PrimitiveType primitive_type, const attribute::MeshAttributeHandle &variable_attribute_handle) | |
~PerSimplexAutodiffFunction () | |
double | get_value (const simplex::Simplex &domain_simplex) const override |
This function is defined over a simplex (normally a triangle or tetrahedron). More... | |
Eigen::VectorXd | get_gradient (const simplex::Simplex &domain_simplex, const simplex::Simplex &variable_simplex) const override |
Eigen::MatrixXd | get_hessian (const simplex::Simplex &domain_simplex, const simplex::Simplex &variable_simplex) const override |
Public Member Functions inherited from wmtk::function::PerSimplexFunction | |
PerSimplexFunction (const Mesh &mesh, const PrimitiveType primitive_type, const attribute::MeshAttributeHandle &variable_attribute_handle) | |
virtual | ~PerSimplexFunction () |
const Mesh & | mesh () const |
const attribute::MeshAttributeHandle & | attribute_handle () const |
int64_t | embedded_dimension () const |
Protected Member Functions | |
std::vector< DSVec > | get_coordinates (const simplex::Simplex &domain_simplex, const std::optional< simplex::Simplex > &variable_simplex_opt={}) const |
This is a helper function that obtains the coordinates of the variables for the function f(x) where f is defined over a domain consists of the input argument domain_tuples. More... | |
std::vector< DSVec > | get_coordinates (const attribute::Accessor< double > &accessor, const simplex::Simplex &domain_simplex, const std::optional< simplex::Simplex > &variable_simplex_opt={}) const |
virtual DScalar | eval (const simplex::Simplex &domain_simplex, const std::vector< DSVec > &coordinates) const =0 |
This function defines a function f(x) where f is defined over a simplex domain and the variables for f are the n vertices coordinates of the simplex. More... | |
Additional Inherited Members | |
Protected Attributes inherited from wmtk::function::PerSimplexFunction | |
const PrimitiveType | m_primitive_type |
This is an extension of the PerSimplexFunction class that uses autodiff encoding for differentiations.
Definition at line 18 of file PerSimplexAutodiffFunction.hpp.
using wmtk::function::PerSimplexAutodiffFunction::DScalar = DScalar2<double, Eigen::Matrix<double, -1, 1>, Eigen::Matrix<double, -1, -1> > |
Definition at line 21 of file PerSimplexAutodiffFunction.hpp.
using wmtk::function::PerSimplexAutodiffFunction::DSVec = Eigen::VectorX<DScalar> |
Definition at line 23 of file PerSimplexAutodiffFunction.hpp.
using wmtk::function::PerSimplexAutodiffFunction::Scalar = typename DScalar::Scalar |
Definition at line 22 of file PerSimplexAutodiffFunction.hpp.
wmtk::function::PerSimplexAutodiffFunction::PerSimplexAutodiffFunction | ( | const Mesh & | mesh, |
const PrimitiveType | primitive_type, | ||
const attribute::MeshAttributeHandle & | variable_attribute_handle | ||
) |
Definition at line 10 of file PerSimplexAutodiffFunction.cpp.
|
default |
|
protectedpure virtual |
This function defines a function f(x) where f is defined over a simplex domain and the variables for f are the n vertices coordinates of the simplex.
The input coordinates are obtained through the get_coordinates function. They are encoded in autodiff type so that the function can be differentiated through autodiff.
coordinates |
Implemented in wmtk::function::TriangleAMIPS.
Referenced by get_gradient(), get_hessian(), and get_value().
|
protected |
Definition at line 27 of file PerSimplexAutodiffFunction.cpp.
References wmtk::function::utils::get_simplex_attributes(), wmtk::function::PerSimplexFunction::m_primitive_type, wmtk::function::PerSimplexFunction::mesh(), and wmtk::simplex::Simplex::tuple().
|
protected |
This is a helper function that obtains the coordinates of the variables for the function f(x) where f is defined over a domain consists of the input argument domain_tuples.
The second input argument variable_simplex_opt is an optional simplex that is in the domain that's defined by the domain_tuples. For example, the domain_tuples for a function defined over a triangle is the vector of three vertex tuples of the triangle. And the variable_simplex, when exists, can be one of the three vertices. The function f can then be differentiable wrt the variable_simplex.
N | The number of the tuples that consist of the domain of the function f(x) |
domain_tuples | The domain of the function f(x) |
variable_simplex_opt | The optional variable_simplex that the function f(x) is differentiating wrt. |
Definition at line 19 of file PerSimplexAutodiffFunction.cpp.
References wmtk::function::PerSimplexFunction::attribute_handle(), wmtk::Mesh::create_const_accessor(), and wmtk::function::PerSimplexFunction::mesh().
Referenced by get_gradient(), get_hessian(), and get_value().
|
overridevirtual |
Reimplemented from wmtk::function::PerSimplexFunction.
Definition at line 59 of file PerSimplexAutodiffFunction.cpp.
References wmtk::function::PerSimplexFunction::embedded_dimension(), eval(), get_coordinates(), and DScalar2< _Scalar, _Gradient, _Hessian >::getGradient().
|
overridevirtual |
Reimplemented from wmtk::function::PerSimplexFunction.
Definition at line 69 of file PerSimplexAutodiffFunction.cpp.
References wmtk::function::PerSimplexFunction::embedded_dimension(), eval(), get_coordinates(), and DScalar2< _Scalar, _Gradient, _Hessian >::getHessian().
|
overridevirtual |
This function is defined over a simplex (normally a triangle or tetrahedron).
And the domain of the function is represented by the input argument domain_simplex.
domain_simplex | The domain that the function is defined over. |
Implements wmtk::function::PerSimplexFunction.
Definition at line 51 of file PerSimplexAutodiffFunction.cpp.
References wmtk::function::PerSimplexFunction::embedded_dimension(), eval(), get_coordinates(), and DScalar2< _Scalar, _Gradient, _Hessian >::getValue().