}
+ inline
+ Tensor<1,3>
+ wedge_product_of_columns (const Tensor<1,3> (&derivative)[2])
+ {
+ Tensor<1,3> result;
+ cross_product (result, derivative[0], derivative[1]);
+
+ return result;
+ }
+
+
/**
* Alternating form for quads in 3d.
*/
{
// for each of the vertices,
// form the scaled normal
- // vector. since the mapping is
- // linear, all normals are the
- // same
- (void)vertices;
- (void)forms;
+ // vector. to do so, we need to
+ // see how the infinitesimal
+ // vectors (d\xi_1,0) and (0,d\xi_2)
+ // are transformed into
+ // spacedim-dimensional space
+ // and then form their cross
+ // product. to this end, note that
+ // \vec x = sum_i \vec v_i phi_i(\vec xi)
+ // so the transformed vectors are
+ // [x(\xi+(d\xi_1,0))-x(\xi)]/d\xi_1
+ // and
+ // [x(\xi+(0,d\xi_2))-x(\xi)]/d\xi_2
+ // which boils down to the columns
+ // of the 3x2 matrix \grad_\xi x(\xi)
+ const unsigned int dim = 2;
+ const unsigned int spacedim = 3;
+
+ for (unsigned int i=0; i<dealii::GeometryInfo<dim>::vertices_per_cell; ++i)
+ {
+ Tensor<1,spacedim> derivatives[dim];
+
+ for (unsigned int j=0; j<dealii::GeometryInfo<dim>::vertices_per_cell; ++j)
+ {
+ const Tensor<1,dim> grad_phi_j
+ = (dealii::GeometryInfo<dim>::
+ d_linear_shape_function_gradient (dealii::GeometryInfo<dim>::
+ unit_cell_vertex(i),
+ j));
+ for (unsigned int l=0; l<dim; ++l)
+ derivatives[l] += vertices[j] * grad_phi_j[l];
+ }
+
+ forms[i] = wedge_product_of_columns (derivatives);
+ }
}
}
}
--- /dev/null
+//---------------------------- geometry_info_7.cc ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 2003, 2004, 2005, 2006, 2009 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.
+//
+//---------------------------- geometry_info_7.cc ---------------------------
+
+
+// check GeometryInfo::alternating_form_at_vertices for the faces of cells
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <base/geometry_info.h>
+
+#include <fstream>
+#include <cstdlib>
+
+
+template <int dim>
+void test ()
+{
+ deallog << "Checking in " << dim << "d" << std::endl;
+
+ // check the determinant of the
+ // transformation for the reference
+ // cell. the determinant should be one in
+ // that case
+ {
+ Point<dim> vertices[GeometryInfo<dim>::vertices_per_cell];
+ for (unsigned int v=0;v<GeometryInfo<dim>::vertices_per_cell;++v)
+ vertices[v] = GeometryInfo<dim>::unit_cell_vertex(v);
+
+ for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+ {
+ Point<dim> face_vertices[GeometryInfo<dim>::vertices_per_face];
+ for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_face; ++v)
+ face_vertices[v] = vertices[GeometryInfo<dim>::face_to_cell_vertices (f, v)];
+
+ Tensor<1,dim> alternating_forms[GeometryInfo<dim>::vertices_per_face];
+ GeometryInfo<dim-1>::alternating_form_at_vertices (face_vertices,
+ alternating_forms);
+ for (unsigned int v=0;v<GeometryInfo<dim>::vertices_per_face;++v)
+ {
+ deallog << "Reference cell: face " << f << ": " << alternating_forms[v]
+ << std::endl;
+ Assert (alternating_forms[v].norm() == 1, ExcInternalError());
+ }
+ }
+ }
+
+ // try the same, but move squash the cell
+ // in the x-direction by a factor of 10
+ {
+ Point<dim> vertices[GeometryInfo<dim>::vertices_per_cell];
+ for (unsigned int v=0;v<GeometryInfo<dim>::vertices_per_cell;++v)
+ {
+ vertices[v] = GeometryInfo<dim>::unit_cell_vertex(v);
+ vertices[v][0] /= 10;
+ }
+
+ for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+ {
+ Point<dim> face_vertices[GeometryInfo<dim>::vertices_per_face];
+ for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_face; ++v)
+ face_vertices[v] = vertices[GeometryInfo<dim>::face_to_cell_vertices (f, v)];
+ Tensor<1,dim> alternating_forms[GeometryInfo<dim>::vertices_per_face];
+ GeometryInfo<dim-1>::alternating_form_at_vertices (face_vertices,
+ alternating_forms);
+ for (unsigned int v=0;v<GeometryInfo<dim>::vertices_per_face;++v)
+ {
+ deallog << "Squashed cell: face " << f << ": " << alternating_forms[v]
+ << std::endl;
+ // faces 0,1 should be
+ // unaffected, but all
+ // other faces are
+ // squashed
+ if (f < 2)
+ Assert (alternating_forms[v].norm() == 1, ExcInternalError())
+ else
+ Assert (alternating_forms[v].norm() == 0.1, ExcInternalError());
+ }
+ }
+ }
+
+
+ // try the same, but move squash the cell
+ // in the x-direction by a factor of 10 and
+ // rotate it around the z-axis (unless in
+ // 1d)
+ {
+ Point<dim> vertices[GeometryInfo<dim>::vertices_per_cell];
+ for (unsigned int v=0;v<GeometryInfo<dim>::vertices_per_cell;++v)
+ {
+ vertices[v] = GeometryInfo<dim>::unit_cell_vertex(v);
+ vertices[v][0] /= 10;
+
+ if (dim > 1)
+ {
+ std::swap (vertices[v][0], vertices[v][1]);
+ vertices[v][1] *= -1;
+ }
+ }
+
+ for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+ {
+ Point<dim> face_vertices[GeometryInfo<dim>::vertices_per_face];
+ for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_face; ++v)
+ face_vertices[v] = vertices[GeometryInfo<dim>::face_to_cell_vertices (f, v)];
+ Tensor<1,dim> alternating_forms[GeometryInfo<dim>::vertices_per_face];
+ GeometryInfo<dim-1>::alternating_form_at_vertices (face_vertices,
+ alternating_forms);
+ for (unsigned int v=0;v<GeometryInfo<dim>::vertices_per_face;++v)
+ {
+ deallog << "Squashed+rotated cell: face " << f << ": " << alternating_forms[v]
+ << std::endl;
+
+ // in 2d and 3d, faces
+ // 0,1 should be
+ // unaffected (just like
+ // for the squashed cell,
+ // the rotation has
+ // nothing to do with
+ // face numbers though
+ // the direction of the
+ // alternating form
+ // vector would have
+ // rotated along)
+ if (f<2)
+ Assert (alternating_forms[v].norm() == 1, ExcInternalError())
+ else
+ Assert (alternating_forms[v].norm() == 0.1, ExcInternalError());
+ }
+ }
+ }
+
+ // pinched cell
+ {
+ Point<dim> vertices[GeometryInfo<dim>::vertices_per_cell];
+ for (unsigned int v=0;v<GeometryInfo<dim>::vertices_per_cell;++v)
+ vertices[v] = GeometryInfo<dim>::unit_cell_vertex(v);
+ vertices[1] /= 10;
+
+ for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+ {
+ Point<dim> face_vertices[GeometryInfo<dim>::vertices_per_face];
+ for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_face; ++v)
+ face_vertices[v] = vertices[GeometryInfo<dim>::face_to_cell_vertices (f, v)];
+ Tensor<1,dim> alternating_forms[GeometryInfo<dim>::vertices_per_face];
+ GeometryInfo<dim-1>::alternating_form_at_vertices (face_vertices,
+ alternating_forms);
+ for (unsigned int v=0;v<GeometryInfo<dim>::vertices_per_face;++v)
+ deallog << "Pinched cell: face " << f << ": " << alternating_forms[v]
+ << std::endl;
+ }
+ }
+
+
+ // inverted cell
+ {
+ Point<dim> vertices[GeometryInfo<dim>::vertices_per_cell];
+ for (unsigned int v=0;v<GeometryInfo<dim>::vertices_per_cell;++v)
+ vertices[v] = GeometryInfo<dim>::unit_cell_vertex(v);
+ std::swap (vertices[0], vertices[1]);
+
+ for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+ {
+ Point<dim> face_vertices[GeometryInfo<dim>::vertices_per_face];
+ for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_face; ++v)
+ face_vertices[v] = vertices[GeometryInfo<dim>::face_to_cell_vertices (f, v)];
+
+ Tensor<1,dim> alternating_forms[GeometryInfo<dim>::vertices_per_face];
+ GeometryInfo<dim-1>::alternating_form_at_vertices (face_vertices,
+ alternating_forms);
+ for (unsigned int v=0;v<GeometryInfo<dim>::vertices_per_face;++v)
+ deallog << "Inverted cell: face " << f << ": " << alternating_forms[v]
+ << std::endl;
+ }
+ }
+}
+
+
+
+int main ()
+{
+ std::ofstream logfile("geometry_info_7/output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+ deallog.threshold_double(1.e-10);
+
+ test<2> ();
+ test<3> ();
+
+ return 0;
+}
--- /dev/null
+
+DEAL::Checking in 2d
+DEAL::Reference cell: face 0: 1.00000 0.00000
+DEAL::Reference cell: face 0: 1.00000 0.00000
+DEAL::Reference cell: face 1: 1.00000 0.00000
+DEAL::Reference cell: face 1: 1.00000 0.00000
+DEAL::Reference cell: face 2: 0.00000 -1.00000
+DEAL::Reference cell: face 2: 0.00000 -1.00000
+DEAL::Reference cell: face 3: 0.00000 -1.00000
+DEAL::Reference cell: face 3: 0.00000 -1.00000
+DEAL::Squashed cell: face 0: 1.00000 0.00000
+DEAL::Squashed cell: face 0: 1.00000 0.00000
+DEAL::Squashed cell: face 1: 1.00000 0.00000
+DEAL::Squashed cell: face 1: 1.00000 0.00000
+DEAL::Squashed cell: face 2: 0.00000 -0.100000
+DEAL::Squashed cell: face 2: 0.00000 -0.100000
+DEAL::Squashed cell: face 3: 0.00000 -0.100000
+DEAL::Squashed cell: face 3: 0.00000 -0.100000
+DEAL::Squashed+rotated cell: face 0: 0.00000 -1.00000
+DEAL::Squashed+rotated cell: face 0: 0.00000 -1.00000
+DEAL::Squashed+rotated cell: face 1: 0.00000 -1.00000
+DEAL::Squashed+rotated cell: face 1: 0.00000 -1.00000
+DEAL::Squashed+rotated cell: face 2: -0.100000 0.00000
+DEAL::Squashed+rotated cell: face 2: -0.100000 0.00000
+DEAL::Squashed+rotated cell: face 3: -0.100000 0.00000
+DEAL::Squashed+rotated cell: face 3: -0.100000 0.00000
+DEAL::Pinched cell: face 0: 1.00000 0.00000
+DEAL::Pinched cell: face 0: 1.00000 0.00000
+DEAL::Pinched cell: face 1: 1.00000 -0.900000
+DEAL::Pinched cell: face 1: 1.00000 -0.900000
+DEAL::Pinched cell: face 2: 0.00000 -0.100000
+DEAL::Pinched cell: face 2: 0.00000 -0.100000
+DEAL::Pinched cell: face 3: 0.00000 -1.00000
+DEAL::Pinched cell: face 3: 0.00000 -1.00000
+DEAL::Inverted cell: face 0: 1.00000 1.00000
+DEAL::Inverted cell: face 0: 1.00000 1.00000
+DEAL::Inverted cell: face 1: 1.00000 -1.00000
+DEAL::Inverted cell: face 1: 1.00000 -1.00000
+DEAL::Inverted cell: face 2: 0.00000 1.00000
+DEAL::Inverted cell: face 2: 0.00000 1.00000
+DEAL::Inverted cell: face 3: 0.00000 -1.00000
+DEAL::Inverted cell: face 3: 0.00000 -1.00000
+DEAL::Checking in 3d
+DEAL::Reference cell: face 0: 1.00000 0.00000 0.00000
+DEAL::Reference cell: face 0: 1.00000 0.00000 0.00000
+DEAL::Reference cell: face 0: 1.00000 0.00000 0.00000
+DEAL::Reference cell: face 0: 1.00000 0.00000 0.00000
+DEAL::Reference cell: face 1: 1.00000 0.00000 0.00000
+DEAL::Reference cell: face 1: 1.00000 0.00000 0.00000
+DEAL::Reference cell: face 1: 1.00000 0.00000 0.00000
+DEAL::Reference cell: face 1: 1.00000 0.00000 0.00000
+DEAL::Reference cell: face 2: 0.00000 1.00000 0.00000
+DEAL::Reference cell: face 2: 0.00000 1.00000 0.00000
+DEAL::Reference cell: face 2: 0.00000 1.00000 0.00000
+DEAL::Reference cell: face 2: 0.00000 1.00000 0.00000
+DEAL::Reference cell: face 3: 0.00000 1.00000 0.00000
+DEAL::Reference cell: face 3: 0.00000 1.00000 0.00000
+DEAL::Reference cell: face 3: 0.00000 1.00000 0.00000
+DEAL::Reference cell: face 3: 0.00000 1.00000 0.00000
+DEAL::Reference cell: face 4: 0.00000 0.00000 1.00000
+DEAL::Reference cell: face 4: 0.00000 0.00000 1.00000
+DEAL::Reference cell: face 4: 0.00000 0.00000 1.00000
+DEAL::Reference cell: face 4: 0.00000 0.00000 1.00000
+DEAL::Reference cell: face 5: 0.00000 0.00000 1.00000
+DEAL::Reference cell: face 5: 0.00000 0.00000 1.00000
+DEAL::Reference cell: face 5: 0.00000 0.00000 1.00000
+DEAL::Reference cell: face 5: 0.00000 0.00000 1.00000
+DEAL::Squashed cell: face 0: 1.00000 0.00000 0.00000
+DEAL::Squashed cell: face 0: 1.00000 0.00000 0.00000
+DEAL::Squashed cell: face 0: 1.00000 0.00000 0.00000
+DEAL::Squashed cell: face 0: 1.00000 0.00000 0.00000
+DEAL::Squashed cell: face 1: 1.00000 0.00000 0.00000
+DEAL::Squashed cell: face 1: 1.00000 0.00000 0.00000
+DEAL::Squashed cell: face 1: 1.00000 0.00000 0.00000
+DEAL::Squashed cell: face 1: 1.00000 0.00000 0.00000
+DEAL::Squashed cell: face 2: 0.00000 0.100000 0.00000
+DEAL::Squashed cell: face 2: 0.00000 0.100000 0.00000
+DEAL::Squashed cell: face 2: 0.00000 0.100000 0.00000
+DEAL::Squashed cell: face 2: 0.00000 0.100000 0.00000
+DEAL::Squashed cell: face 3: 0.00000 0.100000 0.00000
+DEAL::Squashed cell: face 3: 0.00000 0.100000 0.00000
+DEAL::Squashed cell: face 3: 0.00000 0.100000 0.00000
+DEAL::Squashed cell: face 3: 0.00000 0.100000 0.00000
+DEAL::Squashed cell: face 4: 0.00000 0.00000 0.100000
+DEAL::Squashed cell: face 4: 0.00000 0.00000 0.100000
+DEAL::Squashed cell: face 4: 0.00000 0.00000 0.100000
+DEAL::Squashed cell: face 4: 0.00000 0.00000 0.100000
+DEAL::Squashed cell: face 5: 0.00000 0.00000 0.100000
+DEAL::Squashed cell: face 5: 0.00000 0.00000 0.100000
+DEAL::Squashed cell: face 5: 0.00000 0.00000 0.100000
+DEAL::Squashed cell: face 5: 0.00000 0.00000 0.100000
+DEAL::Squashed+rotated cell: face 0: 0.00000 -1.00000 0.00000
+DEAL::Squashed+rotated cell: face 0: 0.00000 -1.00000 0.00000
+DEAL::Squashed+rotated cell: face 0: 0.00000 -1.00000 0.00000
+DEAL::Squashed+rotated cell: face 0: 0.00000 -1.00000 0.00000
+DEAL::Squashed+rotated cell: face 1: 0.00000 -1.00000 0.00000
+DEAL::Squashed+rotated cell: face 1: 0.00000 -1.00000 0.00000
+DEAL::Squashed+rotated cell: face 1: 0.00000 -1.00000 0.00000
+DEAL::Squashed+rotated cell: face 1: 0.00000 -1.00000 0.00000
+DEAL::Squashed+rotated cell: face 2: 0.100000 0.00000 0.00000
+DEAL::Squashed+rotated cell: face 2: 0.100000 0.00000 0.00000
+DEAL::Squashed+rotated cell: face 2: 0.100000 0.00000 0.00000
+DEAL::Squashed+rotated cell: face 2: 0.100000 0.00000 0.00000
+DEAL::Squashed+rotated cell: face 3: 0.100000 0.00000 0.00000
+DEAL::Squashed+rotated cell: face 3: 0.100000 0.00000 0.00000
+DEAL::Squashed+rotated cell: face 3: 0.100000 0.00000 0.00000
+DEAL::Squashed+rotated cell: face 3: 0.100000 0.00000 0.00000
+DEAL::Squashed+rotated cell: face 4: 0.00000 0.00000 0.100000
+DEAL::Squashed+rotated cell: face 4: 0.00000 0.00000 0.100000
+DEAL::Squashed+rotated cell: face 4: 0.00000 0.00000 0.100000
+DEAL::Squashed+rotated cell: face 4: 0.00000 0.00000 0.100000
+DEAL::Squashed+rotated cell: face 5: 0.00000 0.00000 0.100000
+DEAL::Squashed+rotated cell: face 5: 0.00000 0.00000 0.100000
+DEAL::Squashed+rotated cell: face 5: 0.00000 0.00000 0.100000
+DEAL::Squashed+rotated cell: face 5: 0.00000 0.00000 0.100000
+DEAL::Pinched cell: face 0: 1.00000 0.00000 0.00000
+DEAL::Pinched cell: face 0: 1.00000 0.00000 0.00000
+DEAL::Pinched cell: face 0: 1.00000 0.00000 0.00000
+DEAL::Pinched cell: face 0: 1.00000 0.00000 0.00000
+DEAL::Pinched cell: face 1: 1.00000 -0.900000 -0.900000
+DEAL::Pinched cell: face 1: 1.00000 -0.900000 0.00000
+DEAL::Pinched cell: face 1: 1.00000 0.00000 -0.900000
+DEAL::Pinched cell: face 1: 1.00000 0.00000 0.00000
+DEAL::Pinched cell: face 2: 0.00000 0.100000 0.00000
+DEAL::Pinched cell: face 2: 0.00000 1.00000 0.00000
+DEAL::Pinched cell: face 2: 0.00000 0.100000 0.00000
+DEAL::Pinched cell: face 2: 0.00000 1.00000 0.00000
+DEAL::Pinched cell: face 3: 0.00000 1.00000 0.00000
+DEAL::Pinched cell: face 3: 0.00000 1.00000 0.00000
+DEAL::Pinched cell: face 3: 0.00000 1.00000 0.00000
+DEAL::Pinched cell: face 3: 0.00000 1.00000 0.00000
+DEAL::Pinched cell: face 4: 0.00000 0.00000 0.100000
+DEAL::Pinched cell: face 4: 0.00000 0.00000 0.100000
+DEAL::Pinched cell: face 4: 0.00000 0.00000 1.00000
+DEAL::Pinched cell: face 4: 0.00000 0.00000 1.00000
+DEAL::Pinched cell: face 5: 0.00000 0.00000 1.00000
+DEAL::Pinched cell: face 5: 0.00000 0.00000 1.00000
+DEAL::Pinched cell: face 5: 0.00000 0.00000 1.00000
+DEAL::Pinched cell: face 5: 0.00000 0.00000 1.00000
+DEAL::Inverted cell: face 0: 1.00000 1.00000 1.00000
+DEAL::Inverted cell: face 0: 1.00000 1.00000 0.00000
+DEAL::Inverted cell: face 0: 1.00000 0.00000 1.00000
+DEAL::Inverted cell: face 0: 1.00000 0.00000 0.00000
+DEAL::Inverted cell: face 1: 1.00000 -1.00000 -1.00000
+DEAL::Inverted cell: face 1: 1.00000 -1.00000 0.00000
+DEAL::Inverted cell: face 1: 1.00000 0.00000 -1.00000
+DEAL::Inverted cell: face 1: 1.00000 0.00000 0.00000
+DEAL::Inverted cell: face 2: 0.00000 -1.00000 0.00000
+DEAL::Inverted cell: face 2: 0.00000 1.00000 0.00000
+DEAL::Inverted cell: face 2: 0.00000 -1.00000 0.00000
+DEAL::Inverted cell: face 2: 0.00000 1.00000 0.00000
+DEAL::Inverted cell: face 3: 0.00000 1.00000 0.00000
+DEAL::Inverted cell: face 3: 0.00000 1.00000 0.00000
+DEAL::Inverted cell: face 3: 0.00000 1.00000 0.00000
+DEAL::Inverted cell: face 3: 0.00000 1.00000 0.00000
+DEAL::Inverted cell: face 4: 0.00000 0.00000 -1.00000
+DEAL::Inverted cell: face 4: 0.00000 0.00000 -1.00000
+DEAL::Inverted cell: face 4: 0.00000 0.00000 1.00000
+DEAL::Inverted cell: face 4: 0.00000 0.00000 1.00000
+DEAL::Inverted cell: face 5: 0.00000 0.00000 1.00000
+DEAL::Inverted cell: face 5: 0.00000 0.00000 1.00000
+DEAL::Inverted cell: face 5: 0.00000 0.00000 1.00000
+DEAL::Inverted cell: face 5: 0.00000 0.00000 1.00000