Wildmeshing Toolkit
Loading...
Searching...
No Matches
EdgeRemover.h
1// This file is part of TetWild, a software for generating tetrahedral meshes.
2//
3// Copyright (C) 2018 Yixin Hu <yixin.hu@nyu.edu>
4//
5// This Source Code Form is subject to the terms of the Mozilla Public License
6// v. 2.0. If a copy of the MPL was not distributed with this file, You can
7// obtain one at http://mozilla.org/MPL/2.0/.
8//
9// Created by Yixin Hu on 4/17/17.
10//
11
12#ifndef NEW_GTET_EDGEREMOVER_H
13#define NEW_GTET_EDGEREMOVER_H
14
15#include <queue>
16#include "LocalOperations.h"
17
18namespace wmtk::components::tetwild::orig {
19
21{
22public:
23 std::array<int, 2> v_ids;
24 double weight;
25
27 ElementInQueue_er(const std::array<int, 2>& ids, double w)
28 : v_ids(ids)
29 , weight(w)
30 {}
31};
32
33struct cmp_er
34{
36 {
37 if (e1.weight == e2.weight) return e1.v_ids < e2.v_ids;
38 return e1.weight < e2.weight;
39 }
40};
41
43{
44public:
45 std::priority_queue<ElementInQueue_er, std::vector<ElementInQueue_er>, cmp_er> er_queue;
46
47 double ideal_weight;
48
49 int v_empty_start = 0;
50 int t_empty_start = 0;
51
52 int flag_cnt = 0;
53
54 int num_32_cases = 0;
55 int num_44_cases = 0;
56 int num_56_cases = 0;
57 int num_6_cases = 0;
58
59 int equal_buget = 100;
60
61 EdgeRemover(LocalOperations lo, double i_weight)
62 : LocalOperations(lo)
63 , ideal_weight(i_weight)
64 {}
65
66 void init();
67 void swap();
68 bool removeAnEdge_32(int v1_id, int v2_id, const std::vector<int>& old_t_ids);
69 bool removeAnEdge_44(int v1_id, int v2_id, const std::vector<int>& old_t_ids);
70 bool removeAnEdge_56(int v1_id, int v2_id, const std::vector<int>& old_t_ids);
71
72 bool isSwappable_cd1(
73 const std::array<int, 2>& v_ids,
74 std::vector<int>& t_ids,
75 bool is_check_conn_tet_num = false);
76 bool isSwappable_cd1(const std::array<int, 2>& v_ids);
77
78 bool isEdgeValid(const std::array<int, 2>& v_ids);
79 void getNewTetSlots(int n, std::vector<int>& new_conn_tets);
80
81 void addNewEdge(const std::array<int, 2>& e);
82
83 igl::Timer tmp_timer;
84 double energy_time = 0;
85};
86
87} // namespace wmtk::components::tetwild::orig
88
89#endif // NEW_GTET_EDGEREMOVER_H
Definition EdgeRemover.h:34
bool operator()(const ElementInQueue_er &e1, const ElementInQueue_er &e2)
Definition EdgeRemover.h:35