-
Notifications
You must be signed in to change notification settings - Fork 708
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add signed distance function for Zalesak's disk
- Loading branch information
Showing
8 changed files
with
333 additions
and
0 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
New: Added Functions::SignedDistance::ZalesakDisk() | ||
to compute the signed distance function of Zalesak's disk. | ||
<br> | ||
(Magdalena Schreter, Simon Sticko, Peter Munch, 2023/04/06) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
// --------------------------------------------------------------------- | ||
// | ||
// Copyright (C) 2007 - 2021 by the deal.II authors | ||
// | ||
// This file is part of the deal.II library. | ||
// | ||
// The deal.II library is free software; you can use it, redistribute | ||
// it, and/or modify it under the terms of the GNU Lesser General | ||
// Public License as published by the Free Software Foundation; either | ||
// version 2.1 of the License, or (at your option) any later version. | ||
// The full text of the license can be found in the file LICENSE.md at | ||
// the top level directory of deal.II. | ||
// | ||
// --------------------------------------------------------------------- | ||
|
||
/** | ||
* Test the classes Functions::SignedDistance::ZalesakDisk by creating an | ||
* object of each class and calling the value functions at a point where we know | ||
* what the function values should be. | ||
*/ | ||
|
||
#include <deal.II/base/function_level_set.h> | ||
|
||
#include "../tests.h" | ||
|
||
|
||
namespace | ||
{ | ||
template <int dim> | ||
void | ||
print_values_at_point(const Function<dim> &function, const Point<dim> &point) | ||
{ | ||
deallog << "point = " << point << std::endl; | ||
deallog << "value = " << function.value(point) << std::endl; | ||
} | ||
|
||
|
||
|
||
template <int dim> | ||
void | ||
test_disk_level_set() | ||
{ | ||
deallog << "test_zalesak_disk_level_set" << std::endl; | ||
|
||
const Point<dim> center; | ||
const double radius = 1; | ||
|
||
const Functions::SignedDistance::ZalesakDisk<dim> level_set(center, | ||
radius, | ||
radius * 0.5, | ||
0.75 * radius); | ||
|
||
{ | ||
Point<dim> p; | ||
|
||
deallog << "center" << std::endl; | ||
print_values_at_point(level_set, p); | ||
deallog << "inside" << std::endl; | ||
p[0] += 0.1; | ||
print_values_at_point(level_set, p); | ||
p[0] = 0.3; | ||
print_values_at_point(level_set, p); | ||
} | ||
deallog << "notch" << std::endl; | ||
Point<dim> p; | ||
p[dim - 1] = -0.45; | ||
p[std::max(0, dim - 2)] = -0.1; | ||
print_values_at_point(level_set, p); | ||
deallog << "outside" << std::endl; | ||
p[dim - 1] = -2; | ||
print_values_at_point(level_set, p); | ||
p[dim - 1] = -1.2; | ||
p[0] = -0.3; | ||
p[std::max(0, dim - 2)] = -0.3; | ||
print_values_at_point(level_set, p); | ||
p[dim - 1] = -2; | ||
p[0] = 0; | ||
p[std::max(0, dim - 2)] = 0; | ||
print_values_at_point(level_set, p); | ||
p[dim - 1] = 2; | ||
print_values_at_point(level_set, p); | ||
p[0] = -2; | ||
print_values_at_point(level_set, p); | ||
p[0] = 2; | ||
print_values_at_point(level_set, p); | ||
} | ||
|
||
template <int dim> | ||
void | ||
run_test() | ||
{ | ||
deallog << "dim = " << dim << std::endl; | ||
deallog << std::endl; | ||
test_disk_level_set<dim>(); | ||
deallog << std::endl; | ||
} | ||
} // namespace | ||
|
||
|
||
|
||
int | ||
main() | ||
{ | ||
initlog(); | ||
run_test<1>(); | ||
run_test<2>(); | ||
run_test<3>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
|
||
DEAL::dim = 1 | ||
DEAL:: | ||
DEAL::test_zalesak_disk_level_set | ||
DEAL::center | ||
DEAL::point = 0.00000 | ||
DEAL::value = 0.250000 | ||
DEAL::inside | ||
DEAL::point = 0.100000 | ||
DEAL::value = 0.150000 | ||
DEAL::point = 0.300000 | ||
DEAL::value = -0.0500000 | ||
DEAL::notch | ||
DEAL::point = -0.100000 | ||
DEAL::value = 0.150000 | ||
DEAL::outside | ||
DEAL::point = -2.00000 | ||
DEAL::value = 1.00000 | ||
DEAL::point = -0.300000 | ||
DEAL::value = -0.0500000 | ||
DEAL::point = 0.00000 | ||
DEAL::value = 0.250000 | ||
DEAL::point = 2.00000 | ||
DEAL::value = 1.00000 | ||
DEAL::point = -2.00000 | ||
DEAL::value = 1.00000 | ||
DEAL::point = 2.00000 | ||
DEAL::value = 1.00000 | ||
DEAL:: | ||
DEAL::dim = 2 | ||
DEAL:: | ||
DEAL::test_zalesak_disk_level_set | ||
DEAL::center | ||
DEAL::point = 0.00000 0.00000 | ||
DEAL::value = -0.250000 | ||
DEAL::inside | ||
DEAL::point = 0.100000 0.00000 | ||
DEAL::value = -0.250000 | ||
DEAL::point = 0.300000 0.00000 | ||
DEAL::value = -0.254951 | ||
DEAL::notch | ||
DEAL::point = -0.100000 -0.450000 | ||
DEAL::value = 0.150000 | ||
DEAL::outside | ||
DEAL::point = -0.100000 -2.00000 | ||
DEAL::value = 1.00250 | ||
DEAL::point = -0.300000 -1.20000 | ||
DEAL::value = 0.236932 | ||
DEAL::point = 0.00000 -2.00000 | ||
DEAL::value = 1.00000 | ||
DEAL::point = 0.00000 2.00000 | ||
DEAL::value = 1.00000 | ||
DEAL::point = -2.00000 2.00000 | ||
DEAL::value = 1.82843 | ||
DEAL::point = 2.00000 2.00000 | ||
DEAL::value = 1.82843 | ||
DEAL:: | ||
DEAL::dim = 3 | ||
DEAL:: | ||
DEAL::test_zalesak_disk_level_set | ||
DEAL::center | ||
DEAL::point = 0.00000 0.00000 0.00000 | ||
DEAL::value = -0.250000 | ||
DEAL::inside | ||
DEAL::point = 0.100000 0.00000 0.00000 | ||
DEAL::value = -0.250000 | ||
DEAL::point = 0.300000 0.00000 0.00000 | ||
DEAL::value = -0.254951 | ||
DEAL::notch | ||
DEAL::point = 0.00000 -0.100000 -0.450000 | ||
DEAL::value = 0.200000 | ||
DEAL::outside | ||
DEAL::point = 0.00000 -0.100000 -2.00000 | ||
DEAL::value = 1.00250 | ||
DEAL::point = -0.300000 -0.300000 -1.20000 | ||
DEAL::value = 0.272792 | ||
DEAL::point = 0.00000 0.00000 -2.00000 | ||
DEAL::value = 1.00000 | ||
DEAL::point = 0.00000 0.00000 2.00000 | ||
DEAL::value = 1.00000 | ||
DEAL::point = -2.00000 0.00000 2.00000 | ||
DEAL::value = 1.82843 | ||
DEAL::point = 2.00000 0.00000 2.00000 | ||
DEAL::value = 1.82843 | ||
DEAL:: |