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 PYRAMID,
18 TRI,
19 QUAD,
20 POLYGON,
23 };
24
27 {
28 public:
32 LocalBoundary(const int global_element_id, BoundaryType type);
33
36 LocalBoundary(const LocalBoundary &other);
37
41 void add_boundary_primitive(const int global_index, const int local_index);
42
45 int size() const { return local_primitive_id_.size(); }
46
49 bool empty() const { return size() <= 0; }
50
53 int element_id() const { return global_element_id_; }
54
57 BoundaryType type() const { return type_; }
58
62 int local_primitive_id(const int index) const { return local_primitive_id_[index]; }
63
67 int global_primitive_id(const int index) const { return global_primitive_id_[index]; }
68
72 int operator[](const int index) const { return local_primitive_id(index); }
73
76 void remove_from(const LocalBoundary &other);
77
80 void remove_tag_for_index(const int index);
81
86 friend std::ostream &operator<<(std::ostream &os, const LocalBoundary &lb);
87
88 private:
90 std::vector<int> global_primitive_id_;
92 std::vector<int> local_primitive_id_;
93
98 };
99 } // namespace mesh
100} // 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.