//
// ---------------------------------------------------------------------
-
+// Check that MappingManifold and MappingQ1 are the same thing on a FlatManifold
#include "../tests.h"
#include <deal.II/fe/mapping_manifold.h>
#include <deal.II/grid/manifold_lib.h>
-#include <fstream>
-
template<int dim, int spacedim>
void test()
{
Triangulation<dim, spacedim> triangulation;
- const Point<2> center (7,9);
- const Point<2> origin (0,0);
- const double inner_radius = 0.5,
- outer_radius = 1.0;
- GridGenerator::hyper_shell (triangulation,
- center, inner_radius, outer_radius,
- 10);
-
-
- static const SphericalManifold<dim> manifold(center);
+ GridGenerator::hyper_cube (triangulation, 2.0, 3.0);
- triangulation.set_all_manifold_ids_on_boundary(0);
- triangulation.set_manifold (0, manifold);
- typename Triangulation<dim,spacedim>::active_cell_iterator
- cell = triangulation.begin_active(),
- endc = triangulation.end();
- for (; cell!=endc; ++cell)
- cell->set_all_manifold_ids (0);
- triangulation.refine_global (0);
- const QIterated<QTrapez<spacedim> > quadrature(7);
-
- std::vector<Point<spacedim> > q_points = quadrature.get_points();
+ const QGauss<dim> quadrature(5);
+ std::vector<Point<dim> > q_points = quadrature.get_points();
MappingManifold<dim,spacedim> map_manifold;
MappingQGeneric<dim,spacedim> map_q1(1);
-
- cell = triangulation.begin_active();
-
- std::ofstream two_be_plotted ("points.txt");
+ typename Triangulation<dim,spacedim>::active_cell_iterator
+ cell = triangulation.begin_active(),
+ endc = triangulation.end();
for (; cell!=endc; ++cell)
{
for (unsigned int i=0; i<q_points.size(); ++i)
{
- // const Point<spacedim> p = map.transform_unit_to_real_cell(cell,q_points[i]);
- // deallog << "mapping manifold ---> " << p.distance() << std::endl;
-
const Point<spacedim> pq = map_manifold.transform_unit_to_real_cell(cell,q_points[i]);
- deallog << "mapping q1 ---> " << pq.distance(origin) << std::endl;
- for (unsigned int d=0; d<spacedim; ++d)
- two_be_plotted << pq[d] << " ";
- two_be_plotted << std::endl;
+ const Point<spacedim> pq1 = map_q1.transform_unit_to_real_cell(cell, q_points[i]);
+ if (pq.distance(pq1) > 1e-10)
+ {
+ deallog << "Expected: " << pq << ", got: "
+ << pq1 << std::endl;
+ }
}
}
+ deallog << "OK" << std::endl;
}
deallog.threshold_double(1.e-10);
- // test<1,1>();
+ test<1,1>();
test<2,2>();
- // test<3,3>();
+ test<3,3>();
- // test<1,2>();
- // test<1,3>();
- // test<2,3>();
+ test<1,2>();
+ test<1,3>();
+ test<2,3>();
return 0;
}
#include <deal.II/fe/fe_q.h>
#include <deal.II/fe/fe_values.h>
-#include <fstream>
-
template<int dim, int spacedim>
void test()
{
Triangulation<dim, spacedim> triangulation;
- const Point<2> center (7,9);
- const Point<2> origin (0,0);
+ Point<spacedim> center;
+ for (unsigned int i=0; i<spacedim; ++i)
+ center[i] = 5+i;
+
const double inner_radius = 0.5,
outer_radius = 1.0;
GridGenerator::hyper_shell (triangulation,
- center, inner_radius, outer_radius,
- 10);
+ center, inner_radius, outer_radius);
static const SphericalManifold<dim> manifold(center);
- triangulation.set_all_manifold_ids_on_boundary(0);
+ triangulation.set_all_manifold_ids(0);
triangulation.set_manifold (0, manifold);
- typename Triangulation<dim,spacedim>::active_cell_iterator
- cell = triangulation.begin_active(),
- endc = triangulation.end();
- for (; cell!=endc; ++cell)
- cell->set_all_manifold_ids (0);
- const QGauss<spacedim> quadrature(1);
-
- std::vector<Point<spacedim> > q_points_from_quadrature = quadrature.get_points();
+ const QGauss<spacedim> quad(3);
FE_Q<dim,spacedim> fe(1);
DoFHandler<dim,spacedim> dof(triangulation);
dof.distribute_dofs(fe);
+ MappingManifold<dim,spacedim> mapping;
- FEValues<dim,spacedim> fe_values (fe, quadrature,
+ FEValues<dim,spacedim> fe_values (mapping, fe, quad,
update_quadrature_points);
-
- MappingManifold<dim,spacedim> map_manifold;
-
- cell = triangulation.begin_active();
-
- std::ofstream two_be_plotted("plot.txt");
- for (; cell!=endc; ++cell)
+ for (typename Triangulation<dim,spacedim>::active_cell_iterator cell= triangulation.begin_active();
+ cell != triangulation.end(); ++cell)
{
fe_values.reinit(cell);
- std::vector<Point<spacedim> > q_points_from_fe_values = fe_values.get_quadrature_points();
- for (unsigned int q=0; q<q_points_from_fe_values.size(); ++q)
+ std::vector<Point<spacedim> > fev_qp = fe_values.get_quadrature_points();
+ for (unsigned int q=0; q<fev_qp.size(); ++q)
{
- const Point<spacedim> pq = map_manifold.transform_unit_to_real_cell(cell,q_points_from_quadrature[q]);
+ const Point<spacedim> pq = mapping.transform_unit_to_real_cell(cell,quad.point(q));
- if (pq.distance(q_points_from_fe_values[q]) > 1e-10)
+ if (pq.distance(fev_qp[q]) > 1e-10)
{
deallog << "Expected: " << pq << ", got: "
- << q_points_from_fe_values[q] << std::endl;
+ << fev_qp[q] << std::endl;
}
- two_be_plotted << pq << " " << q_points_from_fe_values[q] << std::endl;
}
}
deallog << "OK" << std::endl;
deallog.attach(logfile);
deallog.threshold_double(1.e-10);
-
- // test<1,1>();
test<2,2>();
- // test<3,3>();
-
- // test<1,2>();
- // test<1,3>();
- // test<2,3>();
+ test<3,3>();
return 0;
}