Reference documentation for deal.II version 8.5.1
geometry_info.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1998 - 2016 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 #ifndef dealii__geometry_info_h
17 #define dealii__geometry_info_h
18 
19 
20 #include <deal.II/base/config.h>
21 #include <deal.II/base/exceptions.h>
22 #include <deal.II/base/point.h>
23 
24 DEAL_II_NAMESPACE_OPEN
25 
26 
45 {
46 public:
53  enum Object
54  {
58  vertex = 0,
62  line = 1,
66  quad = 2,
70  hex = 3
71  };
72 
77  GeometryPrimitive (const Object object);
78 
84  GeometryPrimitive (const unsigned int object_dimension);
85 
90  operator unsigned int () const;
91 
92 private:
97 };
98 
99 
100 
101 
115 template <int dim>
117 {
153  {
158 
162  isotropic_refinement = static_cast<unsigned char>(-1)
163  };
164 };
165 
166 
167 
178 template <>
180 {
216  {
224  cut_x = 1,
229  };
230 };
231 
232 
233 
245 template <>
247 {
283  {
291  cut_x = 1,
295  cut_y = 2,
299  cut_xy = cut_x | cut_y,
300 
305  };
306 };
307 
308 
309 
321 template <>
323 {
359  {
367  cut_x = 1,
371  cut_y = 2,
375  cut_xy = cut_x | cut_y,
379  cut_z = 4,
383  cut_xz = cut_x | cut_z,
387  cut_yz = cut_y | cut_z,
391  cut_xyz = cut_x | cut_y | cut_z,
392 
397  };
398 };
399 
400 
401 
413 template <int dim>
415 {
416 public:
420  RefinementCase ();
421 
426  RefinementCase (const typename RefinementPossibilities<dim>::Possibilities refinement_case);
427 
433  explicit RefinementCase (const unsigned char refinement_case);
434 
446  operator unsigned char () const;
447 
452  RefinementCase operator | (const RefinementCase &r) const;
453 
458  RefinementCase operator & (const RefinementCase &r) const;
459 
467  RefinementCase operator ~ () const;
468 
469 
475  static
476  RefinementCase cut_axis (const unsigned int i);
477 
481  static std::size_t memory_consumption ();
482 
487  template <class Archive>
488  void serialize(Archive &ar,
489  const unsigned int version);
490 
495  int,
496  << "The refinement flags given (" << arg1 << ") contain set bits that do not "
497  << "make sense for the space dimension of the object to which they are applied.");
498 
499 private:
504 unsigned char value :
505  (dim > 0 ? dim : 1);
506 };
507 
508 
509 namespace internal
510 {
511 
512 
533  template <int dim>
535  {
540  {
545 
549  case_isotropic = static_cast<unsigned char>(-1)
550  };
551  };
552 
553 
563  template <>
565  {
572  {
577 
582  };
583  };
584 
585 
586 
597  template <>
599  {
606  {
611 
616  };
617  };
618 
619 
620 
632  template <>
634  {
642  {
650  case_x = 1,
654  case_isotropic = case_x
655  };
656  };
657 
658 
659 
752  template <>
754  {
762  {
763  case_none = 0,
764  case_x = 1,
765  case_x1y = 2,
766  case_x2y = 3,
767  case_x1y2y = 4,
768  case_y = 5,
769  case_y1x = 6,
770  case_y2x = 7,
771  case_y1x2x = 8,
772  case_xy = 9,
773 
774  case_isotropic = case_xy
775  };
776  };
777 
778 
779 
780 
788  template <int dim>
789  class SubfaceCase : public SubfacePossibilities<dim>
790  {
791  public:
797  SubfaceCase (const typename SubfacePossibilities<dim>::Possibilities subface_possibility);
798 
810  operator unsigned char () const;
811 
815  static std::size_t memory_consumption ();
816 
821  int,
822  << "The subface case given (" << arg1 << ") does not make sense "
823  << "for the space dimension of the object to which they are applied.");
824 
825  private:
830  unsigned char value :
831  (dim == 3 ? 4 : 1);
832  };
833 
834 } // namespace internal
835 
836 
837 
838 template <int dim> struct GeometryInfo;
839 
840 
841 
842 
860 template <>
861 struct GeometryInfo<0>
862 {
863 
871  static const unsigned int max_children_per_cell = 1;
872 
876  static const unsigned int faces_per_cell = 0;
877 
885  static const unsigned int max_children_per_face = 0;
886 
892  static unsigned int n_children(const RefinementCase<0> &refinement_case);
893 
897  static const unsigned int vertices_per_cell = 1;
898 
905  static const unsigned int vertices_per_face = 0;
906 
910  static const unsigned int lines_per_face = 0;
911 
915  static const unsigned int quads_per_face = 0;
916 
920  static const unsigned int lines_per_cell = 0;
921 
925  static const unsigned int quads_per_cell = 0;
926 
930  static const unsigned int hexes_per_cell = 0;
931 };
932 
933 
934 
935 
936 
1461 template <int dim>
1462 struct GeometryInfo
1463 {
1464 
1472  static const unsigned int max_children_per_cell = 1 << dim;
1473 
1477  static const unsigned int faces_per_cell = 2 * dim;
1478 
1487 
1491  static const unsigned int vertices_per_cell = 1 << dim;
1492 
1496  static const unsigned int vertices_per_face = GeometryInfo<dim-1>::vertices_per_cell;
1497 
1501  static const unsigned int lines_per_face
1503 
1507  static const unsigned int quads_per_face
1509 
1519  static const unsigned int lines_per_cell
1522 
1530  static const unsigned int quads_per_cell
1533 
1537  static const unsigned int hexes_per_cell
1540 
1558  static const unsigned int ucd_to_deal[vertices_per_cell];
1559 
1573  static const unsigned int dx_to_deal[vertices_per_cell];
1574 
1585  static const unsigned int vertex_to_face[vertices_per_cell][dim];
1586 
1591  static
1592  unsigned int
1593  n_children(const RefinementCase<dim> &refinement_case);
1594 
1599  static
1600  unsigned int
1601  n_subfaces(const internal::SubfaceCase<dim> &subface_case);
1602 
1612  static
1613  double
1614  subface_ratio(const internal::SubfaceCase<dim> &subface_case,
1615  const unsigned int subface_no);
1616 
1622  static
1623  RefinementCase<dim-1>
1624  face_refinement_case (const RefinementCase<dim> &cell_refinement_case,
1625  const unsigned int face_no,
1626  const bool face_orientation = true,
1627  const bool face_flip = false,
1628  const bool face_rotation = false);
1629 
1635  static
1639  const unsigned int face_no,
1640  const bool face_orientation = true,
1641  const bool face_flip = false,
1642  const bool face_rotation = false);
1643 
1648  static
1650  line_refinement_case(const RefinementCase<dim> &cell_refinement_case,
1651  const unsigned int line_no);
1652 
1657  static
1659  min_cell_refinement_case_for_line_refinement(const unsigned int line_no);
1660 
1707  static
1708  unsigned int
1709  child_cell_on_face (const RefinementCase<dim> &ref_case,
1710  const unsigned int face,
1711  const unsigned int subface,
1712  const bool face_orientation = true,
1713  const bool face_flip = false,
1714  const bool face_rotation = false,
1717 
1731  static
1732  unsigned int
1733  line_to_cell_vertices (const unsigned int line,
1734  const unsigned int vertex);
1735 
1756  static
1757  unsigned int
1758  face_to_cell_vertices (const unsigned int face,
1759  const unsigned int vertex,
1760  const bool face_orientation = true,
1761  const bool face_flip = false,
1762  const bool face_rotation = false);
1763 
1775  static
1776  unsigned int
1777  face_to_cell_lines (const unsigned int face,
1778  const unsigned int line,
1779  const bool face_orientation = true,
1780  const bool face_flip = false,
1781  const bool face_rotation = false);
1782 
1792  static
1793  unsigned int
1794  standard_to_real_face_vertex (const unsigned int vertex,
1795  const bool face_orientation = true,
1796  const bool face_flip = false,
1797  const bool face_rotation = false);
1798 
1808  static
1809  unsigned int
1810  real_to_standard_face_vertex (const unsigned int vertex,
1811  const bool face_orientation = true,
1812  const bool face_flip = false,
1813  const bool face_rotation = false);
1814 
1824  static
1825  unsigned int
1826  standard_to_real_face_line (const unsigned int line,
1827  const bool face_orientation = true,
1828  const bool face_flip = false,
1829  const bool face_rotation = false);
1830 
1840  static
1841  unsigned int
1842  real_to_standard_face_line (const unsigned int line,
1843  const bool face_orientation = true,
1844  const bool face_flip = false,
1845  const bool face_rotation = false);
1846 
1852  static
1853  Point<dim>
1854  unit_cell_vertex (const unsigned int vertex);
1855 
1865  static
1866  unsigned int
1867  child_cell_from_point (const Point<dim> &p);
1868 
1876  static
1877  Point<dim>
1879  const unsigned int child_index,
1880  const RefinementCase<dim> refine_case
1882 
1888  static
1889  Point<dim>
1891  const unsigned int child_index,
1892  const RefinementCase<dim> refine_case
1894 
1899  static
1900  bool
1901  is_inside_unit_cell (const Point<dim> &p);
1902 
1914  static
1915  bool
1916  is_inside_unit_cell (const Point<dim> &p,
1917  const double eps);
1918 
1923  static
1924  Point<dim>
1925  project_to_unit_cell (const Point<dim> &p);
1926 
1932  static
1933  double
1934  distance_to_unit_cell (const Point<dim> &p);
1935 
1940  static
1941  double
1943  const unsigned int i);
1944 
1949  static
1952  const unsigned int i);
1953 
2005  template <int spacedim>
2006  static void
2008 #ifndef DEAL_II_CONSTEXPR_BUG
2009  (const Point<spacedim> (&vertices)[vertices_per_cell],
2011 #else
2012  (const Point<spacedim> *vertices,
2013  Tensor<spacedim-dim,spacedim> *forms);
2014 #endif
2015 
2025  static const unsigned int unit_normal_direction[faces_per_cell];
2026 
2044 
2050  static const unsigned int opposite_face[faces_per_cell];
2051 
2052 
2057  double,
2058  << "The coordinates must satisfy 0 <= x_i <= 1, "
2059  << "but here we have x_i=" << arg1);
2060 
2065  int, int, int,
2066  << "RefinementCase<dim> " << arg1 << ": face " << arg2
2067  << " has no subface " << arg3);
2068 };
2069 
2070 
2071 
2072 
2073 #ifndef DOXYGEN
2074 
2075 
2076 /* -------------- declaration of explicit specializations ------------- */
2077 
2078 #ifndef DEAL_II_MEMBER_ARRAY_SPECIALIZATION_BUG
2079 template <>
2080 const unsigned int GeometryInfo<1>::unit_normal_direction[faces_per_cell];
2081 template <>
2082 const unsigned int GeometryInfo<2>::unit_normal_direction[faces_per_cell];
2083 template <>
2084 const unsigned int GeometryInfo<3>::unit_normal_direction[faces_per_cell];
2085 template <>
2086 const unsigned int GeometryInfo<4>::unit_normal_direction[faces_per_cell];
2087 
2088 template <>
2089 const int GeometryInfo<1>::unit_normal_orientation[faces_per_cell];
2090 template <>
2091 const int GeometryInfo<2>::unit_normal_orientation[faces_per_cell];
2092 template <>
2093 const int GeometryInfo<3>::unit_normal_orientation[faces_per_cell];
2094 template <>
2095 const int GeometryInfo<4>::unit_normal_orientation[faces_per_cell];
2096 
2097 template <>
2098 const unsigned int GeometryInfo<1>::opposite_face[faces_per_cell];
2099 template <>
2100 const unsigned int GeometryInfo<2>::opposite_face[faces_per_cell];
2101 template <>
2102 const unsigned int GeometryInfo<3>::opposite_face[faces_per_cell];
2103 template <>
2104 const unsigned int GeometryInfo<4>::opposite_face[faces_per_cell];
2105 #endif
2106 
2107 
2108 template <>
2112  const unsigned int i);
2113 template <>
2117  const unsigned int i);
2118 template <>
2122  const unsigned int i);
2123 
2124 
2125 
2126 
2127 /* -------------- inline functions ------------- */
2128 
2129 
2130 inline
2131 GeometryPrimitive::GeometryPrimitive (const Object object)
2132  :
2133  object (object)
2134 {}
2135 
2136 
2137 
2138 inline
2139 GeometryPrimitive::GeometryPrimitive (const unsigned int object_dimension)
2140  :
2141  object (static_cast<Object>(object_dimension))
2142 {}
2143 
2144 
2145 inline
2146 GeometryPrimitive::operator unsigned int () const
2147 {
2148  return static_cast<unsigned int>(object);
2149 }
2150 
2151 
2152 
2153 namespace internal
2154 {
2155 
2156  template <int dim>
2157  inline
2158  SubfaceCase<dim>::SubfaceCase (const typename SubfacePossibilities<dim>::Possibilities subface_possibility)
2159  :
2160  value (subface_possibility)
2161  {}
2162 
2163 
2164  template <int dim>
2165  inline
2166  SubfaceCase<dim>::operator unsigned char () const
2167  {
2168  return value;
2169  }
2170 
2171 
2172 } // namespace internal
2173 
2174 
2175 template <int dim>
2176 inline
2178 RefinementCase<dim>::cut_axis (const unsigned int)
2179 {
2180  Assert (false, ExcInternalError());
2181  return static_cast<unsigned char>(-1);
2182 }
2183 
2184 
2185 template <>
2186 inline
2188 RefinementCase<1>::cut_axis (const unsigned int i)
2189 {
2190  const unsigned int dim = 1;
2191  Assert (i < dim, ExcIndexRange(i, 0, dim));
2192 
2193  static const RefinementCase options[dim] = { RefinementPossibilities<1>::cut_x };
2194  return options[i];
2195 }
2196 
2197 
2198 
2199 template <>
2200 inline
2202 RefinementCase<2>::cut_axis (const unsigned int i)
2203 {
2204  const unsigned int dim = 2;
2205  Assert (i < dim, ExcIndexRange(i, 0, dim));
2206 
2207  static const RefinementCase options[dim] = { RefinementPossibilities<2>::cut_x,
2209  };
2210  return options[i];
2211 }
2212 
2213 
2214 
2215 template <>
2216 inline
2218 RefinementCase<3>::cut_axis (const unsigned int i)
2219 {
2220  const unsigned int dim = 3;
2221  Assert (i < dim, ExcIndexRange(i, 0, dim));
2222 
2223  static const RefinementCase options[dim] = { RefinementPossibilities<3>::cut_x,
2226  };
2227  return options[i];
2228 }
2229 
2230 
2231 
2232 template <int dim>
2233 inline
2235  :
2236  value (RefinementPossibilities<dim>::no_refinement)
2237 {}
2238 
2239 
2240 
2241 template <int dim>
2242 inline
2244 RefinementCase (const typename RefinementPossibilities<dim>::Possibilities refinement_case)
2245  :
2246  value (refinement_case)
2247 {
2248  // check that only those bits of
2249  // the given argument are set that
2250  // make sense for a given space
2251  // dimension
2253  refinement_case,
2254  ExcInvalidRefinementCase (refinement_case));
2255 }
2256 
2257 
2258 
2259 template <int dim>
2260 inline
2261 RefinementCase<dim>::RefinementCase (const unsigned char refinement_case)
2262  :
2263  value (refinement_case)
2264 {
2265  // check that only those bits of
2266  // the given argument are set that
2267  // make sense for a given space
2268  // dimension
2270  refinement_case,
2271  ExcInvalidRefinementCase (refinement_case));
2272 }
2273 
2274 
2275 
2276 template <int dim>
2277 inline
2278 RefinementCase<dim>::operator unsigned char () const
2279 {
2280  return value;
2281 }
2282 
2283 
2284 
2285 template <int dim>
2286 inline
2289 {
2290  return RefinementCase<dim>(static_cast<unsigned char> (value | r.value));
2291 }
2292 
2293 
2294 
2295 template <int dim>
2296 inline
2299 {
2300  return RefinementCase<dim>(static_cast<unsigned char> (value & r.value));
2301 }
2302 
2303 
2304 
2305 template <int dim>
2306 inline
2309 {
2310  return RefinementCase<dim>(static_cast<unsigned char> (
2312 }
2313 
2314 
2315 
2316 
2317 template <int dim>
2318 inline
2319 std::size_t
2321 {
2322  return sizeof(RefinementCase<dim>);
2323 }
2324 
2325 
2326 
2327 template <int dim>
2328 template <class Archive>
2329 void RefinementCase<dim>::serialize (Archive &ar,
2330  const unsigned int)
2331 {
2332  // serialization can't deal with bitfields, so copy from/to a full sized
2333  // unsigned char
2334  unsigned char uchar_value = value;
2335  ar &uchar_value;
2336  value = uchar_value;
2337 }
2338 
2339 
2340 
2341 
2342 template <>
2343 inline
2344 Point<1>
2345 GeometryInfo<1>::unit_cell_vertex (const unsigned int vertex)
2346 {
2347  Assert (vertex < vertices_per_cell,
2348  ExcIndexRange (vertex, 0, vertices_per_cell));
2349 
2350  return Point<1>(static_cast<double>(vertex));
2351 }
2352 
2353 
2354 
2355 template <>
2356 inline
2357 Point<2>
2358 GeometryInfo<2>::unit_cell_vertex (const unsigned int vertex)
2359 {
2360  Assert (vertex < vertices_per_cell,
2361  ExcIndexRange (vertex, 0, vertices_per_cell));
2362 
2363  return Point<2>(vertex%2, vertex/2);
2364 }
2365 
2366 
2367 
2368 template <>
2369 inline
2370 Point<3>
2371 GeometryInfo<3>::unit_cell_vertex (const unsigned int vertex)
2372 {
2373  Assert (vertex < vertices_per_cell,
2374  ExcIndexRange (vertex, 0, vertices_per_cell));
2375 
2376  return Point<3>(vertex%2, vertex/2%2, vertex/4);
2377 }
2378 
2379 
2380 
2381 template <int dim>
2382 inline
2383 Point<dim>
2384 GeometryInfo<dim>::unit_cell_vertex (const unsigned int)
2385 {
2386  Assert(false, ExcNotImplemented());
2387 
2388  return Point<dim> ();
2389 }
2390 
2391 
2392 
2393 template <>
2394 inline
2395 unsigned int
2397 {
2398  Assert ((p[0] >= 0) && (p[0] <= 1), ExcInvalidCoordinate(p[0]));
2399 
2400  return (p[0] <= 0.5 ? 0 : 1);
2401 }
2402 
2403 
2404 
2405 template <>
2406 inline
2407 unsigned int
2409 {
2410  Assert ((p[0] >= 0) && (p[0] <= 1), ExcInvalidCoordinate(p[0]));
2411  Assert ((p[1] >= 0) && (p[1] <= 1), ExcInvalidCoordinate(p[1]));
2412 
2413  return (p[0] <= 0.5 ?
2414  (p[1] <= 0.5 ? 0 : 2) :
2415  (p[1] <= 0.5 ? 1 : 3));
2416 }
2417 
2418 
2419 
2420 template <>
2421 inline
2422 unsigned int
2424 {
2425  Assert ((p[0] >= 0) && (p[0] <= 1), ExcInvalidCoordinate(p[0]));
2426  Assert ((p[1] >= 0) && (p[1] <= 1), ExcInvalidCoordinate(p[1]));
2427  Assert ((p[2] >= 0) && (p[2] <= 1), ExcInvalidCoordinate(p[2]));
2428 
2429  return (p[0] <= 0.5 ?
2430  (p[1] <= 0.5 ?
2431  (p[2] <= 0.5 ? 0 : 4) :
2432  (p[2] <= 0.5 ? 2 : 6)) :
2433  (p[1] <= 0.5 ?
2434  (p[2] <= 0.5 ? 1 : 5) :
2435  (p[2] <= 0.5 ? 3 : 7)));
2436 }
2437 
2438 
2439 template <int dim>
2440 inline
2441 unsigned int
2443 {
2444  Assert(false, ExcNotImplemented());
2445 
2446  return 0;
2447 }
2448 
2449 
2450 
2451 template <>
2452 inline
2453 Point<1>
2455  const unsigned int child_index,
2456  const RefinementCase<1> refine_case)
2457 
2458 {
2459  Assert (child_index < 2,
2460  ExcIndexRange (child_index, 0, 2));
2461  Assert (refine_case==RefinementCase<1>::cut_x,
2462  ExcInternalError());
2463  (void)refine_case; // removes -Wunused-parameter warning in optimized mode
2464 
2465  return Point<1>(p*2.0-unit_cell_vertex(child_index));
2466 }
2467 
2468 
2469 
2470 template <>
2471 inline
2472 Point<2>
2474  const unsigned int child_index,
2475  const RefinementCase<2> refine_case)
2476 
2477 {
2478  Assert (child_index < GeometryInfo<2>::n_children(refine_case),
2479  ExcIndexRange (child_index, 0, GeometryInfo<2>::n_children(refine_case)));
2480 
2481  Point<2> point=p;
2482  switch (refine_case)
2483  {
2485  point[0]*=2.0;
2486  if (child_index==1)
2487  point[0]-=1.0;
2488  break;
2490  point[1]*=2.0;
2491  if (child_index==1)
2492  point[1]-=1.0;
2493  break;
2495  point*=2.0;
2496  point-=unit_cell_vertex(child_index);
2497  break;
2498  default:
2499  Assert(false, ExcInternalError());
2500  }
2501 
2502  return point;
2503 }
2504 
2505 
2506 
2507 template <>
2508 inline
2509 Point<3>
2511  const unsigned int child_index,
2512  const RefinementCase<3> refine_case)
2513 
2514 {
2515  Assert (child_index < GeometryInfo<3>::n_children(refine_case),
2516  ExcIndexRange (child_index, 0, GeometryInfo<3>::n_children(refine_case)));
2517 
2518  Point<3> point=p;
2519  // there might be a cleverer way to do
2520  // this, but since this function is called
2521  // in very few places for initialization
2522  // purposes only, I don't care at the
2523  // moment
2524  switch (refine_case)
2525  {
2527  point[0]*=2.0;
2528  if (child_index==1)
2529  point[0]-=1.0;
2530  break;
2532  point[1]*=2.0;
2533  if (child_index==1)
2534  point[1]-=1.0;
2535  break;
2537  point[2]*=2.0;
2538  if (child_index==1)
2539  point[2]-=1.0;
2540  break;
2542  point[0]*=2.0;
2543  point[1]*=2.0;
2544  if (child_index%2==1)
2545  point[0]-=1.0;
2546  if (child_index/2==1)
2547  point[1]-=1.0;
2548  break;
2550  // careful, this is slightly
2551  // different from xy and yz due to
2552  // different internal numbering of
2553  // children!
2554  point[0]*=2.0;
2555  point[2]*=2.0;
2556  if (child_index/2==1)
2557  point[0]-=1.0;
2558  if (child_index%2==1)
2559  point[2]-=1.0;
2560  break;
2562  point[1]*=2.0;
2563  point[2]*=2.0;
2564  if (child_index%2==1)
2565  point[1]-=1.0;
2566  if (child_index/2==1)
2567  point[2]-=1.0;
2568  break;
2570  point*=2.0;
2571  point-=unit_cell_vertex(child_index);
2572  break;
2573  default:
2574  Assert(false, ExcInternalError());
2575  }
2576 
2577  return point;
2578 }
2579 
2580 
2581 
2582 template <int dim>
2583 inline
2584 Point<dim>
2586  const unsigned int /*child_index*/,
2587  const RefinementCase<dim> /*refine_case*/)
2588 
2589 {
2590  AssertThrow (false, ExcNotImplemented());
2591  return Point<dim>();
2592 }
2593 
2594 
2595 
2596 template <>
2597 inline
2598 Point<1>
2600  const unsigned int child_index,
2601  const RefinementCase<1> refine_case)
2602 
2603 {
2604  Assert (child_index < 2,
2605  ExcIndexRange (child_index, 0, 2));
2606  Assert (refine_case==RefinementCase<1>::cut_x,
2607  ExcInternalError());
2608  (void)refine_case; // removes -Wunused-parameter warning in optimized mode
2609 
2610  return (p+unit_cell_vertex(child_index))*0.5;
2611 }
2612 
2613 
2614 
2615 template <>
2616 inline
2617 Point<3>
2619  const unsigned int child_index,
2620  const RefinementCase<3> refine_case)
2621 
2622 {
2623  Assert (child_index < GeometryInfo<3>::n_children(refine_case),
2624  ExcIndexRange (child_index, 0, GeometryInfo<3>::n_children(refine_case)));
2625 
2626  Point<3> point=p;
2627  // there might be a cleverer way to do
2628  // this, but since this function is called
2629  // in very few places for initialization
2630  // purposes only, I don't care at the
2631  // moment
2632  switch (refine_case)
2633  {
2635  if (child_index==1)
2636  point[0]+=1.0;
2637  point[0]*=0.5;
2638  break;
2640  if (child_index==1)
2641  point[1]+=1.0;
2642  point[1]*=0.5;
2643  break;
2645  if (child_index==1)
2646  point[2]+=1.0;
2647  point[2]*=0.5;
2648  break;
2650  if (child_index%2==1)
2651  point[0]+=1.0;
2652  if (child_index/2==1)
2653  point[1]+=1.0;
2654  point[0]*=0.5;
2655  point[1]*=0.5;
2656  break;
2658  // careful, this is slightly
2659  // different from xy and yz due to
2660  // different internal numbering of
2661  // children!
2662  if (child_index/2==1)
2663  point[0]+=1.0;
2664  if (child_index%2==1)
2665  point[2]+=1.0;
2666  point[0]*=0.5;
2667  point[2]*=0.5;
2668  break;
2670  if (child_index%2==1)
2671  point[1]+=1.0;
2672  if (child_index/2==1)
2673  point[2]+=1.0;
2674  point[1]*=0.5;
2675  point[2]*=0.5;
2676  break;
2678  point+=unit_cell_vertex(child_index);
2679  point*=0.5;
2680  break;
2681  default:
2682  Assert(false, ExcInternalError());
2683  }
2684 
2685  return point;
2686 }
2687 
2688 
2689 
2690 template <>
2691 inline
2692 Point<2>
2694  const unsigned int child_index,
2695  const RefinementCase<2> refine_case)
2696 {
2697  Assert (child_index < GeometryInfo<2>::n_children(refine_case),
2698  ExcIndexRange (child_index, 0, GeometryInfo<2>::n_children(refine_case)));
2699 
2700  Point<2> point=p;
2701  switch (refine_case)
2702  {
2704  if (child_index==1)
2705  point[0]+=1.0;
2706  point[0]*=0.5;
2707  break;
2709  if (child_index==1)
2710  point[1]+=1.0;
2711  point[1]*=0.5;
2712  break;
2714  point+=unit_cell_vertex(child_index);
2715  point*=0.5;
2716  break;
2717  default:
2718  Assert(false, ExcInternalError());
2719  }
2720 
2721  return point;
2722 }
2723 
2724 
2725 
2726 template <int dim>
2727 inline
2728 Point<dim>
2730  const unsigned int /*child_index*/,
2731  const RefinementCase<dim> /*refine_case*/)
2732 {
2733  AssertThrow (false, ExcNotImplemented());
2734  return Point<dim>();
2735 }
2736 
2737 
2738 
2739 template <>
2740 inline
2741 bool
2743 {
2744  return (p[0] >= 0.) && (p[0] <= 1.);
2745 }
2746 
2747 
2748 
2749 template <>
2750 inline
2751 bool
2753 {
2754  return (p[0] >= 0.) && (p[0] <= 1.) &&
2755  (p[1] >= 0.) && (p[1] <= 1.);
2756 }
2757 
2758 
2759 
2760 template <>
2761 inline
2762 bool
2764 {
2765  return (p[0] >= 0.) && (p[0] <= 1.) &&
2766  (p[1] >= 0.) && (p[1] <= 1.) &&
2767  (p[2] >= 0.) && (p[2] <= 1.);
2768 }
2769 
2770 template <>
2771 inline
2772 bool
2774  const double eps)
2775 {
2776  return (p[0] >= -eps) && (p[0] <= 1.+eps);
2777 }
2778 
2779 
2780 
2781 template <>
2782 inline
2783 bool
2785  const double eps)
2786 {
2787  const double l = -eps, u = 1+eps;
2788  return (p[0] >= l) && (p[0] <= u) &&
2789  (p[1] >= l) && (p[1] <= u);
2790 }
2791 
2792 
2793 
2794 template <>
2795 inline
2796 bool
2798  const double eps)
2799 {
2800  const double l = -eps, u = 1.0+eps;
2801  return (p[0] >= l) && (p[0] <= u) &&
2802  (p[1] >= l) && (p[1] <= u) &&
2803  (p[2] >= l) && (p[2] <= u);
2804 }
2805 
2806 
2807 #endif // DOXYGEN
2808 DEAL_II_NAMESPACE_CLOSE
2809 
2810 #endif
static Point< dim > child_to_cell_coordinates(const Point< dim > &p, const unsigned int child_index, const RefinementCase< dim > refine_case=RefinementCase< dim >::isotropic_refinement)
static const unsigned int unit_normal_direction[faces_per_cell]
static unsigned int standard_to_real_face_vertex(const unsigned int vertex, const bool face_orientation=true, const bool face_flip=false, const bool face_rotation=false)
static std::size_t memory_consumption()
static const unsigned int hexes_per_cell
static unsigned int child_cell_from_point(const Point< dim > &p)
static RefinementCase< 1 > line_refinement_case(const RefinementCase< dim > &cell_refinement_case, const unsigned int line_no)
static unsigned int real_to_standard_face_line(const unsigned int line, const bool face_orientation=true, const bool face_flip=false, const bool face_rotation=false)
static bool is_inside_unit_cell(const Point< dim > &p)
GeometryPrimitive(const Object object)
static unsigned int face_to_cell_vertices(const unsigned int face, const unsigned int vertex, const bool face_orientation=true, const bool face_flip=false, const bool face_rotation=false)
static const unsigned int quads_per_face
void serialize(Archive &ar, const unsigned int version)
static unsigned int line_to_cell_vertices(const unsigned int line, const unsigned int vertex)
static const unsigned int max_children_per_face
static Point< dim > cell_to_child_coordinates(const Point< dim > &p, const unsigned int child_index, const RefinementCase< dim > refine_case=RefinementCase< dim >::isotropic_refinement)
static RefinementCase< dim-1 > face_refinement_case(const RefinementCase< dim > &cell_refinement_case, const unsigned int face_no, const bool face_orientation=true, const bool face_flip=false, const bool face_rotation=false)
static Point< dim > unit_cell_vertex(const unsigned int vertex)
#define AssertThrow(cond, exc)
Definition: exceptions.h:369
static const unsigned int opposite_face[faces_per_cell]
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
static ::ExceptionBase & ExcInvalidSubfaceCase(int arg1)
static const unsigned int vertices_per_cell
RefinementCase operator~() const
static const unsigned int max_children_per_cell
static const unsigned int quads_per_cell
static const unsigned int lines_per_cell
static ::ExceptionBase & ExcInvalidSubface(int arg1, int arg2, int arg3)
RefinementCase operator|(const RefinementCase &r) const
static const unsigned int vertex_to_face[vertices_per_cell][dim]
static unsigned int n_children(const RefinementCase< dim > &refinement_case)
static const unsigned int vertices_per_face
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:564
static unsigned int face_to_cell_lines(const unsigned int face, const unsigned int line, const bool face_orientation=true, const bool face_flip=false, const bool face_rotation=false)
static unsigned int child_cell_on_face(const RefinementCase< dim > &ref_case, const unsigned int face, const unsigned int subface, const bool face_orientation=true, const bool face_flip=false, const bool face_rotation=false, const RefinementCase< dim-1 > &face_refinement_case=RefinementCase< dim-1 >::isotropic_refinement)
static const unsigned int ucd_to_deal[vertices_per_cell]
#define Assert(cond, exc)
Definition: exceptions.h:313
static double distance_to_unit_cell(const Point< dim > &p)
static ::ExceptionBase & ExcInvalidCoordinate(double arg1)
unsigned char value
RefinementCase operator&(const RefinementCase &r) const
static const unsigned int lines_per_face
static std::size_t memory_consumption()
static unsigned int standard_to_real_face_line(const unsigned int line, const bool face_orientation=true, const bool face_flip=false, const bool face_rotation=false)
static const int unit_normal_orientation[faces_per_cell]
static RefinementCase< dim > min_cell_refinement_case_for_line_refinement(const unsigned int line_no)
static void alternating_form_at_vertices(const Point< spacedim >(&vertices)[vertices_per_cell], Tensor< spacedim-dim, spacedim >(&forms)[vertices_per_cell])
SubfaceCase(const typename SubfacePossibilities< dim >::Possibilities subface_possibility)
static unsigned int n_subfaces(const internal::SubfaceCase< dim > &subface_case)
static unsigned int real_to_standard_face_vertex(const unsigned int vertex, const bool face_orientation=true, const bool face_flip=false, const bool face_rotation=false)
static Point< dim > project_to_unit_cell(const Point< dim > &p)
static const unsigned int dx_to_deal[vertices_per_cell]
static ::ExceptionBase & ExcNotImplemented()
static const unsigned int faces_per_cell
#define DeclException3(Exception3, type1, type2, type3, outsequence)
Definition: exceptions.h:588
static ::ExceptionBase & ExcInvalidRefinementCase(int arg1)
Point< 3 > point(const gp_Pnt &p)
Definition: utilities.cc:176
static Tensor< 1, dim > d_linear_shape_function_gradient(const Point< dim > &xi, const unsigned int i)
static double subface_ratio(const internal::SubfaceCase< dim > &subface_case, const unsigned int subface_no)
static RefinementCase< dim > min_cell_refinement_case_for_face_refinement(const RefinementCase< dim-1 > &face_refinement_case, const unsigned int face_no, const bool face_orientation=true, const bool face_flip=false, const bool face_rotation=false)
static RefinementCase cut_axis(const unsigned int i)
static double d_linear_shape_function(const Point< dim > &xi, const unsigned int i)
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
static ::ExceptionBase & ExcInternalError()