PolyFEM
Loading...
Searching...
No Matches
LocalBoundary.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <vector>
5#include <iostream>
6#include <cassert>
7
8namespace polyfem
9{
10 namespace mesh
11 {
12 enum class BoundaryType
13 {
14 TRI_LINE,
15 QUAD_LINE,
16 PRISM,
17 TRI,
18 QUAD,
19 POLYGON,
22 };
23
26 {
27 public:
31 LocalBoundary(const int global_element_id, BoundaryType type);
32
35 LocalBoundary(const LocalBoundary &other);
36
40 void add_boundary_primitive(const int global_index, const int local_index);
41
44 int size() const { return local_primitive_id_.size(); }
45
48 bool empty() const { return size() <= 0; }
49
52 int element_id() const { return global_element_id_; }
53
56 BoundaryType type() const { return type_; }
57
61 int local_primitive_id(const int index) const { return local_primitive_id_[index]; }
62
66 int global_primitive_id(const int index) const { return global_primitive_id_[index]; }
67
71 int operator[](const int index) const { return local_primitive_id(index); }
72
75 void remove_from(const LocalBoundary &other);
76
79 void remove_tag_for_index(const int index);
80
85 friend std::ostream &operator<<(std::ostream &os, const LocalBoundary &lb);
86
87 private:
89 std::vector<int> global_primitive_id_;
91 std::vector<int> local_primitive_id_;
92
97 };
98 } // namespace mesh
99} // namespace polyfem
Boundary primitive IDs for a single element.
const BoundaryType type_
Type of boundary primitives for the element.
bool empty() const
Check if the element has any boundary primitives.
void add_boundary_primitive(const int global_index, const int local_index)
Mark a boundary primitive as a part of the global boundary.
const int global_element_id_
Element ID.
int operator[](const int index) const
Get the i-th boundary primitive's local ID.
friend std::ostream & operator<<(std::ostream &os, const LocalBoundary &lb)
Print the LocalBoundary to an output stream.
int element_id() const
Get the element's ID.
int local_primitive_id(const int index) const
Get the i-th boundary primitive's local ID.
void remove_tag_for_index(const int index)
Remove a boundary primitive from the element.
std::vector< int > global_primitive_id_
Global IDs of the boundary primitives.
std::vector< int > local_primitive_id_
Local IDs of the boundary primitives.
int size() const
Number of boundary primitives for the element.
int global_primitive_id(const int index) const
Get the i-th boundary primitive's global ID.
BoundaryType type() const
Get the type of boundary for the element.
void remove_from(const LocalBoundary &other)
Remove all boundary primitives that are also in another LocalBoundary.
@ QUAD_LINE
Boundary of a quad in 2D.
@ TRI_LINE
Boundary of a triangle in 2D.