MappingQGeneric<dim,spacedim> mapping_q(1);
FEFaceValues<dim,spacedim> fe_values_mapping (mapping_manifold,
- fe, quad,
- update_jacobians);
+ fe, quad,
+ update_jacobians);
FEFaceValues<dim,spacedim> fe_values_q (mapping_q,
- fe, quad,
- update_jacobians);
-
+ fe, quad,
+ update_jacobians);
+
typename Triangulation<dim,spacedim>::active_cell_iterator cell= triangulation.begin_active();
- for(unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f) {
- fe_values_mapping.reinit(cell,f);
- fe_values_q.reinit(cell,f);
- std::vector<DerivativeForm<1,dim,spacedim> > jac_from_mapping_manifold =
- fe_values_mapping.get_jacobians();
-
- std::vector<DerivativeForm<1,dim,spacedim> > 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<jac_from_mapping_q.size(); ++q)
- {
- double dist = 0;
- for (unsigned int d=0; d<spacedim; ++d)
- dist += (jac_from_mapping_manifold[q][d] - jac_from_mapping_q[q][d]).norm();
- if (dist > 1e-10)
- {
- deallog << "Jacobian from mapping manifold at point "<< q << std::endl;
- for (unsigned int d=0; d<spacedim; ++d)
- deallog << jac_from_mapping_manifold[q][d] << std::endl;
-
- deallog << "Jacobian from mapping q at point "<< q << std::endl;
- for (unsigned int d=0; d<spacedim; ++d)
- deallog << jac_from_mapping_q[q][d] << std::endl;
- }
- }
-
- deallog << "OK" << std::endl;
- }
+ for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+ {
+ fe_values_mapping.reinit(cell,f);
+ fe_values_q.reinit(cell,f);
+ std::vector<DerivativeForm<1,dim,spacedim> > jac_from_mapping_manifold =
+ fe_values_mapping.get_jacobians();
+
+ std::vector<DerivativeForm<1,dim,spacedim> > 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<jac_from_mapping_q.size(); ++q)
+ {
+ double dist = 0;
+ for (unsigned int d=0; d<spacedim; ++d)
+ dist += (jac_from_mapping_manifold[q][d] - jac_from_mapping_q[q][d]).norm();
+ if (dist > 1e-10)
+ {
+ deallog << "Jacobian from mapping manifold at point "<< q << std::endl;
+ for (unsigned int d=0; d<spacedim; ++d)
+ deallog << jac_from_mapping_manifold[q][d] << std::endl;
+
+ deallog << "Jacobian from mapping q at point "<< q << std::endl;
+ for (unsigned int d=0; d<spacedim; ++d)
+ deallog << jac_from_mapping_q[q][d] << std::endl;
+ }
+ }
+
+ deallog << "OK" << std::endl;
+ }
}
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2016 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 at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+// Check MappingManifold on faces. Create a sphere and make sure all
+// points returned by FEValues.get_quadrature_points are actually on
+// the circle.
+
+#include "../tests.h"
+
+#include <deal.II/base/utilities.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/fe/mapping_q_generic.h>
+#include <deal.II/fe/mapping_manifold.h>
+#include <deal.II/fe/fe_values.h>
+#include <deal.II/grid/manifold_lib.h>
+
+template<int dim, int spacedim>
+void test()
+{
+ std::ostream &out = deallog.get_file_stream();
+
+ out << "# dim=" << dim << ", spacedim=" << spacedim << std::endl;
+
+ Triangulation<dim, spacedim> triangulation;
+
+ Point<spacedim> center;
+ center[0] = 1.5;
+ center[1] = 2.5;
+
+ double radius = 1.0;
+
+ static const SphericalManifold<dim,spacedim> manifold(center);
+ GridGenerator::hyper_ball (triangulation, center, radius);
+
+ triangulation.set_all_manifold_ids_on_boundary(0);
+ triangulation.set_manifold (0, manifold);
+
+ MappingManifold<dim,spacedim> map_manifold;
+ FE_Q<dim,spacedim> fe(1);
+ const QGauss<dim-1> quad(5);
+
+ FEFaceValues<dim,spacedim> 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<dim,spacedim>::active_cell_iterator cell =
+ triangulation.begin_active(); cell != triangulation.end(); ++cell)
+ for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+ if (cell->face(f)->at_boundary())
+ {
+ fe_v.reinit(cell, f);
+ const std::vector<Point<spacedim> > &qps = fe_v.get_quadrature_points();
+ for (unsigned int i=0; i<qps.size(); ++i)
+ {
+ out << qps[i] << std::endl;
+ if (std::abs(qps[i].distance(center) -radius) > 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;
+}
+
+
+
--- /dev/null
+
+# 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
+