Wildmeshing Toolkit
Mesh_construction.cpp
Go to the documentation of this file.
1 
2 #include <numeric>
3 #include "Mesh.hpp"
4 
5 #include <wmtk/utils/Logger.hpp>
7 
8 #include "Primitive.hpp"
9 
10 namespace wmtk {
11 
12 Mesh::Mesh(Mesh&& other)
13  : m_attribute_manager(std::move(other.m_attribute_manager))
14  , m_multi_mesh_manager(std::move(other.m_multi_mesh_manager))
15  , m_top_cell_dimension(other.m_top_cell_dimension)
16  , m_is_free(other.m_is_free)
17 {
18  m_flag_handles = std::move(other.m_flag_handles);
19  m_cell_hash_handle = std::move(other.m_cell_hash_handle);
20 }
21 
22 
24 {
25  m_attribute_manager = std::move(other.m_attribute_manager);
26  m_multi_mesh_manager = std::move(other.m_multi_mesh_manager);
27  m_flag_handles = std::move(other.m_flag_handles);
28  m_top_cell_dimension = other.m_top_cell_dimension;
29  m_cell_hash_handle = std::move(other.m_cell_hash_handle);
30  m_is_free = other.m_is_free;
31 
32  return *this;
33 }
34 
35 Mesh::Mesh(const int64_t& dimension)
36  : Mesh(dimension, dimension, get_primitive_type_from_id(dimension))
37 {}
38 
39 Mesh::Mesh(const int64_t& dimension, const int64_t& max_primitive_type_id, PrimitiveType hash_type)
40  : m_attribute_manager(max_primitive_type_id + 1)
41  , m_multi_mesh_manager(max_primitive_type_id + 1)
42  , m_top_cell_dimension(dimension)
43  , m_cell_hash_handle(register_attribute_typed<int64_t>("hash", hash_type, 1, false, 0))
44 {
45  m_flag_handles.reserve(max_primitive_type_id + 1);
46  for (int64_t j = 0; j <= max_primitive_type_id; ++j) {
47  m_flag_handles.emplace_back(
48  register_attribute_typed<char>("flags", get_primitive_type_from_id(j), 1, false, 0));
49  }
50 }
51 
52 
54 
56 }
57 } // namespace wmtk
bool m_is_free
Definition: Mesh.hpp:847
Mesh(const int64_t &dimension)
std::vector< TypedAttributeHandle< char > > m_flag_handles
0x1 == true = simplex is active (simplex exists) all flag default to 0
Definition: Mesh.hpp:865
multimesh::MultiMeshManager m_multi_mesh_manager
Definition: Mesh.hpp:842
Mesh & operator=(const Mesh &other)=delete
int64_t m_top_cell_dimension
Definition: Mesh.hpp:844
TypedAttributeHandle< int64_t > m_cell_hash_handle
Definition: Mesh.hpp:869
attribute::AttributeManager m_attribute_manager
Definition: Mesh.hpp:840
Definition: autodiff.h:995
Definition: Accessor.hpp:6
constexpr PrimitiveType get_primitive_type_from_id(int8_t id)
Get the primitive type corresponding to its unique integer id.