Wildmeshing Toolkit
Loading...
Searching...
No Matches
PointMesh.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "MeshCRTP.hpp"
4#include "Tuple.hpp"
5
6#include <Eigen/Core>
7
8namespace wmtk {
9// Simple mesh without topology. Mainly useful for testing attributes without having to construct
10// topologies
11class PointMesh : public MeshCRTP<PointMesh>
12{
13private:
14 Tuple vertex_tuple_from_id(int64_t id) const;
15
16public:
17 friend class MeshCRTP<PointMesh>;
18 template <typename U, typename MeshType, int Dim>
19 friend class attribute::Accessor;
20 PointMesh();
21 ~PointMesh() override;
22 PointMesh(int64_t size);
23 PointMesh(const PointMesh& o) = delete;
24 PointMesh(PointMesh&& o) = default;
25 PointMesh& operator=(const PointMesh& o) = delete;
26 PointMesh& operator=(PointMesh&& o) = default;
27
28 [[noreturn]] Tuple switch_tuple(const Tuple& tuple, PrimitiveType type) const override;
29 bool is_ccw(const Tuple& tuple) const override;
31 bool is_boundary(PrimitiveType pt, const Tuple& tuple) const override;
32 bool is_boundary_vertex(const Tuple& tuple) const;
33
34 void initialize(int64_t count);
35
36
37 bool is_valid(const Tuple& tuple) const final override;
38
39 bool is_connectivity_valid() const override { return true; }
40
41 std::vector<std::vector<TypedAttributeHandle<int64_t>>> connectivity_attributes()
42 const override;
43
44 std::vector<Tuple> orient_vertices(const Tuple& tuple) const override;
45
46 using MeshCRTP<PointMesh>::id; // getting the (simplex) prototype
47 int64_t id(const Tuple& tuple, PrimitiveType type) const;
48
49protected:
57 Tuple tuple_from_id(const PrimitiveType type, const int64_t gid) const override;
58};
59
60inline int64_t PointMesh::id(const Tuple& tuple, PrimitiveType type) const
61{
62 switch (type) {
63 case PrimitiveType::Vertex: return tuple.global_cid();
67 default: assert(false); // "Tuple switch: Invalid primitive type"
68 }
69
70 return -1;
71}
72} // namespace wmtk
A Curiously Recurring Template Pattern shim to enable generic specialization of functions.
Definition MeshCRTP.hpp:24
bool is_boundary(const simplex::Simplex &tuple) const
check if a simplex lies on a boundary or not
Definition Mesh.cpp:107
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
PointMesh(PointMesh &&o)=default
Tuple switch_tuple(const Tuple &tuple, PrimitiveType type) const override
switch the orientation of the Tuple of the given dimension
Definition PointMesh.cpp:21
PointMesh(const PointMesh &o)=delete
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
int64_t id(const Tuple &tuple, PrimitiveType type) const
Definition PointMesh.hpp:60
PointMesh & operator=(const PointMesh &o)=delete
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
PointMesh & operator=(PointMesh &&o)=default
bool is_connectivity_valid() const override
Definition PointMesh.hpp:39
The Tuple is the basic navigation tool in our mesh data structure.
Definition Tuple.hpp:19
int64_t global_cid() const
Definition Tuple.hxx:47
A CachingAccessor that uses tuples for accessing attributes instead of indices.
Definition Accessor.hpp:28