Wildmeshing Toolkit
Loading...
Searching...
No Matches
LocalOperations.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 5/6/17.
10//
11
12#ifndef NEW_GTET_LOCALOPERATIONS_H
13#define NEW_GTET_LOCALOPERATIONS_H
14
15#include <igl/Timer.h>
16#include <igl/grad.h>
17#include <wmtk/Types.hpp>
18#include <wmtk/envelope/Envelope.hpp>
19#include "ForwardDecls.h"
20#include "TetmeshElements.h"
21
22namespace wmtk::components::tetwild::orig {
23
24enum class EnvelopSide { OUTSIDE = 0, INSIDE = 1, UNCERTAIN = 2 };
25
27{
28public:
29 const Args& args;
30 State& state;
31
32 std::vector<TetVertex>& tet_vertices;
33 std::vector<std::array<int, 4>>& tets;
34 std::vector<std::array<int, 4>>& is_surface_fs;
35 std::vector<bool>& v_is_removed;
36 std::vector<bool>& t_is_removed;
37 std::vector<TetQuality>& tet_qualities;
38
39 const SampleEnvelope& geo_sf_tree;
40 const SampleEnvelope& geo_b_tree;
41
42 int counter = 0;
43 int suc_counter = 0;
44
46 std::vector<TetVertex>& t_vs,
47 std::vector<std::array<int, 4>>& ts,
48 std::vector<std::array<int, 4>>& is_sf_fs,
49 std::vector<bool>& v_is_rm,
50 std::vector<bool>& t_is_rm,
51 std::vector<TetQuality>& tet_qs,
52 const SampleEnvelope& geo_tree,
53 const SampleEnvelope& b_t,
54 const Args& ar,
55 State& st)
56 : tet_vertices(t_vs)
57 , tets(ts)
58 , is_surface_fs(is_sf_fs)
59 , v_is_removed(v_is_rm)
60 , t_is_removed(t_is_rm)
61 , tet_qualities(tet_qs)
62 , geo_sf_tree(geo_tree)
63 , geo_b_tree(b_t)
64 , args(ar)
65 , state(st)
66 {}
67
68 void outputInfo(int op_type, double time, bool is_log = true);
69
70 void calTetQualities(
71 const std::vector<std::array<int, 4>>& new_tets,
72 std::vector<TetQuality>& tet_qs);
73
74 double calEdgeLength(int v1_id, int v2_id);
75 void calTetQuality_AMIPS(const std::array<int, 4>& tet, TetQuality& t_quality);
76
77 bool isFlip(const std::vector<std::array<int, 4>>& new_tets);
78 bool isTetFlip(const std::array<int, 4>& t);
79 bool isTetFlip(int t_id);
80
81 void getAvgMaxEnergy(double& avg_tq, double& max_tq);
82 double getMaxEnergy();
83
84 void getCheckQuality(const std::vector<TetQuality>& tet_qs, TetQuality& tq);
85 void getCheckQuality(const std::vector<int>& t_ids, TetQuality& tq);
86
87 bool isEdgeOnSurface(int v1_id, int v2_id);
88 bool isEdgeOnBbox(int v1_id, int v2_id);
89 bool isEdgeOnSurface(int v1_id, int v2_id, const std::vector<int>& t_ids);
90 bool isEdgeOnBbox(int v1_id, int v2_id, const std::vector<int>& t_ids);
91 bool isEdgeOnBoundary(int v1_id, int v2_id);
92
93 bool isFaceOutEnvelop(const std::array<Vector3d, 3>& tri);
94 bool isPointOutEnvelop(const Vector3d& p);
95 bool isPointOutBoundaryEnvelop(const Vector3d& p);
96
97 void getFaceConnTets(int v1_id, int v2_id, int v3_id, std::vector<int>& t_ids);
98 bool isIsolated(int v_id);
99 bool isBoundaryPoint(int v_id);
100
101 igl::Timer igl_timer0;
102 int id_sampling = 0;
103 int id_aabb = 1;
104
105 int mid_id = 0;
106
107 bool isLocked_ui(const std::array<int, 2>& e);
108 bool isTetLocked_ui(int tid);
109};
110
111} // namespace wmtk::components::tetwild::orig
112
113#endif // NEW_GTET_LOCALOPERATIONS_H
Definition Envelope.hpp:56
bool isFlip(const std::vector< std::array< int, 4 > > &new_tets)
Definition LocalOperations.cpp:117
bool isBoundaryPoint(int v_id)
Definition LocalOperations.cpp:363
bool isIsolated(int v_id)
Definition LocalOperations.cpp:348
bool isTetFlip(const std::array< int, 4 > &t)
Definition LocalOperations.cpp:71
bool isEdgeOnBoundary(int v1_id, int v2_id)
Definition LocalOperations.cpp:275
Definition TetmeshElements.h:61