31 if (
mesh().top_simplex_type() ==
PT) {
36 double old_energy_max = std::numeric_limits<double>::lowest();
37 double new_energy_max = std::numeric_limits<double>::lowest();
48 const auto& v0_incident_tets =
50 const auto& v1_incident_tets =
54 for (
const auto& t : v1_incident_tets) {
56 assert(lv.size() == 4);
60 std::max(old_energy_max, amips_accessor.const_scalar_attribute(t.tuple()));
63 bool incident_both =
false;
64 for (
int i = 0; i < 4; ++i) {
73 if (incident_both)
continue;
76 std::array<Eigen::Vector<double, 3>, 4> lv_pos = {
77 {position_accessor.const_vector_attribute(lv[0]),
78 position_accessor.const_vector_attribute(lv[1]),
79 position_accessor.const_vector_attribute(lv[2]),
80 position_accessor.const_vector_attribute(lv[3])}};
82 for (
int i = 0; i < 4; ++i) {
88 lv_pos[i] = position_accessor.const_vector_attribute(v0);
113 new_energy_max = std::max(new_energy_max, new_energy);
117 for (
const auto& t : v0_incident_tets) {
121 bool incident_both =
false;
122 for (
int i = 0; i < 4; ++i) {
127 incident_both =
true;
131 if (incident_both)
continue;
134 const double energy = amips_accessor.const_scalar_attribute(t.tuple());
135 old_energy_max = std::max(old_energy_max, energy);
138 new_energy_max = std::max(new_energy_max, energy);
151 const auto& v0_incident_tets =
153 const auto& v1_incident_tets =
157 for (
const auto& t : v0_incident_tets) {
159 assert(lv.size() == 4);
163 std::max(old_energy_max, amips_accessor.const_scalar_attribute(t.tuple()));
167 bool incident_both =
false;
168 for (
int i = 0; i < 4; ++i) {
173 incident_both =
true;
177 if (incident_both)
continue;
180 std::array<Eigen::Vector<double, 3>, 4> lv_pos = {
181 {position_accessor.const_vector_attribute(lv[0]),
182 position_accessor.const_vector_attribute(lv[1]),
183 position_accessor.const_vector_attribute(lv[2]),
184 position_accessor.const_vector_attribute(lv[3])}};
186 for (
int i = 0; i < 4; ++i) {
192 lv_pos[i] = position_accessor.const_vector_attribute(v1);
216 new_energy_max = std::max(new_energy_max, new_energy);
220 for (
const auto& t : v1_incident_tets) {
224 bool incident_both =
false;
225 for (
int i = 0; i < 4; ++i) {
230 incident_both =
true;
234 if (incident_both)
continue;
237 const double energy = amips_accessor.const_scalar_attribute(t.tuple());
238 old_energy_max = std::max(old_energy_max, energy);
241 new_energy_max = std::max(new_energy_max, energy);
248 throw std::runtime_error(
"not implemented");
251 default:
throw std::runtime_error(
"Invalid collapse type");
255 return new_energy_max <= old_energy_max;
257 }
else if (
mesh().top_simplex_type() ==
PF) {
int wmtk_orient3d(const Eigen::Ref< const Eigen::Vector3< Rational > > &p0, const Eigen::Ref< const Eigen::Vector3< Rational > > &p1, const Eigen::Ref< const Eigen::Vector3< Rational > > &p2, const Eigen::Ref< const Eigen::Vector3< Rational > > &p3)