Skip to content

Commit

Permalink
adding missing structs for edge op data
Browse files Browse the repository at this point in the history
  • Loading branch information
mtao committed Oct 7, 2023
1 parent 15ba6a2 commit 3f240eb
Show file tree
Hide file tree
Showing 2 changed files with 207 additions and 0 deletions.
134 changes: 134 additions & 0 deletions src/wmtk/operations/tet_mesh/EdgeOperationData.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
#pragma once
#include <array>
#include <vector>
#include <wmtk/Tuple.hpp>

namespace wmtk::operations::tet_mesh {
struct EdgeOperationData
{

//
// E --------------- C --------------- F
// \-_ / | \ _-/
// \ EarTet / | \ EarTet /
// \ tid1 / | \ tid2 /
// \ -_/fid1|fid2\_- /
// \ / --_ | _-- \ /
// \ / __- D -__ \ /
// \ /_-- --_\ /
// A ================= B
// operating edge
//

/**
* An EarTet is a neighbor of a tet to be deleted in the split/collapse operation
*
*/
struct EarTet
{
long tid = -1; // global tid of the ear, -1 if it doesn't exist
long fid = -1; // global fid of the ear, -1 if it doesn't exist
};

/**
* Data on the incident tets of the operating edge
*/
struct IncidentTetData
{
long tid = -1;
std::array<EarTet, 2> ears;
};

/**
* @brief structs for split (to be merge with collapse)
*
*/

struct FaceSplitData
{
long fid_old = -1;
long fid_new_1 = -1;
long fid_new_2 = -1;
long eid_spine_old = -1;
long eid_spine_1 = -1;
long eid_spine_2 = -1;
long eid_split = -1;
};

/*
v3
/\\
ear1 / \ \ ear2
/ \ \
/ \ \
/ \ \
/ \ \
/ \ _\ v4
/______________\_ -
v1 e12 v2
*/

struct TetSplitData
{
long tid_old = -1;
long tid_new_1 = -1;
long tid_new_2 = -1;
long fid_split = -1;
long v1;
long v2;
long v3;
long v4;
long e12;
long e13;
long e14;
long e23;
long e24;
long e34;

EarTet ear_tet_1; // switch edge switch face
EarTet ear_tet_2; // switch vertex switch edge switch face
std::array<FaceSplitData, 2> new_face_data;
};

struct TetCollapseData
{
long tid_old = -1;
long v1;
long v2;
long v3;
long v4;
long e12;
long e13;
long e14;
long e23;
long e24;
long e34;

EarTet ear_tet_1; // switch edge switch face
EarTet ear_tet_2; // switch vertex switch edge switch face
};

const std::array<long, 2>& incident_vids() const { return m_spine_vids; }

long operating_edge_id() const { return m_operating_edge_id; }



std::array<std::vector<long>, 4> simplex_ids_to_delete;
std::vector<long> cell_ids_to_update_hash;

Tuple m_operating_tuple;

Tuple m_output_tuple;

protected:
// common simplices
std::array<long, 2> m_spine_vids; // two endpoints of the edge
long m_operating_edge_id;
long m_operating_face_id;
long m_operating_tet_id;

// simplices required per-tet
std::vector<IncidentTetData> m_incident_tet_datas;
};
}
73 changes: 73 additions & 0 deletions src/wmtk/operations/tri_mesh/EdgeOperationData.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#pragma once
#include <array>
#include <vector>
#include <wmtk/Tuple.hpp>

namespace wmtk::operations::tri_mesh {
struct EdgeOperationData
{
EdgeOperationData() = default;
EdgeOperationData(const EdgeOperationData&) = default;
EdgeOperationData(EdgeOperationData&&) = default;

EdgeOperationData& operator=(const EdgeOperationData&) = default;
EdgeOperationData& operator=(EdgeOperationData&&) = default;
// C
// / \ .
// F1 / \ F2
// / \ .
// / \ .
// A----------B
// \ /
// \ /
// F1' \ / F2'
// \ /
// C'
// the neighbors are stored in the order of A, B, C, D if they exist
// vid, ear fid (-1 if it doesn't exit), ear eid

/**
* An ear is a face that is adjacent to a face that is incident to the edge on which the
* operation is performed. In other words, the ears are the neighboring faces to the ones
* that will be deleted by the operation.
*/
struct EarFace
{
long fid = -1; // global fid of the ear, -1 if it doesn't exist
long eid = -1; // global eid of the ear, -1 if it doesn't exist
};

/**
* Data on the incident face relevant for performing operations.
*/
struct IncidentFaceData
{
long opposite_vid = -1; // opposing vid
long fid = -1; // the face that will be deleted
std::array<long, 2> split_f = std::array<long, 2>{{-1, -1}};
Tuple local_operating_tuple; // the copy of edge m_operating_tuple in face(fid)
std::array<EarFace, 2> ears; // ear
};

std::vector<IncidentFaceData>& incident_face_datas() { return m_incident_face_datas; }

const std::array<long, 2>& incident_vids() const { return m_spine_vids; }

long operating_edge_id() const { return m_operating_edge_id; }


std::array<std::vector<long>, 3> simplex_ids_to_delete;
std::vector<long> cell_ids_to_update_hash;

Tuple m_operating_tuple;

Tuple m_output_tuple; // reference tuple for either operation

// common simplicies
std::array<long, 2> m_spine_vids; // V_A_id, V_B_id;
long m_operating_edge_id;

// simplices required per-face
std::vector<IncidentFaceData> m_incident_face_datas;
};
} // namespace wmtk::operations::tri_mesh

0 comments on commit 3f240eb

Please sign in to comment.