16 using namespace autogen;
21 , m_vt_handle(register_attribute_typed<int64_t>(
"m_vt",
PrimitiveType::
Vertex, 1, false, -1))
22 , m_et_handle(register_attribute_typed<int64_t>(
"m_et",
PrimitiveType::
Edge, 1, false, -1))
80 Eigen::Ref<const RowVectors4l> TV,
81 Eigen::Ref<const RowVectors6l> TE,
82 Eigen::Ref<const RowVectors4l> TF,
83 Eigen::Ref<const RowVectors4l> TT,
84 Eigen::Ref<const VectorXl> VT,
85 Eigen::Ref<const VectorXl> ET,
86 Eigen::Ref<const VectorXl> FT)
91 std::vector<int64_t> cap{
92 static_cast<int64_t
>(VT.rows()),
93 static_cast<int64_t
>(ET.rows()),
94 static_cast<int64_t
>(FT.rows()),
95 static_cast<int64_t
>(TT.rows())};
99 auto vt_accessor = create_accessor<int64_t>(
m_vt_handle);
100 auto et_accessor = create_accessor<int64_t>(
m_et_handle);
101 auto ft_accessor = create_accessor<int64_t>(
m_ft_handle);
102 auto tv_accessor = create_accessor<int64_t>(
m_tv_handle);
103 auto te_accessor = create_accessor<int64_t>(
m_te_handle);
104 auto tf_accessor = create_accessor<int64_t>(
m_tf_handle);
105 auto tt_accessor = create_accessor<int64_t>(
m_tt_handle);
114 tv_accessor.index_access().vector_attribute<4>(i) = TV.row(i).transpose();
115 te_accessor.index_access().vector_attribute<6>(i) = TE.row(i).transpose();
116 tf_accessor.index_access().vector_attribute<4>(i) = TF.row(i).transpose();
117 tt_accessor.index_access().vector_attribute<4>(i) = TT.row(i).transpose();
123 vt_accessor.index_access().scalar_attribute(i) = VT(i);
128 et_accessor.index_access().scalar_attribute(i) = ET(i);
133 ft_accessor.index_access().scalar_attribute(i) = FT(i);
151 std::iota(S.data(), S.data() + S.size(), int64_t(0));
157 int64_t t =
m_vt_accessor->index_access().const_scalar_attribute(
id);
158 auto tv =
m_tv_accessor->index_access().const_vector_attribute<4>(t);
161 for (int64_t i = 0; i < 4; ++i) {
175 int64_t t =
m_et_accessor->index_access().const_scalar_attribute(
id);
176 auto te =
m_te_accessor->index_access().const_vector_attribute<6>(t);
180 for (int64_t i = 0; i < 6; ++i) {
193 int64_t t =
m_ft_accessor->index_access().const_scalar_attribute(
id);
194 auto tf =
m_tf_accessor->index_access().const_vector_attribute<4>(t);
198 for (int64_t i = 0; i < 4; ++i) {
214 const int64_t lvid = 0;
216 assert(lvid == nlvid);
243 default: assert(
false);
267 assert(gcid_new != -1);
274 int64_t lvid_new = -1, leid_new = -1, lfid_new = -1;
276 auto tv =
m_tv_accessor->index_access().const_vector_attribute<4>(gcid_new);
278 auto te =
m_te_accessor->index_access().const_vector_attribute<6>(gcid_new);
280 auto tf =
m_tf_accessor->index_access().const_vector_attribute<4>(gcid_new);
282 for (int64_t i = 0; i < 4; ++i) {
291 for (int64_t i = 0; i < 6; ++i) {
299 assert(lvid_new != -1);
300 assert(leid_new != -1);
301 assert(lfid_new != -1);
303 const Tuple res(lvid_new, leid_new, lfid_new, gcid_new);
332 "tuple.m_local_vid={} >= 0 && tuple.m_local_eid={} >= 0 &&"
333 "tuple.m_local_fid={} >= 0 &&"
334 " tuple.m_global_cid={} >= 0 &&"
335 " autogen::tet_mesh::tuple_is_valid_for_ccw(tuple)={}",
427 bool bad_face =
false;
428 for (int64_t j = 0; j < 6; ++j) {
432 "Tet {} refers to edge {} at local index {} which was deleted",
440 for (int64_t j = 0; j < 4; ++j) {
445 "Tet {} refers to vertex{} at local index {} which was deleted",
453 .error(
"Tet {} refers to face{} at local index {} which was deleted", i, fi, j);
467 for (
int j = 0; j < 4; ++j) {
485 for (
int j = 0; j < 6; ++j) {
503 for (
int j = 0; j < 4; ++j) {
521 for (
int j = 0; j < 4; ++j) {
534 for (
int k = 0; k < 4; ++k) {
541 wmtk::logger().error(
"Tet {} was adjacent to tet {} {} <= 1 times", nb, i, cnt);
548 "TF[{},{}] = {} != {} = TF[{},{}] even though TT[{},{}] == {}",
569 std::vector<std::vector<TypedAttributeHandle<int64_t>>> handles(4);
585 auto tv =
m_tv_accessor->index_access().const_vector_attribute<4>(tid);
586 auto te =
m_te_accessor->index_access().const_vector_attribute<6>(tid);
587 auto tf =
m_tf_accessor->index_access().const_vector_attribute<4>(tid);
589 int64_t lvid = -1, leid = -1, lfid = -1;
591 for (
int j = 0; j < 4; ++j) {
600 for (
int j = 0; j < 6; ++j) {
611 return Tuple(lvid, leid, lfid, tid);
617 return {
Tuple(0, 0, 2, cid),
Tuple(1, 0, 3, cid),
Tuple(2, 1, 1, cid),
Tuple(3, 2, 2, cid)};
A Curiously Recurring Template Pattern shim to enable generic specialization of functions.
int64_t id(const Tuple &tuple, PrimitiveType type) const
return the global id of the Tuple of the given dimension
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
Mesh & operator=(const Mesh &other)=delete
const attribute::FlagAccessor< Mesh > get_flag_accessor(PrimitiveType type) const
TypedAttributeHandle< int64_t > m_tt_handle
std::unique_ptr< attribute::Accessor< int64_t, TetMesh > > m_tv_accessor
TetMesh & operator=(const TetMesh &o)=delete
TypedAttributeHandle< int64_t > m_vt_handle
Tuple tuple_from_id(const PrimitiveType type, const int64_t gid) const final override
internal function that returns the tuple of requested type, and has the global index cid
bool is_boundary_vertex(const Tuple &tuple) const
std::unique_ptr< attribute::Accessor< int64_t, TetMesh > > m_et_accessor
void make_cached_accessors()
std::vector< std::vector< TypedAttributeHandle< int64_t > > > connectivity_attributes() const final override
Returns a vector of vectors of attribute handles.
std::unique_ptr< attribute::Accessor< int64_t, TetMesh > > m_tt_accessor
Tuple switch_tuple(const Tuple &tuple, PrimitiveType type) const final override
switch the orientation of the Tuple of the given dimension
Tuple tuple_from_global_ids(int64_t tid, int64_t fid, int64_t eid, int64_t vid) const
bool is_boundary(const simplex::Simplex &tuple) const
check if a simplex lies on a boundary or not
TypedAttributeHandle< int64_t > m_tv_handle
bool is_boundary_edge(const Tuple &tuple) const
Tuple edge_tuple_from_id(int64_t id) const
Tuple face_tuple_from_id(int64_t id) const
void initialize_free(int64_t count)
Tuple tet_tuple_from_id(int64_t id) const
std::unique_ptr< attribute::Accessor< int64_t, TetMesh > > m_tf_accessor
TypedAttributeHandle< int64_t > m_tf_handle
bool is_ccw(const Tuple &tuple) const final override
TODO this needs dimension?
Tuple vertex_tuple_from_id(int64_t id) const
void initialize(Eigen::Ref< const RowVectors4l > TV, Eigen::Ref< const RowVectors6l > TE, Eigen::Ref< const RowVectors4l > TF, Eigen::Ref< const RowVectors4l > TT, Eigen::Ref< const VectorXl > VT, Eigen::Ref< const VectorXl > ET, Eigen::Ref< const VectorXl > FT)
TypedAttributeHandle< int64_t > m_te_handle
bool is_connectivity_valid() const final override
TypedAttributeHandle< int64_t > m_et_handle
std::unique_ptr< attribute::Accessor< int64_t, TetMesh > > m_ft_accessor
TypedAttributeHandle< int64_t > m_ft_handle
std::unique_ptr< attribute::Accessor< int64_t, TetMesh > > m_vt_accessor
std::unique_ptr< attribute::Accessor< int64_t, TetMesh > > m_te_accessor
bool is_valid(const Tuple &tuple) const final override
check validity of tuple including its hash
bool is_boundary_face(const Tuple &tuple) const
std::vector< Tuple > orient_vertices(const Tuple &t) const override
CachingBaseType & index_access()
ConstMapResult< D > const_vector_attribute(const ArgType &t) const
T const_scalar_attribute(const int64_t index) const
ConstMapResult< D > const_vector_attribute(const int64_t index) const
const IndexBaseType & index_access() const
bool is_active(int64_t t) const
const std::vector< Simplex > & simplex_vector() const
Return const reference to the simplex vector.
static Simplex edge(const Mesh &m, const Tuple &t)
static Simplex vertex(const Mesh &m, const Tuple &t)
bool tuple_is_valid_for_ccw(const Tuple &t)
Tuple local_switch_tuple(const Tuple &t, PrimitiveType pt)
bool is_ccw(const Tuple &t)
Tuple get_tuple_from_simplex_local_edge_id(int8_t local_id, int64_t global_id)
Tuple get_tuple_from_simplex_local_face_id(int8_t local_id, int64_t global_id)
const int64_t auto_3d_table_complete_vertex[4][3]
Tuple get_tuple_from_simplex_local_vertex_id(int8_t local_id, int64_t global_id)
SimplexCollection open_star(const Mesh &mesh, const Simplex &simplex, const bool sort_and_clean)
CofacesSingleDimensionIterable cofaces_single_dimension_iterable(const Mesh &mesh, const Simplex &simplex, const PrimitiveType cofaces_type)
RowVectors< int64_t, 4 > RowVectors4l
spdlog::logger & logger()
Retrieves the current logger.
std::tuple< RowVectors6l, RowVectors4l, RowVectors4l, VectorXl, VectorXl, VectorXl > tetmesh_topology_initialization(Eigen::Ref< const RowVectors4l > T)
Given the mesh connectivity in matrix format, finds unique edges and faces and their relations.