From 462d5fe100123dc567ce52d1fadd3cde4e8b12dc Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Mon, 28 Mar 2016 11:37:12 +0200 Subject: [PATCH] Fixed and cleaned some tests. --- tests/fe/mapping_manifold_01.cc | 8 +- tests/fe/mapping_manifold_02.cc | 4 +- tests/fe/mapping_manifold_04.cc | 4 +- tests/fe/mapping_manifold_05.cc | 71 +++++----- tests/fe/mapping_manifold_06.cc | 94 ++++++++++++++ tests/fe/mapping_manifold_06.output | 193 ++++++++++++++++++++++++++++ 6 files changed, 328 insertions(+), 46 deletions(-) create mode 100644 tests/fe/mapping_manifold_06.cc create mode 100644 tests/fe/mapping_manifold_06.output diff --git a/tests/fe/mapping_manifold_01.cc b/tests/fe/mapping_manifold_01.cc index 9dea26d2b2..430154f53b 100644 --- a/tests/fe/mapping_manifold_01.cc +++ b/tests/fe/mapping_manifold_01.cc @@ -13,7 +13,8 @@ // // --------------------------------------------------------------------- -// Check that MappingManifold and MappingQ1 are the same thing on a FlatManifold +// Check that MappingManifold and MappingQ1 are the same thing on a +// FlatManifold. Test on the quadrature points. #include "../tests.h" @@ -64,10 +65,7 @@ void test() int main() { - std::ofstream logfile ("output"); - deallog.attach(logfile); - deallog.threshold_double(1.e-10); - + initlog(); test<1,1>(); test<2,2>(); diff --git a/tests/fe/mapping_manifold_02.cc b/tests/fe/mapping_manifold_02.cc index 784eba74cf..2e2f474e5c 100644 --- a/tests/fe/mapping_manifold_02.cc +++ b/tests/fe/mapping_manifold_02.cc @@ -87,9 +87,7 @@ void test() int main() { - std::ofstream logfile ("output"); - deallog.attach(logfile); - deallog.threshold_double(1.e-10); + initlog(); test<2,2>(); test<3,3>(); diff --git a/tests/fe/mapping_manifold_04.cc b/tests/fe/mapping_manifold_04.cc index adfd3d9ee9..7c13d7c8af 100644 --- a/tests/fe/mapping_manifold_04.cc +++ b/tests/fe/mapping_manifold_04.cc @@ -98,9 +98,7 @@ void test() int main() { - std::ofstream logfile ("output"); - deallog.attach(logfile); - deallog.threshold_double(1.e-10); + initlog(); test<2,2>(); test<3,3>(); diff --git a/tests/fe/mapping_manifold_05.cc b/tests/fe/mapping_manifold_05.cc index 923e20eb1e..7192055991 100644 --- a/tests/fe/mapping_manifold_05.cc +++ b/tests/fe/mapping_manifold_05.cc @@ -58,44 +58,45 @@ void test() MappingQGeneric mapping_q(1); FEFaceValues fe_values_mapping (mapping_manifold, - fe, quad, - update_jacobians); + fe, quad, + update_jacobians); FEFaceValues fe_values_q (mapping_q, - fe, quad, - update_jacobians); - + fe, quad, + update_jacobians); + typename Triangulation::active_cell_iterator cell= triangulation.begin_active(); - for(unsigned int f=0; f::faces_per_cell; ++f) { - fe_values_mapping.reinit(cell,f); - fe_values_q.reinit(cell,f); - std::vector > jac_from_mapping_manifold = - fe_values_mapping.get_jacobians(); - - std::vector > jac_from_mapping_q = - fe_values_q.get_jacobians(); - - AssertThrow(jac_from_mapping_q.size() == jac_from_mapping_manifold.size(), ExcInternalError()); - - for (unsigned int q=0; q 1e-10) - { - deallog << "Jacobian from mapping manifold at point "<< q << std::endl; - for (unsigned int d=0; d::faces_per_cell; ++f) + { + fe_values_mapping.reinit(cell,f); + fe_values_q.reinit(cell,f); + std::vector > jac_from_mapping_manifold = + fe_values_mapping.get_jacobians(); + + std::vector > jac_from_mapping_q = + fe_values_q.get_jacobians(); + + AssertThrow(jac_from_mapping_q.size() == jac_from_mapping_manifold.size(), ExcInternalError()); + + for (unsigned int q=0; q 1e-10) + { + deallog << "Jacobian from mapping manifold at point "<< q << std::endl; + for (unsigned int d=0; d +#include +#include +#include +#include +#include +#include + +template +void test() +{ + std::ostream &out = deallog.get_file_stream(); + + out << "# dim=" << dim << ", spacedim=" << spacedim << std::endl; + + Triangulation triangulation; + + Point center; + center[0] = 1.5; + center[1] = 2.5; + + double radius = 1.0; + + static const SphericalManifold manifold(center); + GridGenerator::hyper_ball (triangulation, center, radius); + + triangulation.set_all_manifold_ids_on_boundary(0); + triangulation.set_manifold (0, manifold); + + MappingManifold map_manifold; + FE_Q fe(1); + const QGauss quad(5); + + FEFaceValues fe_v(map_manifold, fe, quad, + update_quadrature_points); + + out << "set size ratio -1" << std::endl + << "set terminal aqua " << dim+spacedim << std::endl + << (spacedim == 3 ? "s" : "") << "plot '-' w l " << std::endl; + + for (typename Triangulation::active_cell_iterator cell = + triangulation.begin_active(); cell != triangulation.end(); ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->face(f)->at_boundary()) + { + fe_v.reinit(cell, f); + const std::vector > &qps = fe_v.get_quadrature_points(); + for (unsigned int i=0; i 1e-10) + out << "# Error! This should be on the sphere, but it's not!" << std::endl; + } + out << std::endl; + } + out << "e" << std::endl << std::endl; +} + + +int +main() +{ + initlog(); + + test<2,2>(); + + test<3,3>(); + + return 0; +} + + + diff --git a/tests/fe/mapping_manifold_06.output b/tests/fe/mapping_manifold_06.output new file mode 100644 index 0000000000..97d058a327 --- /dev/null +++ b/tests/fe/mapping_manifold_06.output @@ -0,0 +1,193 @@ + +# dim=2, spacedim=2 +set size ratio -1 +set terminal aqua 4 +plot '-' w l +0.846869 1.74276 +1.08958 1.58810 +1.50000 1.50000 +1.91042 1.58810 +2.15313 1.74276 + +0.742755 1.84687 +0.588103 2.08958 +0.500000 2.50000 +0.588103 2.91042 +0.742755 3.15313 + +2.25724 1.84687 +2.41190 2.08958 +2.50000 2.50000 +2.41190 2.91042 +2.25724 3.15313 + +0.846869 3.25724 +1.08958 3.41190 +1.50000 3.50000 +1.91042 3.41190 +2.15313 3.25724 + +e + +# dim=3, spacedim=3 +set size ratio -1 +set terminal aqua 6 +splot '-' w l +0.942530 1.94253 -0.615187 +1.12940 1.87632 -0.688247 +1.50000 1.82851 -0.741013 +1.87060 1.87632 -0.688247 +2.05747 1.94253 -0.615187 +0.876324 2.12940 -0.688247 +1.07160 2.07160 -0.795583 +1.50000 2.02589 -0.880468 +1.92840 2.07160 -0.795583 +2.12368 2.12940 -0.688247 +0.828509 2.50000 -0.741013 +1.02589 2.50000 -0.880468 +1.50000 2.50000 -1.00000 +1.97411 2.50000 -0.880468 +2.17149 2.50000 -0.741013 +0.876324 2.87060 -0.688247 +1.07160 2.92840 -0.795583 +1.50000 2.97411 -0.880468 +1.92840 2.92840 -0.795583 +2.12368 2.87060 -0.688247 +0.942530 3.05747 -0.615187 +1.12940 3.12368 -0.688247 +1.50000 3.17149 -0.741013 +1.87060 3.12368 -0.688247 +2.05747 3.05747 -0.615187 + +2.11519 1.94253 -0.557470 +2.18825 1.87632 -0.370600 +2.24101 1.82851 -8.90587e-18 +2.18825 1.87632 0.370600 +2.11519 1.94253 0.557470 +2.18825 2.12940 -0.623676 +2.29558 2.07160 -0.428397 +2.38047 2.02589 -2.11638e-17 +2.29558 2.07160 0.428397 +2.18825 2.12940 0.623676 +2.24101 2.50000 -0.671491 +2.38047 2.50000 -0.474105 +2.50000 2.50000 0.00000 +2.38047 2.50000 0.474105 +2.24101 2.50000 0.671491 +2.18825 2.87060 -0.623676 +2.29558 2.92840 -0.428397 +2.38047 2.97411 0.00000 +2.29558 2.92840 0.428397 +2.18825 2.87060 0.623676 +2.11519 3.05747 -0.557470 +2.18825 3.12368 -0.370600 +2.24101 3.17149 0.00000 +2.18825 3.12368 0.370600 +2.11519 3.05747 0.557470 + +0.942530 1.94253 0.615187 +0.876324 2.12940 0.688247 +0.828509 2.50000 0.741013 +0.876324 2.87060 0.688247 +0.942530 3.05747 0.615187 +1.12940 1.87632 0.688247 +1.07160 2.07160 0.795583 +1.02589 2.50000 0.880468 +1.07160 2.92840 0.795583 +1.12940 3.12368 0.688247 +1.50000 1.82851 0.741013 +1.50000 2.02589 0.880468 +1.50000 2.50000 1.00000 +1.50000 2.97411 0.880468 +1.50000 3.17149 0.741013 +1.87060 1.87632 0.688247 +1.92840 2.07160 0.795583 +1.97411 2.50000 0.880468 +1.92840 2.92840 0.795583 +1.87060 3.12368 0.688247 +2.05747 1.94253 0.615187 +2.12368 2.12940 0.688247 +2.17149 2.50000 0.741013 +2.12368 2.87060 0.688247 +2.05747 3.05747 0.615187 + +0.884813 1.94253 -0.557470 +0.811753 2.12940 -0.623676 +0.758987 2.50000 -0.671491 +0.811753 2.87060 -0.623676 +0.884813 3.05747 -0.557470 +0.811753 1.87632 -0.370600 +0.704417 2.07160 -0.428397 +0.619532 2.50000 -0.474105 +0.704417 2.92840 -0.428397 +0.811753 3.12368 -0.370600 +0.758987 1.82851 -8.90587e-18 +0.619532 2.02589 -2.11638e-17 +0.500000 2.50000 0.00000 +0.619532 2.97411 0.00000 +0.758987 3.17149 0.00000 +0.811753 1.87632 0.370600 +0.704417 2.07160 0.428397 +0.619532 2.50000 0.474105 +0.704417 2.92840 0.428397 +0.811753 3.12368 0.370600 +0.884813 1.94253 0.557470 +0.811753 2.12940 0.623676 +0.758987 2.50000 0.671491 +0.811753 2.87060 0.623676 +0.884813 3.05747 0.557470 + +0.942530 1.88481 -0.557470 +0.876324 1.81175 -0.370600 +0.828509 1.75899 -8.90587e-18 +0.876324 1.81175 0.370600 +0.942530 1.88481 0.557470 +1.12940 1.81175 -0.623676 +1.07160 1.70442 -0.428397 +1.02589 1.61953 -2.11638e-17 +1.07160 1.70442 0.428397 +1.12940 1.81175 0.623676 +1.50000 1.75899 -0.671491 +1.50000 1.61953 -0.474105 +1.50000 1.50000 0.00000 +1.50000 1.61953 0.474105 +1.50000 1.75899 0.671491 +1.87060 1.81175 -0.623676 +1.92840 1.70442 -0.428397 +1.97411 1.61953 0.00000 +1.92840 1.70442 0.428397 +1.87060 1.81175 0.623676 +2.05747 1.88481 -0.557470 +2.12368 1.81175 -0.370600 +2.17149 1.75899 0.00000 +2.12368 1.81175 0.370600 +2.05747 1.88481 0.557470 + +0.942530 3.11519 -0.557470 +1.12940 3.18825 -0.623676 +1.50000 3.24101 -0.671491 +1.87060 3.18825 -0.623676 +2.05747 3.11519 -0.557470 +0.876324 3.18825 -0.370600 +1.07160 3.29558 -0.428397 +1.50000 3.38047 -0.474105 +1.92840 3.29558 -0.428397 +2.12368 3.18825 -0.370600 +0.828509 3.24101 -8.90587e-18 +1.02589 3.38047 -2.11638e-17 +1.50000 3.50000 0.00000 +1.97411 3.38047 0.00000 +2.17149 3.24101 0.00000 +0.876324 3.18825 0.370600 +1.07160 3.29558 0.428397 +1.50000 3.38047 0.474105 +1.92840 3.29558 0.428397 +2.12368 3.18825 0.370600 +0.942530 3.11519 0.557470 +1.12940 3.18825 0.623676 +1.50000 3.24101 0.671491 +1.87060 3.18825 0.623676 +2.05747 3.11519 0.557470 + +e + -- 2.39.5