Wildmeshing Toolkit
TriangleAMIPS.cpp
Go to the documentation of this file.
1 #include "TriangleAMIPS.hpp"
2 
3 #include <wmtk/Primitive.hpp>
4 #include <wmtk/TriMesh.hpp>
7 
8 namespace wmtk::function {
10  const TriMesh& mesh,
11  const attribute::MeshAttributeHandle& vertex_attribute_handle)
12  : PerSimplexAutodiffFunction(mesh, PrimitiveType::Vertex, vertex_attribute_handle)
13 {}
14 
16 
18 using DSVec2 = Eigen::Vector2<DScalar>;
19 using DSVec3 = Eigen::Vector3<DScalar>;
20 
22  const simplex::Simplex& domain_simplex,
23  const std::vector<DSVec>& coords) const
24 {
25  assert(coords.size() == 3);
26 
27  assert(
28  domain_simplex.primitive_type() ==
29  PrimitiveType::Triangle); // "TriangleAMIPS only supports faces meshes"
30 
31  switch (embedded_dimension()) {
32  case 2: {
33  DSVec2 a = coords[0], b = coords[1], c = coords[2];
34  return utils::amips(a, b, c);
35  }
36  case 3: {
37  DSVec3 a = coords[0], b = coords[1], c = coords[2];
38  return utils::amips(a, b, c);
39  }
40  default: assert(false); // "TriangleAMIPS only supports 2D and 3D meshes"
41  }
42 
43  return DScalar();
44 }
45 
46 } // namespace wmtk::function
This is an extension of the PerSimplexFunction class that uses autodiff encoding for differentiations...
DScalar2< double, Eigen::Matrix< double, -1, 1 >, Eigen::Matrix< double, -1, -1 > > DScalar
DScalar eval(const simplex::Simplex &domain_simplex, const std::vector< DSVec > &coordinates) const override
This function defines a function f(x) where f is defined over a simplex domain and the variables for ...
TriangleAMIPS(const TriMesh &mesh, const attribute::MeshAttributeHandle &vertex_attribute_handle)
PrimitiveType primitive_type() const
Definition: Simplex.hpp:51
auto amips(const Eigen::MatrixBase< Derived > &B)
Definition: amips.hpp:20
Eigen::Vector2< DScalar > DSVec2
typename PerSimplexAutodiffFunction::DScalar DScalar
Eigen::Vector3< DScalar > DSVec3
Automatic differentiation scalar with first- and second-order derivatives.
Definition: autodiff.h:501