PolyFEM
Loading...
Searching...
No Matches
OperationCache.hpp
Go to the documentation of this file.
1#pragma once
2
4
5#include <wmtk/utils/TupleUtils.hpp>
6
7namespace polyfem::mesh
8{
10 {
11 public:
12 using VertexAttributes = WildTriRemesher::VertexAttributes;
13 using EdgeAttributes = WildTriRemesher::BoundaryAttributes;
14 using FaceAttributes = WildTriRemesher::ElementAttributes;
15 using Tuple = wmtk::TriMesh::Tuple;
16
18 static std::shared_ptr<TriOperationCache> split_edge(WildTriRemesher &m, const Tuple &t);
19 static std::shared_ptr<TriOperationCache> swap_edge(WildTriRemesher &m, const Tuple &t);
20 static std::shared_ptr<TriOperationCache> collapse_edge(WildTriRemesher &m, const Tuple &t);
21
22 const std::pair<size_t, VertexAttributes> &v0() const { return m_v0; }
23 const std::pair<size_t, VertexAttributes> &v1() const { return m_v1; }
25 const std::vector<FaceAttributes> &faces() const { return m_faces; }
26 bool is_boundary_op() const { return m_is_boundary_op; }
27
28 double local_energy = std::numeric_limits<double>::quiet_NaN();
30
31 protected:
32 std::pair<size_t, VertexAttributes> m_v0;
33 std::pair<size_t, VertexAttributes> m_v1;
35 std::vector<FaceAttributes> m_faces;
36 bool m_is_boundary_op = false;
37 };
38
40 {
41 public:
42 using VertexAttributes = WildTetRemesher::VertexAttributes;
43 using EdgeAttributes = WildTetRemesher::EdgeAttributes;
44 using FaceAttributes = WildTetRemesher::BoundaryAttributes;
45 using TetAttributes = WildTetRemesher::ElementAttributes;
46 using Tuple = wmtk::TetMesh::Tuple;
47
48 static std::shared_ptr<TetOperationCache> split_edge(WildTetRemesher &m, const Tuple &t);
49 static std::shared_ptr<TetOperationCache> swap_32(WildTetRemesher &m, const Tuple &t) { log_and_throw_error("TetOperationCache::swap_32 not implemented!"); }
50 // static TetOperationCache swap_23(WildTetRemesher &m, const Tuple &t);
51 // static TetOperationCache swap_44(WildTetRemesher &m, const Tuple &t);
52 static std::shared_ptr<TetOperationCache> collapse_edge(WildTetRemesher &m, const Tuple &t);
53
54 const std::pair<size_t, VertexAttributes> &v0() const { return m_v0; }
55 const std::pair<size_t, VertexAttributes> &v1() const { return m_v1; }
56 const std::optional<std::pair<size_t, VertexAttributes>> &v2() const { return m_v2; }
59 const Remesher::TetMap<TetAttributes> &tets() const { return m_tets; }
60 bool is_boundary_op() const { return m_is_boundary_op; }
61
62 double local_energy = std::numeric_limits<double>::quiet_NaN();
64
65 protected:
66 std::pair<size_t, VertexAttributes> m_v0;
67 std::pair<size_t, VertexAttributes> m_v1;
68 std::optional<std::pair<size_t, VertexAttributes>> m_v2;
72 bool m_is_boundary_op = false;
73 };
74} // namespace polyfem::mesh
std::unordered_map< std::array< size_t, 2 >, T, polyfem::utils::HashUnorderedArray< size_t, 2 >, polyfem::utils::EqualUnorderedArray< size_t, 2 > > EdgeMap
Map from a (sorted) edge to an integer (ID)
Definition Remesher.hpp:29
std::unordered_map< std::array< size_t, 3 >, T, polyfem::utils::HashUnorderedArray< size_t, 3 >, polyfem::utils::EqualUnorderedArray< size_t, 3 > > FaceMap
Map from a (sorted) edge to an integer (ID)
Definition Remesher.hpp:35
std::unordered_map< std::array< size_t, 4 >, T, polyfem::utils::HashUnorderedArray< size_t, 4 >, polyfem::utils::EqualUnorderedArray< size_t, 4 > > TetMap
Definition Remesher.hpp:40
std::pair< size_t, VertexAttributes > m_v0
static std::shared_ptr< TetOperationCache > split_edge(WildTetRemesher &m, const Tuple &t)
Remesher::TetMap< TetAttributes > m_tets
const std::pair< size_t, VertexAttributes > & v1() const
static std::shared_ptr< TetOperationCache > collapse_edge(WildTetRemesher &m, const Tuple &t)
const Remesher::FaceMap< FaceAttributes > & faces() const
const std::pair< size_t, VertexAttributes > & v0() const
Remesher::FaceMap< FaceAttributes > m_faces
Remesher::EdgeMap< EdgeAttributes > m_edges
const Remesher::TetMap< TetAttributes > & tets() const
static std::shared_ptr< TetOperationCache > swap_32(WildTetRemesher &m, const Tuple &t)
std::optional< std::pair< size_t, VertexAttributes > > m_v2
const std::optional< std::pair< size_t, VertexAttributes > > & v2() const
std::pair< size_t, VertexAttributes > m_v1
const Remesher::EdgeMap< EdgeAttributes > & edges() const
std::vector< FaceAttributes > m_faces
const std::vector< FaceAttributes > & faces() const
const Remesher::EdgeMap< EdgeAttributes > & edges() const
const std::pair< size_t, VertexAttributes > & v0() const
static std::shared_ptr< TriOperationCache > collapse_edge(WildTriRemesher &m, const Tuple &t)
const std::pair< size_t, VertexAttributes > & v1() const
std::pair< size_t, VertexAttributes > m_v0
Remesher::EdgeMap< EdgeAttributes > m_edges
static std::shared_ptr< TriOperationCache > split_edge(WildTriRemesher &m, const Tuple &t)
Construct a local mesh as an n-ring around a vertex.
static std::shared_ptr< TriOperationCache > swap_edge(WildTriRemesher &m, const Tuple &t)
std::pair< size_t, VertexAttributes > m_v1
WildTetRemesher::Tuple Tuple
void log_and_throw_error(const std::string &msg)
Definition Logger.cpp:71