deal.II version GIT relicensing-1939-gfdca551f47 2024-10-07 12:00:00+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
function_signed_distance.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2021 - 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_function_signed_distance_h
16#define dealii_function_signed_distance_h
17
18#include <deal.II/base/config.h>
19
22
23#include <array>
24
26
27namespace Functions
28{
29 namespace SignedDistance
30 {
47 template <int dim>
48 class Sphere : public Function<dim>
49 {
50 public:
54 Sphere(const Point<dim> &center = Point<dim>(), const double radius = 1);
55
56 double
57 value(const Point<dim> &point,
58 const unsigned int component = 0) const override;
59
70 gradient(const Point<dim> &point,
71 const unsigned int component = 0) const override;
72
83 hessian(const Point<dim> &point,
84 const unsigned int component = 0) const override;
85
86 private:
88 const double radius;
89 };
90
91
103 template <int dim>
104 class Plane : public Function<dim>
105 {
106 public:
110 Plane(const Point<dim> &point, const Tensor<1, dim> &normal);
111
112 double
113 value(const Point<dim> &point,
114 const unsigned int component = 0) const override;
115
117 gradient(const Point<dim> &,
118 const unsigned int component = 0) const override;
119
121 hessian(const Point<dim> &,
122 const unsigned int component = 0) const override;
123
124 private:
127 };
128
129
143 template <int dim>
144 class Ellipsoid : public Function<dim>
145 {
146 public:
156 const std::array<double, dim> &radii,
157 const double tolerance = 1e-14,
158 const unsigned int max_iter = 10);
159
160 double
161 value(const Point<dim> &point,
162 const unsigned int component = 0) const override;
163
169 gradient(const Point<dim> &,
170 const unsigned int component = 0) const override;
171
172 private:
180 double
181 evaluate_ellipsoid(const Point<dim> &point) const;
182
187 compute_closest_point_ellipse(const Point<dim> &point) const;
188
203
207 double
209
211 const std::array<double, dim> radii;
212 const double tolerance;
213 const unsigned int max_iter;
214 };
215
216
230 template <int dim>
231 class Rectangle : public Function<dim>
232 {
233 public:
241 Rectangle(const Point<dim> &bottom_left, const Point<dim> &top_right);
248
255 double
256 value(const Point<dim> &p,
257 const unsigned int component = 0) const override;
258
259 private:
261 };
262
263
280 template <int dim>
281 class ZalesakDisk : public Function<dim>
282 {
283 public:
294 const double radius,
295 const double notch_width,
296 const double notch_height);
297
304 double
305 value(const Point<dim> &p,
306 const unsigned int component = 0) const override;
307
308 private:
313
318 };
319 } // namespace SignedDistance
320} // namespace Functions
321
323
324#endif
double value(const Point< dim > &point, const unsigned int component=0) const override
Tensor< 1, dim > gradient(const Point< dim > &, const unsigned int component=0) const override
double compute_signed_distance_ellipse(const Point< dim > &point) const
Point< dim > compute_closest_point_ellipse(const Point< dim > &point) const
double evaluate_ellipsoid(const Point< dim > &point) const
Tensor< 1, dim, double > compute_analyical_normal_vector_on_ellipse(const Point< dim > &point) const
double value(const Point< dim > &point, const unsigned int component=0) const override
SymmetricTensor< 2, dim > hessian(const Point< dim > &, const unsigned int component=0) const override
Tensor< 1, dim > gradient(const Point< dim > &, const unsigned int component=0) const override
double value(const Point< dim > &p, const unsigned int component=0) const override
SymmetricTensor< 2, dim > hessian(const Point< dim > &point, const unsigned int component=0) const override
double value(const Point< dim > &point, const unsigned int component=0) const override
Tensor< 1, dim > gradient(const Point< dim > &point, const unsigned int component=0) const override
const Functions::SignedDistance::Sphere< dim > sphere
double value(const Point< dim > &p, const unsigned int component=0) const override
const Functions::SignedDistance::Rectangle< dim > notch
Definition point.h:111
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499
Point< 3 > center