Reference documentation for deal.II version 9.1.0-pre
mapping.cc
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2001 - 2017 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 
17 #include <deal.II/fe/mapping.h>
18 
19 #include <deal.II/grid/tria.h>
20 
21 DEAL_II_NAMESPACE_OPEN
22 
23 
24 template <int dim, int spacedim>
25 std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
27  const typename Triangulation<dim, spacedim>::cell_iterator &cell) const
28 {
29  std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell> vertices;
30  for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
31  {
32  vertices[i] = cell->vertex(i);
33  }
34  return vertices;
35 }
36 
37 
38 template <int dim, int spacedim>
39 Point<dim - 1>
42  const unsigned int & face_no,
43  const Point<spacedim> & p) const
44 {
45  // The function doesn't make physical sense for dim=1
46  Assert(dim > 1, ExcNotImplemented());
47  // Not implemented for higher dimensions
48  Assert(dim <= 3, ExcNotImplemented());
49 
50  Point<dim> unit_cell_pt = transform_real_to_unit_cell(cell, p);
51 
52  Point<dim - 1> unit_face_pt;
53 
54  if (dim == 2)
55  {
57  unit_face_pt = Point<dim - 1>(unit_cell_pt(1));
58  else if (GeometryInfo<dim>::unit_normal_direction[face_no] == 1)
59  unit_face_pt = Point<dim - 1>(unit_cell_pt(0));
60  }
61  else if (dim == 3)
62  {
64  unit_face_pt = Point<dim - 1>(unit_cell_pt(1), unit_cell_pt(2));
65  else if (GeometryInfo<dim>::unit_normal_direction[face_no] == 1)
66  unit_face_pt = Point<dim - 1>(unit_cell_pt(0), unit_cell_pt(2));
67  else if (GeometryInfo<dim>::unit_normal_direction[face_no] == 2)
68  unit_face_pt = Point<dim - 1>(unit_cell_pt(0), unit_cell_pt(1));
69  }
70 
71  return unit_face_pt;
72 }
73 
74 /* ---------------------------- InternalDataBase --------------------------- */
75 
76 
77 template <int dim, int spacedim>
79  : update_each(update_default)
80 {}
81 
82 
83 
84 template <int dim, int spacedim>
85 std::size_t
87 {
88  return sizeof(*this);
89 }
90 
91 
92 /*------------------------------ InternalData ------------------------------*/
93 
94 
95 
96 // explicit instantiations
97 #include "mapping.inst"
98 
99 
100 DEAL_II_NAMESPACE_CLOSE
virtual std::array< Point< spacedim >, GeometryInfo< dim >::vertices_per_cell > get_vertices(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const
Definition: mapping.cc:26
Definition: point.h:106
No update.
#define Assert(cond, exc)
Definition: exceptions.h:1227
virtual std::size_t memory_consumption() const
Definition: mapping.cc:86
static::ExceptionBase & ExcNotImplemented()
Point< dim-1 > project_real_point_to_unit_point_on_face(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int &face_no, const Point< spacedim > &p) const
Definition: mapping.cc:40