Wildmeshing Toolkit
Loading...
Searching...
No Matches
PointMesh.cpp
Go to the documentation of this file.
1#include "PointMesh.hpp"
2
3namespace wmtk {
5{
6 return Tuple(-1, -1, -1, id);
7}
8
9PointMesh::~PointMesh() = default;
13
14
16 : PointMesh()
17{
18 initialize(size);
19}
20
22{
23 throw std::runtime_error("Tuple switch: Invalid primitive type");
24}
25bool PointMesh::is_ccw(const Tuple&) const
26{
27 // trivial orientation so nothing can happen
28 return true;
29}
30bool PointMesh::is_boundary(PrimitiveType pt, const Tuple& tuple) const
31{
32 switch (pt) {
33 case PrimitiveType::Vertex: return is_boundary_vertex(tuple);
37 default: break;
38 }
39 assert(
40 false); // "tried to compute the boundary of a point mesh for an invalid simplex dimension"
41 // every point is on the interior as it has no boundary simplices
42 return false;
43}
44
46{
47 // every point is on the interior as it has no boundary simplices
48 return false;
49}
50
51void PointMesh::initialize(int64_t count)
52{
53 set_capacities({count});
56 for (int64_t i = 0; i < capacity(PrimitiveType::Vertex); ++i) {
57 v_flag_accessor.index_access().activate(i);
58 }
59}
60
61
62bool PointMesh::is_valid(const Tuple& tuple) const
63{
64 if (!Mesh::is_valid(tuple)) {
65 return false;
66 }
67 return true;
68}
69
70
71Tuple PointMesh::tuple_from_id(const PrimitiveType type, const int64_t gid) const
72{
73 assert(type == PrimitiveType::Vertex); // "Tuple switch: Invalid primitive type"
74 return vertex_tuple_from_id(gid);
75}
76
77std::vector<std::vector<TypedAttributeHandle<int64_t>>> PointMesh::connectivity_attributes() const
78{
79 std::vector<std::vector<TypedAttributeHandle<int64_t>>> handles(0);
80
81 return handles;
82}
83
84std::vector<Tuple> PointMesh::orient_vertices(const Tuple& tuple) const
85{
86 return {tuple};
87}
88
89} // namespace wmtk
A Curiously Recurring Template Pattern shim to enable generic specialization of functions.
Definition MeshCRTP.hpp:24
void set_capacities(std::vector< int64_t > capacities)
int64_t capacity(PrimitiveType type) const
read in the m_capacities return the upper bound for the number of entities of the given dimension
virtual bool is_valid(const Tuple &tuple) const
check validity of tuple including its hash
Definition Mesh.cpp:113
void reserve_attributes_to_fit()
reserve space for all attributes data types for all dimensional simplices
const attribute::FlagAccessor< Mesh > get_flag_accessor(PrimitiveType type) const
Definition Mesh.cpp:159
std::vector< Tuple > orient_vertices(const Tuple &tuple) const override
Definition PointMesh.cpp:84
Tuple vertex_tuple_from_id(int64_t id) const
Definition PointMesh.cpp:4
Tuple tuple_from_id(const PrimitiveType type, const int64_t gid) const override
internal function that returns the tuple of requested type, and has the global index cid
Definition PointMesh.cpp:71
bool is_boundary(PrimitiveType pt, const Tuple &tuple) const override
returns if a simplex is on the boundary of hte mesh. For anything but dimension - 1 this checks if th...
Definition PointMesh.cpp:30
Tuple switch_tuple(const Tuple &tuple, PrimitiveType type) const override
switch the orientation of the Tuple of the given dimension
Definition PointMesh.cpp:21
bool is_valid(const Tuple &tuple) const final override
check validity of tuple including its hash
Definition PointMesh.cpp:62
~PointMesh() override
std::vector< std::vector< TypedAttributeHandle< int64_t > > > connectivity_attributes() const override
Returns a vector of vectors of attribute handles.
Definition PointMesh.cpp:77
bool is_ccw(const Tuple &tuple) const override
returns if a tuple is counterclockwise or not
Definition PointMesh.cpp:25
bool is_boundary_vertex(const Tuple &tuple) const
Definition PointMesh.cpp:45
void initialize(int64_t count)
Definition PointMesh.cpp:51
The Tuple is the basic navigation tool in our mesh data structure.
Definition Tuple.hpp:19
const IndexBaseType & index_access() const