Debian Codegraph @

include/deal.II/cgal/additional_data.h

raw
1 // ------------------------------------------------------------------------
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 // Copyright (C) 2022 - 2023 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // Part of the source code is dual licensed under Apache-2.0 WITH
9 // LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10 // governing the source code and code contributions can be found in
11 // LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12 //
13 // ------------------------------------------------------------------------
14
15 #ifndef dealii_cgal_additional_data_h
16 #define dealii_cgal_additional_data_h
17
18 #include <deal.II/base/config.h>
19
20 #include <deal.II/base/exceptions.h>
21
22 #ifdef DEAL_II_WITH_CGAL
23
24 # include <CGAL/version.h>
25 # if CGAL_VERSION_MAJOR >= 6
26 # include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
27 # endif
28 # include <CGAL/Mesh_facet_topology.h>
29
30 # include <limits>
31
32 DEAL_II_NAMESPACE_OPEN
33 namespace CGALWrappers
34 {
35 enum class FacetTopology
36 {
37 /**
38 * Each vertex of the facet have to be on the surface, on a curve, or on a
39 * corner.
40 */
41 facet_vertices_on_surface = CGAL::FACET_VERTICES_ON_SURFACE,
42
43 /**
44 * The three vertices of a facet belonging to a surface patch s have to be
45 * on the same surface patch s, on a curve or on a corner.
46 */
47 facet_vertices_on_same_surface_patch =
48 CGAL::FACET_VERTICES_ON_SAME_SURFACE_PATCH,
49
50 /**
51 * The three vertices of a facet belonging to a surface patch s have to be
52 * on the same surface patch s, or on a curve incident to the surface patch
53 * s or on a corner incident to the surface patch s.
54 */
55 facet_vertices_on_same_surface_patch_with_adjacency_check =
56 CGAL::FACET_VERTICES_ON_SAME_SURFACE_PATCH_WITH_ADJACENCY_CHECK,
57 };
58
59 /**
60 * Struct that must be used to pass additional
61 * arguments to the CGAL::Mesh_criteria_3 class (see
62 * https://doc.cgal.org/latest/Mesh_3/index.html for more information.)
63 *
64 * The arguments allow for fine control on the size, quality, and distribution
65 * of the cells of the final triangulation. CGAL uses Boost named parameters
66 * for these arguments in dimension three, i.e., they must be specified with
67 * the syntax `CGAL::parameters::parameter_name=parameter_value`, irrespective
68 * of their order. Accepted parameters are:
69 *
70 * - `CGAL::parameters::edge_size`: a constant
71 * providing a uniform upper bound for the lengths of
72 * curve edges. This parameter has to be set to a positive value when
73 * 1-dimensional features protection is used.
74 * - `CGAL::parameters::facet_angle`: a lower bound for the angles (in
75 * degrees) of the surface mesh facets.
76 * - `CGAL::parameters::facet_size`: a constant
77 * describing a uniform upper bound for the radii
78 * of the surface Delaunay balls.
79 * - `CGAL::parameters::facet_distance`: a constant
80 * describing a uniform upper bound for the distance
81 * between the facet circumcenter and the center of its surface Delaunay ball.
82 * - `CGAL::parameters::facet_topology`: the set of topological constraints
83 * which have to be verified by each surface facet. The default value is
84 * `CGAL::FACET_VERTICES_ON_SURFACE`. See the enum @p FacetToplogy CGAL::Mesh_facet_topology manual
85 * page to get all possible values.
86 * - `CGAL::parameters::cell_radius_edge_ratio`: an upper bound for the
87 * radius-edge ratio of the mesh tetrahedra.
88 * - `CGAL::parameters::cell_size`: a constant
89 * describing a uniform upper bound for the
90 * circumradii of the mesh tetrahedra.
91 *
92 * @note This struct must be instantiated with `dim=3`.
93 */
94 template <int dim>
95 struct AdditionalData
96 {
97 /**
98 * Uniform upper bound for the lengths of curve edges.
99 * This parameter has to be set to a positive value when1-dimensional
100 * features protection is used.
101 */
102 double edge_size;
103
104 /**
105 * Lower bound for the angles (in degrees) of the surface mesh facets.
106 */
107 double facet_angle;
108
109 /**
110 * Uniform upper bound for the radii of the surface Delaunay balls.
111 */
112 double facet_size;
113 /**
114 * Uniform upper bound for the distance between the facet circumcenter and
115 * the center of its surface Delaunay ball.
116 */
117 double facet_distance;
118
119 /**
120 * Set of topological constraints which have to be verified by each surface
121 * facet.
122 */
123 FacetTopology facet_topology;
124
125 /**
126 * upper bound for the radius-edge ratio of the mesh tetrahedra.
127 */
128 double cell_radius_edge_ratio;
129 /**
130 * Uniform upper bound for the circumradii of the mesh tetrahedra.
131 */
132 double cell_size;
133
134 /**
135 * Constructor.
136 */
137 AdditionalData(
138 double edge_s = std::numeric_limits<double>::max(),
139 double facet_a = 0.,
140 double facet_s = 0.,
141 double facet_d = 0.,
142 FacetTopology facet_t =
143 dealii::CGALWrappers::FacetTopology::facet_vertices_on_surface,
144 double cell_radius_edge_r = 0.,
145 double cell_s = 0.)
146 {
147 AssertThrow(
148 dim == 3,
149 ExcMessage(
150 "These struct can be instantiated with 3d Triangulations only."));
151 edge_size = edge_s;
152 facet_angle = facet_a;
153 facet_size = facet_s;
154 facet_distance = facet_d;
155 facet_topology = facet_t;
156 cell_radius_edge_ratio = cell_radius_edge_r;
157 cell_size = cell_s;
158 }
159 };
160
161 /**
162 * Specialization of the above struct when the object to be constructed is a
163 * 2d triangulation embedded in the 3d space, i.e. a Triangulation<2,3>.
164 * Only three parameters are accepted:
165 * - `angular_bound` is a lower bound in degrees for the angles of mesh
166 * facets.
167 * - `radius_bound` is an upper bound on the radii of surface Delaunay balls.
168 * A surface Delaunay ball is a ball circumscribing a mesh facet and centered
169 * on the surface.
170 * - `distance_bound` is an upper bound for the distance between the
171 * circumcenter of a mesh facet and the center of a surface Delaunay ball of
172 * this facet.
173 */
174 template <>
175 struct AdditionalData<2>
176 {
177 /**
178 * Lower bound in degrees for the angles of mesh facets.
179 */
180 double angular_bound;
181
182 /**
183 * Upper bound on the radii of surface Delaunay balls. A surface Delaunay
184 * ball is a ball circumscribing a mesh facet and centered on the surface.
185 */
186 double radius_bound;
187
188 /**
189 * Upper bound for the distance between the circumcenter of a mesh facet
190 * and the center of a surface Delaunay ball of this facet.
191 */
192 double distance_bound;
193
194 /**
195 * Constructor.
196 */
197 AdditionalData(double angular_b = 0.,
198 double radius_b = 0.,
199 double distance_b = 0.)
200 {
201 angular_bound = angular_b;
202 radius_bound = radius_b;
203 distance_bound = distance_b;
204 }
205 };
206
207 } // namespace CGALWrappers
208 DEAL_II_NAMESPACE_CLOSE
209
210 #else
211
212 DEAL_II_NAMESPACE_OPEN
213 namespace CGALWrappers
214 {
215 /**
216 * Empty structure for the case where CGAL is not available.
217 */
218 template <int dim>
219 struct AdditionalData
220 {};
221 } // namespace CGALWrappers
222
223 DEAL_II_NAMESPACE_CLOSE
224 #endif
225
226 #endif