Reference documentation for deal.II version 9.0.0
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 at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 
17 #include <deal.II/grid/tria.h>
18 #include <deal.II/fe/mapping.h>
19 
20 DEAL_II_NAMESPACE_OPEN
21 
22 
23 template <int dim, int spacedim>
24 std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
26  const typename Triangulation<dim,spacedim>::cell_iterator &cell) const
27 {
28  std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell> vertices;
29  for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
30  {
31  vertices[i] = cell->vertex(i);
32  }
33  return vertices;
34 }
35 
36 
37 template <int dim, int spacedim>
38 Point<dim-1>
41  const typename Triangulation<dim,spacedim>::cell_iterator &cell,
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::size_t memory_consumption() const
Definition: mapping.cc:86
virtual std::array< Point< spacedim >, GeometryInfo< dim >::vertices_per_cell > get_vertices(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const
Definition: mapping.cc:25
Definition: point.h:104
No update.
#define Assert(cond, exc)
Definition: exceptions.h:1142
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
static ::ExceptionBase & ExcNotImplemented()