Wildmeshing Toolkit
Loading...
Searching...
No Matches
Args.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/31/18.
10//
11
12#pragma once
13
14#include <string>
15
16namespace wmtk::components::tetwild::orig {
17
18// Global arguments controlling the behavior of TetWild
19struct Args
20{
21 // Initial target edge-length at every vertex (in % of the bbox diagonal)
22 double initial_edge_len_rel = 1 / 20.0;
23
24 // Initial absolute target edge-length at every vertex. Only used if -a is specified.
25 double initial_edge_len_abs = 0.0;
26
27 // convenience function to get the correct absolute edge length depending
28 // on what was set by the CLI reader
29 double getAbsoluteEdgeLength(const double bbox_diag) const
30 {
31 return initial_edge_len_abs != 0.0 ? initial_edge_len_abs
32 : initial_edge_len_rel * bbox_diag;
33 }
34
35 // convenience function to get the correct relative edge length depending
36 // on what was set by the CLI reader
37 double getRelativeEdgeLength(const double bbox_diag) const
38 {
39 return initial_edge_len_abs != 0.0 ? initial_edge_len_abs / bbox_diag
40 : initial_edge_len_rel;
41 }
42
43 // Target epsilon (in % of the bbox diagonal)
44 double eps_rel = 1e-3;
45
47 // Advanced options //
49
50 // Explicitly specify a sampling distance for triangles (in % of the bbox diagonal)
51 int sampling_dist_rel = -1;
52
53 // Run the algorithm in stage (as explain in p.8 of the paper)
54 // If the first stage didn't succeed, call again with `stage = 2`, etc.
55 int stage = 1;
56
57 // Multiplier for resizing the target-edge length around bad-quality vertices
58 // See MeshRefinement::updateScalarField() for more details
59 double adaptive_scalar = 0.6;
60
61 // Energy threshold
62 // If the max tet energy is below this threshold, the mesh optimization process is stopped.
63 // Also used to determine where to resize the scalar field (if a tet incident to a vertex has
64 // larger energy than this threshold, then resize around this vertex).
65 double filter_energy_thres = 10;
66
67 // Threshold on the energy delta (avg and max) below which to rescale the target edge length
68 // scalar field
69 double delta_energy_thres = 0.1;
70
71 // Maximum number of mesh optimization iterations
72 int max_num_passes = 80;
73
74 double bbox_dis = 0.05; // relative bbox distance to the input
75
76 bool is_quiet = false;
77};
78
79} // namespace wmtk::components::tetwild::orig