From: bangerth Date: Fri, 12 Aug 2011 23:09:37 +0000 (+0000) Subject: Make FEFaceValues in 1d also work with MappingCartesian. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82c4c10b7c0618f5bb0ed51c68c8c1f51b6aca2c;p=dealii-svn.git Make FEFaceValues in 1d also work with MappingCartesian. git-svn-id: https://svn.dealii.org/trunk@24057 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/fe/fe_face_values_1d_mapping_cartesian.cc b/tests/fe/fe_face_values_1d_mapping_cartesian.cc new file mode 100644 index 0000000000..5d4e3b4f7e --- /dev/null +++ b/tests/fe/fe_face_values_1d_mapping_cartesian.cc @@ -0,0 +1,188 @@ +//------------------------------------------------------- +// rt_11.cc,v 1.3 2003/06/09 16:00:38 wolf Exp +// Version: +// +// Copyright (C) 2011 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. +// +//------------------------------------------------------- + +// like fe_face_values_1d but testing that one can use MappingCartesian + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PRECISION 4 + + + +template +inline void +plot_faces(Mapping &mapping, + FiniteElement &fe, + typename DoFHandler::cell_iterator &cell) +{ + // create a QGauss<0>(4), which should + // still only have 1 quadrature point + QGauss q(4); + Assert (q.size() == 1, ExcInternalError()); + + FEFaceValues fe_values(mapping, fe, q, + UpdateFlags(update_q_points + | update_JxW_values + | update_values + | update_gradients + | update_hessians + | update_normal_vectors)); + + for (unsigned int face_nr=0; + face_nr < GeometryInfo::faces_per_cell; + ++ face_nr) + { + deallog << "Face=" << face_nr << std::endl; + fe_values.reinit(cell, face_nr); + + // print some data on the location + deallog << "x=" << fe_values.quadrature_point(0) << std::endl; + deallog << "n=" << fe_values.normal_vector(0) << std::endl; + deallog << "JxW=" << fe_values.JxW(0) << std::endl; + + // now print some data on the shape + // functions + for (unsigned int i=0; i tria; + GridGenerator::hyper_cube (tria); + + FE_Q fe_q4(2); + DoFHandler dof(tria); + dof.distribute_dofs(fe_q4); + + typename DoFHandler::cell_iterator cell = dof.begin_active(); + { + std::ostringstream ost; + ost << "MappingFace" << dim << "d-" + << mapping_name; + deallog << ost.str() << std::endl; + plot_faces(mapping, fe_q4, cell); + } + + { + std::ostringstream ost; + ost << "MappingSubface" << dim << "d-" + << mapping_name; + deallog << ost.str() << std::endl; + plot_subfaces(mapping, fe_q4, cell); + } +} + + + +int main() +{ + std::ofstream logfile ("fe_face_values_1d_mapping_cartesian/output"); + deallog << std::setprecision(PRECISION); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + // ----------------------- + // Tests for dim=1 + // ----------------------- + mapping_test<1>(); +} + diff --git a/tests/fe/fe_face_values_1d_mapping_cartesian/cmp/generic b/tests/fe/fe_face_values_1d_mapping_cartesian/cmp/generic new file mode 100644 index 0000000000..bc4f1410ae --- /dev/null +++ b/tests/fe/fe_face_values_1d_mapping_cartesian/cmp/generic @@ -0,0 +1,72 @@ + +DEAL::dim=1 +DEAL::MappingFace1d-MappingCartesian +DEAL::Face=0 +DEAL::x=0.000 +DEAL::n=-1.000 +DEAL::JxW=1.000 +DEAL::shape_function 0: +DEAL:: phi=1.000 +DEAL:: grad phi=-3.000 +DEAL:: grad^2 phi=4.000 +DEAL::shape_function 1: +DEAL:: phi=0 +DEAL:: grad phi=-1.000 +DEAL:: grad^2 phi=4.000 +DEAL::shape_function 2: +DEAL:: phi=0 +DEAL:: grad phi=4.000 +DEAL:: grad^2 phi=-8.000 +DEAL:: +DEAL::Face=1 +DEAL::x=1.000 +DEAL::n=1.000 +DEAL::JxW=1.000 +DEAL::shape_function 0: +DEAL:: phi=0 +DEAL:: grad phi=1.000 +DEAL:: grad^2 phi=4.000 +DEAL::shape_function 1: +DEAL:: phi=1.000 +DEAL:: grad phi=3.000 +DEAL:: grad^2 phi=4.000 +DEAL::shape_function 2: +DEAL:: phi=0 +DEAL:: grad phi=-4.000 +DEAL:: grad^2 phi=-8.000 +DEAL:: +DEAL::MappingSubface1d-MappingCartesian +DEAL::Face=0, subface=0 +DEAL::x=0.000 +DEAL::n=-1.000 +DEAL::JxW=1.000 +DEAL::shape_function 0: +DEAL:: phi=1.000 +DEAL:: grad phi=-3.000 +DEAL:: grad^2 phi=4.000 +DEAL::shape_function 1: +DEAL:: phi=0 +DEAL:: grad phi=-1.000 +DEAL:: grad^2 phi=4.000 +DEAL::shape_function 2: +DEAL:: phi=0 +DEAL:: grad phi=4.000 +DEAL:: grad^2 phi=-8.000 +DEAL:: +DEAL::Face=1, subface=0 +DEAL::x=1.000 +DEAL::n=1.000 +DEAL::JxW=1.000 +DEAL::shape_function 0: +DEAL:: phi=0 +DEAL:: grad phi=1.000 +DEAL:: grad^2 phi=4.000 +DEAL::shape_function 1: +DEAL:: phi=1.000 +DEAL:: grad phi=3.000 +DEAL:: grad^2 phi=4.000 +DEAL::shape_function 2: +DEAL:: phi=0 +DEAL:: grad phi=-4.000 +DEAL:: grad^2 phi=-8.000 +DEAL::