Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Implement QIteratedSimplex.
A limited version of QIterated for simplex meshes.
- Loading branch information
Showing
5 changed files
with
351 additions
and
0 deletions.
There are no files selected for viewing
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,3 @@ | ||
New: Added a class QIteratedSimplex for building composite simplex quadrature rules. | ||
<br> | ||
(David Wells, 2021/07/15) |
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,99 @@ | ||
// --------------------------------------------------------------------- | ||
// | ||
// Copyright (C) 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. | ||
// | ||
// --------------------------------------------------------------------- | ||
|
||
#include <deal.II/base/function_lib.h> | ||
#include <deal.II/base/quadrature_lib.h> | ||
|
||
#include "../tests.h" | ||
|
||
// Test QIteratedSimplex accuracy | ||
|
||
template <int dim> | ||
void | ||
print(const Quadrature<dim> &quad) | ||
{ | ||
deallog << "quad size = " << quad.size() << std::endl; | ||
for (unsigned int q = 0; q < quad.size(); ++q) | ||
{ | ||
deallog << quad.point(q) << " "; | ||
deallog << quad.weight(q) << " "; | ||
deallog << std::endl; | ||
} | ||
} | ||
|
||
template <int dim> | ||
void | ||
check_accuracy_1D(const unsigned int n_points_1D, const unsigned int n_copies) | ||
{ | ||
const unsigned int accuracy = 2 * n_points_1D - 1; | ||
|
||
Tensor<1, dim> monomial_powers; | ||
unsigned int sum = 0; | ||
for (unsigned int d = 0; d < dim; ++d) | ||
{ | ||
monomial_powers[d] += accuracy / dim; | ||
sum += accuracy / dim; | ||
} | ||
|
||
// if we aren't at the correct degree then add the rest to the final | ||
// component | ||
monomial_powers[dim - 1] += accuracy - sum; | ||
|
||
const Functions::Monomial<dim> func(monomial_powers); | ||
const QIteratedSimplex<dim> quad(QWitherdenVincentSimplex<dim>(n_points_1D), | ||
n_copies); | ||
|
||
deallog << "Monomial powers = " << monomial_powers << std::endl; | ||
double integrand = 0.0; | ||
for (unsigned int q = 0; q < quad.size(); ++q) | ||
integrand += quad.weight(q) * func.value(quad.point(q)); | ||
auto old_precision = deallog.precision(16); | ||
deallog << "Integrand = " << integrand << std::endl; | ||
deallog.precision(old_precision); | ||
} | ||
|
||
int | ||
main() | ||
{ | ||
initlog(); | ||
|
||
deallog << "2D:" << std::endl; | ||
print(QIteratedSimplex<2>(QWitherdenVincentSimplex<2>(2), 1)); | ||
print(QIteratedSimplex<2>(QWitherdenVincentSimplex<2>(2), 2)); | ||
deallog << std::endl << "3D:" << std::endl; | ||
print(QIteratedSimplex<3>(QWitherdenVincentSimplex<3>(2), 1)); | ||
print(QIteratedSimplex<3>(QWitherdenVincentSimplex<3>(2), 2)); | ||
|
||
deallog << std::endl << std::endl; | ||
check_accuracy_1D<2>(1, 1); | ||
check_accuracy_1D<2>(1, 2); | ||
check_accuracy_1D<2>(1, 4); | ||
check_accuracy_1D<2>(2, 1); | ||
check_accuracy_1D<2>(2, 2); | ||
check_accuracy_1D<2>(2, 4); | ||
check_accuracy_1D<2>(6, 1); | ||
check_accuracy_1D<2>(6, 2); | ||
check_accuracy_1D<2>(6, 4); | ||
|
||
check_accuracy_1D<3>(1, 1); | ||
check_accuracy_1D<3>(1, 2); | ||
check_accuracy_1D<3>(1, 4); | ||
check_accuracy_1D<3>(3, 1); | ||
check_accuracy_1D<3>(3, 2); | ||
check_accuracy_1D<3>(3, 4); | ||
check_accuracy_1D<3>(5, 1); | ||
check_accuracy_1D<3>(5, 2); | ||
check_accuracy_1D<3>(5, 4); | ||
} |
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,148 @@ | ||
|
||
DEAL::2D: | ||
DEAL::quad size = 6 | ||
DEAL::0.0915762 0.0915762 0.0549759 | ||
DEAL::0.0915762 0.816848 0.0549759 | ||
DEAL::0.816848 0.0915762 0.0549759 | ||
DEAL::0.108103 0.445948 0.111691 | ||
DEAL::0.445948 0.108103 0.111691 | ||
DEAL::0.445948 0.445948 0.111691 | ||
DEAL::quad size = 24 | ||
DEAL::0.0457881 0.0457881 0.0137440 | ||
DEAL::0.0457881 0.408424 0.0137440 | ||
DEAL::0.408424 0.0457881 0.0137440 | ||
DEAL::0.0540515 0.222974 0.0279227 | ||
DEAL::0.222974 0.0540515 0.0279227 | ||
DEAL::0.222974 0.222974 0.0279227 | ||
DEAL::0.545788 0.0457881 0.0137440 | ||
DEAL::0.545788 0.408424 0.0137440 | ||
DEAL::0.908424 0.0457881 0.0137440 | ||
DEAL::0.554052 0.222974 0.0279227 | ||
DEAL::0.722974 0.0540515 0.0279227 | ||
DEAL::0.722974 0.222974 0.0279227 | ||
DEAL::0.0457881 0.545788 0.0137440 | ||
DEAL::0.0457881 0.908424 0.0137440 | ||
DEAL::0.408424 0.545788 0.0137440 | ||
DEAL::0.0540515 0.722974 0.0279227 | ||
DEAL::0.222974 0.554052 0.0279227 | ||
DEAL::0.222974 0.722974 0.0279227 | ||
DEAL::0.454212 0.0915762 0.0137440 | ||
DEAL::0.0915762 0.454212 0.0137440 | ||
DEAL::0.454212 0.454212 0.0137440 | ||
DEAL::0.277026 0.277026 0.0279227 | ||
DEAL::0.445948 0.277026 0.0279227 | ||
DEAL::0.277026 0.445948 0.0279227 | ||
DEAL:: | ||
DEAL::3D: | ||
DEAL::quad size = 8 | ||
DEAL::0.0155101 0.328163 0.328163 0.0227030 | ||
DEAL::0.328163 0.0155101 0.328163 0.0227030 | ||
DEAL::0.328163 0.328163 0.0155101 0.0227030 | ||
DEAL::0.328163 0.328163 0.328163 0.0227030 | ||
DEAL::0.108047 0.108047 0.108047 0.0189637 | ||
DEAL::0.108047 0.108047 0.675858 0.0189637 | ||
DEAL::0.108047 0.675858 0.108047 0.0189637 | ||
DEAL::0.675858 0.108047 0.108047 0.0189637 | ||
DEAL::quad size = 64 | ||
DEAL::0.00775505 0.164082 0.164082 0.00283787 | ||
DEAL::0.164082 0.00775505 0.164082 0.00283787 | ||
DEAL::0.164082 0.164082 0.00775505 0.00283787 | ||
DEAL::0.164082 0.164082 0.164082 0.00283787 | ||
DEAL::0.0540236 0.0540236 0.0540236 0.00237046 | ||
DEAL::0.0540236 0.0540236 0.337929 0.00237046 | ||
DEAL::0.0540236 0.337929 0.0540236 0.00237046 | ||
DEAL::0.337929 0.0540236 0.0540236 0.00237046 | ||
DEAL::0.507755 0.164082 0.164082 0.00283787 | ||
DEAL::0.664082 0.00775505 0.164082 0.00283787 | ||
DEAL::0.664082 0.164082 0.00775505 0.00283787 | ||
DEAL::0.664082 0.164082 0.164082 0.00283787 | ||
DEAL::0.554024 0.0540236 0.0540236 0.00237046 | ||
DEAL::0.554024 0.0540236 0.337929 0.00237046 | ||
DEAL::0.554024 0.337929 0.0540236 0.00237046 | ||
DEAL::0.837929 0.0540236 0.0540236 0.00237046 | ||
DEAL::0.00775505 0.664082 0.164082 0.00283787 | ||
DEAL::0.164082 0.507755 0.164082 0.00283787 | ||
DEAL::0.164082 0.664082 0.00775505 0.00283787 | ||
DEAL::0.164082 0.664082 0.164082 0.00283787 | ||
DEAL::0.0540236 0.554024 0.0540236 0.00237046 | ||
DEAL::0.0540236 0.554024 0.337929 0.00237046 | ||
DEAL::0.0540236 0.837929 0.0540236 0.00237046 | ||
DEAL::0.337929 0.554024 0.0540236 0.00237046 | ||
DEAL::0.00775505 0.164082 0.664082 0.00283787 | ||
DEAL::0.164082 0.00775505 0.664082 0.00283787 | ||
DEAL::0.164082 0.164082 0.507755 0.00283787 | ||
DEAL::0.164082 0.164082 0.664082 0.00283787 | ||
DEAL::0.0540236 0.0540236 0.554024 0.00237046 | ||
DEAL::0.0540236 0.0540236 0.837929 0.00237046 | ||
DEAL::0.0540236 0.337929 0.554024 0.00237046 | ||
DEAL::0.337929 0.0540236 0.554024 0.00237046 | ||
DEAL::0.335918 0.171837 0.164082 0.00283787 | ||
DEAL::0.492245 0.171837 0.164082 0.00283787 | ||
DEAL::0.335918 0.328163 0.00775505 0.00283787 | ||
DEAL::0.335918 0.328163 0.164082 0.00283787 | ||
DEAL::0.445976 0.108047 0.0540236 0.00237046 | ||
DEAL::0.445976 0.108047 0.337929 0.00237046 | ||
DEAL::0.162071 0.391953 0.0540236 0.00237046 | ||
DEAL::0.445976 0.391953 0.0540236 0.00237046 | ||
DEAL::0.328163 0.164082 0.171837 0.00283787 | ||
DEAL::0.171837 0.164082 0.171837 0.00283787 | ||
DEAL::0.328163 0.00775505 0.328163 0.00283787 | ||
DEAL::0.171837 0.164082 0.328163 0.00283787 | ||
DEAL::0.391953 0.0540236 0.108047 0.00237046 | ||
DEAL::0.108047 0.337929 0.108047 0.00237046 | ||
DEAL::0.391953 0.0540236 0.391953 0.00237046 | ||
DEAL::0.108047 0.0540236 0.391953 0.00237046 | ||
DEAL::0.164082 0.171837 0.335918 0.00283787 | ||
DEAL::0.164082 0.328163 0.335918 0.00283787 | ||
DEAL::0.00775505 0.328163 0.335918 0.00283787 | ||
DEAL::0.164082 0.171837 0.492245 0.00283787 | ||
DEAL::0.0540236 0.391953 0.162071 0.00237046 | ||
DEAL::0.337929 0.108047 0.445976 0.00237046 | ||
DEAL::0.0540236 0.108047 0.445976 0.00237046 | ||
DEAL::0.0540236 0.391953 0.445976 0.00237046 | ||
DEAL::0.171837 0.492245 0.171837 0.00283787 | ||
DEAL::0.328163 0.335918 0.171837 0.00283787 | ||
DEAL::0.328163 0.335918 0.328163 0.00283787 | ||
DEAL::0.171837 0.335918 0.328163 0.00283787 | ||
DEAL::0.391953 0.445976 0.108047 0.00237046 | ||
DEAL::0.108047 0.445976 0.108047 0.00237046 | ||
DEAL::0.108047 0.445976 0.391953 0.00237046 | ||
DEAL::0.391953 0.162071 0.391953 0.00237046 | ||
DEAL:: | ||
DEAL:: | ||
DEAL::Monomial powers = 0.00000 1.00000 | ||
DEAL::Integrand = 0.1666666666666667 | ||
DEAL::Monomial powers = 0.00000 1.00000 | ||
DEAL::Integrand = 0.1666666666666667 | ||
DEAL::Monomial powers = 0.00000 1.00000 | ||
DEAL::Integrand = 0.1666666666666667 | ||
DEAL::Monomial powers = 1.00000 2.00000 | ||
DEAL::Integrand = 0.01666666666666667 | ||
DEAL::Monomial powers = 1.00000 2.00000 | ||
DEAL::Integrand = 0.01666666666666667 | ||
DEAL::Monomial powers = 1.00000 2.00000 | ||
DEAL::Integrand = 0.01666666666666667 | ||
DEAL::Monomial powers = 5.00000 6.00000 | ||
DEAL::Integrand = 1.387501387501388e-05 | ||
DEAL::Monomial powers = 5.00000 6.00000 | ||
DEAL::Integrand = 1.387501387501388e-05 | ||
DEAL::Monomial powers = 5.00000 6.00000 | ||
DEAL::Integrand = 1.387501387501387e-05 | ||
DEAL::Monomial powers = 0.00000 0.00000 1.00000 | ||
DEAL::Integrand = 0.04166666666666666 | ||
DEAL::Monomial powers = 0.00000 0.00000 1.00000 | ||
DEAL::Integrand = 0.04166666666666666 | ||
DEAL::Monomial powers = 0.00000 0.00000 1.00000 | ||
DEAL::Integrand = 0.04166666666666667 | ||
DEAL::Monomial powers = 1.00000 1.00000 3.00000 | ||
DEAL::Integrand = 0.0001488095238095239 | ||
DEAL::Monomial powers = 1.00000 1.00000 3.00000 | ||
DEAL::Integrand = 0.0001488095238095238 | ||
DEAL::Monomial powers = 1.00000 1.00000 3.00000 | ||
DEAL::Integrand = 0.0001488095238095236 | ||
DEAL::Monomial powers = 3.00000 3.00000 3.00000 | ||
DEAL::Integrand = 4.509379509379515e-07 | ||
DEAL::Monomial powers = 3.00000 3.00000 3.00000 | ||
DEAL::Integrand = 4.509379509379510e-07 | ||
DEAL::Monomial powers = 3.00000 3.00000 3.00000 | ||
DEAL::Integrand = 4.509379509379522e-07 |