From 5fdc35acf149f87db7cf7e11457014e33d038247 Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 30 May 2012 14:57:40 +0000 Subject: [PATCH] One more test. git-svn-id: https://svn.dealii.org/trunk@25576 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/fe/mapping_real_to_unit_q4_curved.cc | 129 ++++++++++++++++++ .../cmp/generic | 9 ++ ...cc => mapping_real_to_unit_q4_straight.cc} | 2 +- .../cmp/generic | 0 4 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 tests/fe/mapping_real_to_unit_q4_curved.cc create mode 100644 tests/fe/mapping_real_to_unit_q4_curved/cmp/generic rename tests/fe/{mapping_real_to_unit_q4.cc => mapping_real_to_unit_q4_straight.cc} (98%) rename tests/fe/{mapping_real_to_unit_q4 => mapping_real_to_unit_q4_straight}/cmp/generic (100%) diff --git a/tests/fe/mapping_real_to_unit_q4_curved.cc b/tests/fe/mapping_real_to_unit_q4_curved.cc new file mode 100644 index 0000000000..3401d6c108 --- /dev/null +++ b/tests/fe/mapping_real_to_unit_q4_curved.cc @@ -0,0 +1,129 @@ +//----------------------------------------------------------------------------- +// $Id: data_out_base_pvd.cc 25569 2012-05-30 12:53:31Z bangerth $ +// Version: $Name$ +// +// Copyright (C) 2006, 2007, 2010, 2012 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//----------------------------------------------------------------------------- + + +// on a somewhat deformed cube, verify that if we push forward a bunch +// of points from the reference to the real cell and then call +// Mapping::transform_unit_to_real_cell that we get the same point as +// we had in the beginning. +// +// like in the _q4_straight test, we use a Q4 mapping but this time we +// actually curve one boundary of the cell which ensures that the +// mapping is really higher order than just Q1 + +#include "../tests.h" + +#include +#include +#include +#include +#include + + +template +void test_real_to_unit_cell() +{ + deallog << "dim=" << dim << ", spacedim=" << spacedim << std::endl; + + // define a boundary that fits the + // the vertices of the hyper cube + // we're going to create below + HyperBallBoundary boundary (Point(), + std::sqrt(1.*dim)); + + Triangulation triangulation; + GridGenerator::hyper_cube (triangulation, -1, 1); + + // set the boundary indicator for + // one face of the single cell + triangulation.set_boundary (1, boundary); + triangulation.begin_active()->face(0)->set_boundary_indicator (1); + + const unsigned int n_points = 5; + std::vector< Point > unit_points(Utilities::fixed_power(n_points)); + + switch (dim) + { + case 1: + for (unsigned int x=0; x map(4); + + // work with this cell (unlike the + // _q1 test where we move vertices) + typename Triangulation::active_cell_iterator + cell = triangulation.begin_active(); + for (unsigned int i=0; i p = map.transform_unit_to_real_cell(cell,unit_points[i]); + const Point p_unit = map.transform_real_to_unit_cell(cell,p); + Assert (unit_points[i].distance(p_unit) < 1e-10, + ExcInternalError()); + } + deallog << "OK" << std::endl; +} + + +int +main() +{ + std::ofstream logfile ("mapping_real_to_unit_q4_curved/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + + test_real_to_unit_cell<1,1>(); + test_real_to_unit_cell<2,2>(); + test_real_to_unit_cell<3,3>(); + + test_real_to_unit_cell<1,2>(); + +// the following is not currently implemented +// test_real_to_unit_cell<1,3>(); +// test_real_to_unit_cell<2,3>(); + + return 0; +} + + + diff --git a/tests/fe/mapping_real_to_unit_q4_curved/cmp/generic b/tests/fe/mapping_real_to_unit_q4_curved/cmp/generic new file mode 100644 index 0000000000..7bea8b1c89 --- /dev/null +++ b/tests/fe/mapping_real_to_unit_q4_curved/cmp/generic @@ -0,0 +1,9 @@ + +DEAL::dim=1, spacedim=1 +DEAL::OK +DEAL::dim=2, spacedim=2 +DEAL::OK +DEAL::dim=3, spacedim=3 +DEAL::OK +DEAL::dim=1, spacedim=2 +DEAL::OK diff --git a/tests/fe/mapping_real_to_unit_q4.cc b/tests/fe/mapping_real_to_unit_q4_straight.cc similarity index 98% rename from tests/fe/mapping_real_to_unit_q4.cc rename to tests/fe/mapping_real_to_unit_q4_straight.cc index 2345c87872..24aa9d18b8 100644 --- a/tests/fe/mapping_real_to_unit_q4.cc +++ b/tests/fe/mapping_real_to_unit_q4_straight.cc @@ -109,7 +109,7 @@ void test_real_to_unit_cell() int main() { - std::ofstream logfile ("mapping_real_to_unit_q4/output"); + std::ofstream logfile ("mapping_real_to_unit_q4_straight/output"); deallog.attach(logfile); deallog.depth_console(0); deallog.threshold_double(1.e-10); diff --git a/tests/fe/mapping_real_to_unit_q4/cmp/generic b/tests/fe/mapping_real_to_unit_q4_straight/cmp/generic similarity index 100% rename from tests/fe/mapping_real_to_unit_q4/cmp/generic rename to tests/fe/mapping_real_to_unit_q4_straight/cmp/generic -- 2.39.5