15 , m_vf_handle(register_attribute_typed<int64_t>(
"m_vf",
PrimitiveType::
Vertex, 1, false, -1))
16 , m_ef_handle(register_attribute_typed<int64_t>(
"m_ef",
PrimitiveType::
Edge, 1, false, -1))
94 }
while (t != vertex);
113 int64_t lvid_new = -1, leid_new = -1;
115 auto fv =
m_fv_accessor->index_access().const_vector_attribute<3>(gcid_new);
117 auto fe =
m_fe_accessor->index_access().const_vector_attribute<3>(gcid_new);
119 if (gfid == gcid_new) {
123 for (int64_t i = 0; i < 3; ++i) {
124 if (i != oleid && fe(i) == geid) {
134 if (oleid != olvid && leid_new != olvid) {
137 for (int64_t i = 0; i < 3; ++i) {
138 if (i != olvid && fv(i) == gvid) {
144 for (int64_t i = 0; i < 3; ++i) {
153 assert(lvid_new != -1);
154 assert(leid_new != -1);
177 Eigen::Ref<const RowVectors3l> FV,
178 Eigen::Ref<const RowVectors3l> FE,
179 Eigen::Ref<const RowVectors3l> FF,
180 Eigen::Ref<const VectorXl> VF,
181 Eigen::Ref<const VectorXl> EF)
186 std::vector<int64_t> cap{
187 static_cast<int64_t
>(VF.rows()),
188 static_cast<int64_t
>(EF.rows()),
189 static_cast<int64_t
>(FF.rows())};
241 std::iota(S.data(), S.data() + S.size(), int64_t(0));
247 auto fv =
m_fv_accessor->index_access().const_vector_attribute<3>(fid);
248 auto fe =
m_fe_accessor->index_access().const_vector_attribute<3>(fid);
254 for (
int j = 0; j < 3; ++j) {
265 return Tuple(lvid, leid, -1, fid);
281 throw std::runtime_error(
"no tet tuple supported for trimesh");
284 default: assert(
false);
291 auto f =
m_vf_accessor->index_access().const_scalar_attribute(
id);
292 auto fv =
m_fv_accessor->index_access().const_vector_attribute<3>(f);
293 for (int64_t i = 0; i < 3; ++i) {
305 auto f =
m_ef_accessor->index_access().const_scalar_attribute(
id);
306 auto fe =
m_fe_accessor->index_access().const_vector_attribute<3>(f);
307 for (int64_t i = 0; i < 3; ++i) {
332 logger().trace(
"Tuple was null and therefore not valid");
342 "tuple.m_local_vid={} >= 0 && tuple.m_local_eid={} >= 0 &&"
343 " tuple.m_global_cid={} >= 0 &&"
344 " autogen::tri_mesh::tuple_is_valid_for_ccw(tuple)={}",
381 bool bad_face =
false;
383 for (int64_t j = 0; j < 3; ++j) {
388 "Face {} refers to edge {} at local index {} which was deleted",
396 "Face {} refers to vertex{} at local index {} which was deleted",
416 for (int64_t j = 0; j < 3; ++j) {
417 if (fe_val(j) == i) {
423 "EF[{0}] {1} and FE:[EF[{0}]] = {2} are not "
427 fmt::join(fe_val,
","));
443 for (int64_t j = 0; j < 3; ++j) {
450 "VF and FV not compatible, could not find VF[{}] = {} "
468 for (int64_t j = 0; j < 3; ++j) {
469 int neighbor_fid = ff(j);
475 "Even though local edge {} of face {} is "
476 "boundary (global eid is {}), "
487 if (neighbor_fid == i) {
489 "Connectivity check cannot work when mapping a "
490 "face to itself (face {})",
498 if ((neighbor_ff.array() == i).any()) {
502 int edge_shared_count = 0;
503 for (
int local_neighbor_eid = 0; local_neighbor_eid < 3; ++local_neighbor_eid) {
505 if (neighbor_ff(local_neighbor_eid) == i) {
506 if (fe(j) == neighbor_fe(local_neighbor_eid)) {
511 if (edge_shared_count != 1) {
513 "face {} with fe={} neighbor fe[{}] = {} "
514 "was unable to find itself "
515 "uniquely (found {})",
519 fmt::join(neighbor_fe,
","),
525 "face {} with ff={} neighbor ff[{}] = {} was "
526 "unable to find itself",
530 fmt::join(neighbor_ff,
","));
549 std::vector<std::vector<TypedAttributeHandle<int64_t>>> handles(3);
565 return {
Tuple(0, 2, -1, cid),
Tuple(1, 0, -1, cid),
Tuple(2, 1, -1, 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
std::vector< std::vector< TypedAttributeHandle< int64_t > > > connectivity_attributes() const override
Returns a vector of vectors of attribute handles.
Tuple switch_face(const Tuple &tuple) const
Tuple face_tuple_from_id(int64_t id) const
Tuple switch_tuple(const Tuple &tuple, PrimitiveType type) const final override
switch the orientation of the Tuple of the given dimension
bool is_boundary_vertex(const Tuple &tuple) const
attribute::TypedAttributeHandle< int64_t > m_vf_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
TriMesh & operator=(const TriMesh &o)=delete
std::unique_ptr< attribute::Accessor< int64_t, TriMesh > > m_ef_accessor
bool is_boundary(const simplex::Simplex &tuple) const
check if a simplex lies on a boundary or not
bool is_valid(const Tuple &tuple) const final override
check validity of tuple including its hash
Tuple vertex_tuple_from_id(int64_t id) const
bool is_connectivity_valid() const final override
Tuple tuple_from_global_ids(int64_t fid, int64_t eid, int64_t vid) const
void make_cached_accessors()
std::unique_ptr< attribute::Accessor< int64_t, TriMesh > > m_fe_accessor
std::unique_ptr< attribute::Accessor< int64_t, TriMesh > > m_fv_accessor
void initialize_free(int64_t count)
Tuple switch_edge(const Tuple &tuple) const
static Tuple with_different_cid(const Tuple &t, int64_t cid)
void initialize(Eigen::Ref< const RowVectors3l > FV, Eigen::Ref< const RowVectors3l > FE, Eigen::Ref< const RowVectors3l > FF, Eigen::Ref< const VectorXl > VF, Eigen::Ref< const VectorXl > EF)
attribute::TypedAttributeHandle< int64_t > m_ff_handle
attribute::TypedAttributeHandle< int64_t > m_ef_handle
std::unique_ptr< attribute::Accessor< int64_t, TriMesh > > m_ff_accessor
bool is_boundary_edge(const Tuple &tuple) const
bool is_ccw(const Tuple &tuple) const final override
TODO this needs dimension?
attribute::TypedAttributeHandle< int64_t > m_fv_handle
Tuple edge_tuple_from_id(int64_t id) const
std::vector< Tuple > orient_vertices(const Tuple &t) const override
std::unique_ptr< attribute::Accessor< int64_t, TriMesh > > m_vf_accessor
attribute::TypedAttributeHandle< int64_t > m_fe_handle
CachingBaseType & index_access()
T const_scalar_attribute(const int64_t index) const
MapResult< D > vector_attribute(const int64_t index)
T & scalar_attribute(const int64_t index)
ConstMapResult< D > const_vector_attribute(const int64_t index) const
const IndexBaseType & index_access() const
bool is_active(int64_t t) const
const int64_t auto_2d_table_complete_vertex[3][2]
Tuple get_tuple_from_simplex_local_vertex_id(int8_t local_id, int64_t global_id)
Tuple get_tuple_from_simplex_local_edge_id(int8_t local_id, int64_t global_id)
bool tuple_is_valid_for_ccw(const Tuple &t)
Tuple local_switch_tuple(const Tuple &t, PrimitiveType pt)
bool is_ccw(const Tuple &t)
RowVectors< int64_t, 3 > RowVectors3l
spdlog::logger & logger()
Retrieves the current logger.
std::tuple< RowVectors3l, RowVectors3l, VectorXl, VectorXl > trimesh_topology_initialization(Eigen::Ref< const RowVectors3l > F)