14 , m_vf_handle(register_attribute_typed<int64_t>(
"m_vf",
PrimitiveType::
Vertex, 1, false, -1))
15 , m_ef_handle(register_attribute_typed<int64_t>(
"m_ef",
PrimitiveType::
Edge, 1, false, -1))
93 }
while (t != vertex);
112 int64_t lvid_new = -1, leid_new = -1;
114 auto fv =
m_fv_accessor->index_access().const_vector_attribute<3>(gcid_new);
116 auto fe =
m_fe_accessor->index_access().const_vector_attribute<3>(gcid_new);
118 if (gfid == gcid_new) {
122 for (int64_t i = 0; i < 3; ++i) {
123 if (i != oleid && fe(i) == geid) {
133 if (oleid != olvid && leid_new != olvid) {
136 for (int64_t i = 0; i < 3; ++i) {
137 if (i != olvid && fv(i) == gvid) {
143 for (int64_t i = 0; i < 3; ++i) {
152 assert(lvid_new != -1);
153 assert(leid_new != -1);
176 Eigen::Ref<const RowVectors3l> FV,
177 Eigen::Ref<const RowVectors3l> FE,
178 Eigen::Ref<const RowVectors3l> FF,
179 Eigen::Ref<const VectorXl> VF,
180 Eigen::Ref<const VectorXl> EF)
185 std::vector<int64_t> cap{
186 static_cast<int64_t
>(VF.rows()),
187 static_cast<int64_t
>(EF.rows()),
188 static_cast<int64_t
>(FF.rows())};
240 std::iota(S.data(), S.data() + S.size(), int64_t(0));
246 auto fv =
m_fv_accessor->index_access().const_vector_attribute<3>(fid);
247 auto fe =
m_fe_accessor->index_access().const_vector_attribute<3>(fid);
253 for (
int j = 0; j < 3; ++j) {
264 return Tuple(lvid, leid, -1, fid);
280 throw std::runtime_error(
"no tet tuple supported for trimesh");
283 default: assert(
false);
290 auto f =
m_vf_accessor->index_access().const_scalar_attribute(
id);
291 auto fv =
m_fv_accessor->index_access().const_vector_attribute<3>(f);
292 for (int64_t i = 0; i < 3; ++i) {
309 auto f =
m_ef_accessor->index_access().const_scalar_attribute(
id);
310 auto fe =
m_fe_accessor->index_access().const_vector_attribute<3>(f);
311 for (int64_t i = 0; i < 3; ++i) {
343 logger().debug(
"Tuple was null and therefore not valid");
353 "tuple.m_local_vid={} >= 0 && tuple.m_local_eid={} >= 0 &&"
354 " tuple.m_global_cid={} >= 0 &&"
355 " autogen::tri_mesh::tuple_is_valid_for_ccw(tuple)={}",
392 for (int64_t j = 0; j < 3; ++j) {
393 if (fe_val(j) == i) {
399 "EF[{0}] {1} and FE:[EF[{0}]] = {2} are not "
403 fmt::join(fe_val,
","));
420 for (int64_t j = 0; j < 3; ++j) {
427 "VF and FV not compatible, could not find VF[{}] = {} "
446 for (int64_t j = 0; j < 3; ++j) {
447 int neighbor_fid = ff(j);
453 "Even though local edge {} of face {} is "
454 "boundary (global eid is {}), "
465 if (neighbor_fid == i) {
467 "Connectivity check cannot work when mapping a "
468 "face to itself (face {})",
476 if ((neighbor_ff.array() == i).any()) {
480 int edge_shared_count = 0;
481 for (
int local_neighbor_eid = 0; local_neighbor_eid < 3; ++local_neighbor_eid) {
483 if (neighbor_ff(local_neighbor_eid) == i) {
484 if (fe(j) == neighbor_fe(local_neighbor_eid)) {
489 if (edge_shared_count != 1) {
491 "face {} with fe={} neighbor fe[{}] = {} "
492 "was unable to find itself "
493 "uniquely (found {})",
497 fmt::join(neighbor_fe,
","),
503 "face {} with ff={} neighbor ff[{}] = {} was "
504 "unable to find itself",
508 fmt::join(neighbor_ff,
","));
527 std::vector<std::vector<TypedAttributeHandle<int64_t>>> handles(3);
543 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::Accessor< char > 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 int64_t auto_2d_table_complete_vertex[3][2]
const int64_t auto_2d_table_complete_edge[3][2]
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)