15 using namespace autogen;
20 , m_vt_handle(register_attribute_typed<int64_t>(
"m_vt",
PrimitiveType::
Vertex, 1, false, -1))
21 , m_et_handle(register_attribute_typed<int64_t>(
"m_et",
PrimitiveType::
Edge, 1, false, -1))
79 Eigen::Ref<const RowVectors4l> TV,
80 Eigen::Ref<const RowVectors6l> TE,
81 Eigen::Ref<const RowVectors4l> TF,
82 Eigen::Ref<const RowVectors4l> TT,
83 Eigen::Ref<const VectorXl> VT,
84 Eigen::Ref<const VectorXl> ET,
85 Eigen::Ref<const VectorXl> FT)
90 std::vector<int64_t> cap{
91 static_cast<int64_t
>(VT.rows()),
92 static_cast<int64_t
>(ET.rows()),
93 static_cast<int64_t
>(FT.rows()),
94 static_cast<int64_t
>(TT.rows())};
98 auto vt_accessor = create_accessor<int64_t>(
m_vt_handle);
99 auto et_accessor = create_accessor<int64_t>(
m_et_handle);
100 auto ft_accessor = create_accessor<int64_t>(
m_ft_handle);
101 auto tv_accessor = create_accessor<int64_t>(
m_tv_handle);
102 auto te_accessor = create_accessor<int64_t>(
m_te_handle);
103 auto tf_accessor = create_accessor<int64_t>(
m_tf_handle);
104 auto tt_accessor = create_accessor<int64_t>(
m_tt_handle);
112 tv_accessor.index_access().vector_attribute<4>(i) = TV.row(i).transpose();
113 te_accessor.index_access().vector_attribute<6>(i) = TE.row(i).transpose();
114 tf_accessor.index_access().vector_attribute<4>(i) = TF.row(i).transpose();
115 tt_accessor.index_access().vector_attribute<4>(i) = TT.row(i).transpose();
120 vt_accessor.index_access().scalar_attribute(i) = VT(i);
125 et_accessor.index_access().scalar_attribute(i) = ET(i);
130 ft_accessor.index_access().scalar_attribute(i) = FT(i);
148 std::iota(S.data(), S.data() + S.size(), int64_t(0));
154 int64_t t =
m_vt_accessor->index_access().const_scalar_attribute(
id);
155 auto tv =
m_tv_accessor->index_access().const_vector_attribute<4>(t);
158 for (int64_t i = 0; i < 4; ++i) {
166 assert(lvid == nlvid);
168 if (lvid < 0 || leid < 0 || lfid < 0)
throw std::runtime_error(
"vertex_tuple_from_id failed");
178 int64_t t =
m_et_accessor->index_access().const_scalar_attribute(
id);
179 auto te =
m_te_accessor->index_access().const_vector_attribute<6>(t);
183 for (int64_t i = 0; i < 6; ++i) {
190 assert(leid == nleid);
193 if (lvid < 0 || leid < 0 || lfid < 0)
throw std::runtime_error(
"edge_tuple_from_id failed");
203 int64_t t =
m_ft_accessor->index_access().const_scalar_attribute(
id);
204 auto tf =
m_tf_accessor->index_access().const_vector_attribute<4>(t);
208 for (int64_t i = 0; i < 4; ++i) {
216 assert(lfid == nlfid);
218 if (lvid < 0 || leid < 0 || lfid < 0)
throw std::runtime_error(
"face_tuple_from_id failed");
228 const int64_t lvid = 0;
230 assert(lvid == nlvid);
257 default: assert(
false);
281 assert(gcid_new != -1);
288 int64_t lvid_new = -1, leid_new = -1, lfid_new = -1;
290 auto tv =
m_tv_accessor->index_access().const_vector_attribute<4>(gcid_new);
292 auto te =
m_te_accessor->index_access().const_vector_attribute<6>(gcid_new);
294 auto tf =
m_tf_accessor->index_access().const_vector_attribute<4>(gcid_new);
296 for (int64_t i = 0; i < 4; ++i) {
305 for (int64_t i = 0; i < 6; ++i) {
313 assert(lvid_new != -1);
314 assert(leid_new != -1);
315 assert(lfid_new != -1);
317 const Tuple res(lvid_new, leid_new, lfid_new, gcid_new);
346 "tuple.m_local_vid={} >= 0 && tuple.m_local_eid={} >= 0 &&"
347 "tuple.m_local_fid={} >= 0 &&"
348 " tuple.m_global_cid={} >= 0 &&"
349 " autogen::tet_mesh::tuple_is_valid_for_ccw(tuple)={}",
436 for (
int j = 0; j < 4; ++j) {
455 for (
int j = 0; j < 6; ++j) {
474 for (
int j = 0; j < 4; ++j) {
493 for (
int j = 0; j < 4; ++j) {
506 for (
int k = 0; k < 4; ++k) {
530 std::vector<std::vector<TypedAttributeHandle<int64_t>>> handles(4);
546 auto tv =
m_tv_accessor->index_access().const_vector_attribute<4>(tid);
547 auto te =
m_te_accessor->index_access().const_vector_attribute<6>(tid);
548 auto tf =
m_tf_accessor->index_access().const_vector_attribute<4>(tid);
550 int64_t lvid = -1, leid = -1, lfid = -1;
552 for (
int j = 0; j < 4; ++j) {
561 for (
int j = 0; j < 6; ++j) {
572 return Tuple(lvid, leid, lfid, tid);
578 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::Accessor< char > 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
A CachingAccessor that uses tuples for accessing attributes instead of indices.
CachingBaseType & index_access()
ConstMapResult< D > const_vector_attribute(const ArgType &t) const
T const_scalar_attribute(const int64_t index) const
T & scalar_attribute(const int64_t index)
ConstMapResult< D > const_vector_attribute(const int64_t index) 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)
const int64_t auto_3d_table_complete_vertex[4][3]
const int64_t auto_3d_table_complete_face[4][3]
const int64_t auto_3d_table_complete_edge[6][3]
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.