| 1 |
// ------------------------------------------------------------------------ |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 |
// Copyright (C) 2002 - 2024 by the deal.II authors |
| 5 |
// |
| 6 |
// This file is part of the deal.II library. |
| 7 |
// |
| 8 |
// Part of the source code is dual licensed under Apache-2.0 WITH |
| 9 |
// LLVM-exception OR LGPL-2.1-or-later. Detailed license information |
| 10 |
// governing the source code and code contributions can be found in |
| 11 |
// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II. |
| 12 |
// |
| 13 |
// ------------------------------------------------------------------------ |
| 14 |
|
| 15 |
#ifndef dealii_fe_q_hierarchical_h |
| 16 |
#define dealii_fe_q_hierarchical_h |
| 17 |
|
| 18 |
#include <deal.II/base/config.h> |
| 19 |
|
| 20 |
#include <deal.II/base/tensor_product_polynomials.h> |
| 21 |
|
| 22 |
#include <deal.II/fe/fe_poly.h> |
| 23 |
|
| 24 |
DEAL_II_NAMESPACE_OPEN |
| 25 |
|
| 26 |
/** |
| 27 |
* @addtogroup fe |
| 28 |
* @{ |
| 29 |
*/ |
| 30 |
|
| 31 |
/** |
| 32 |
* Implementation of hierarchical @p Qp shape functions that yield the finite |
| 33 |
* element space of continuous, piecewise polynomials of degree @p p. This |
| 34 |
* class is realized using tensor product polynomials based on a hierarchical |
| 35 |
* basis Polynomials::Hierarchical on the interval <tt>[0,1]</tt> which is |
| 36 |
* suitable for building an @p hp tensor product finite element if we assume |
| 37 |
* that each element has a single degree. |
| 38 |
* |
| 39 |
* The constructor of this class takes the degree @p p of this finite element. |
| 40 |
* |
| 41 |
* This class is not implemented for the codimension one case (<tt>spacedim != |
| 42 |
* dim</tt>). |
| 43 |
* |
| 44 |
* <h3>Implementation</h3> |
| 45 |
* |
| 46 |
* The constructor creates a TensorProductPolynomials object that includes the |
| 47 |
* tensor product of @p Hierarchical polynomials of degree @p p. This @p |
| 48 |
* TensorProductPolynomials object provides all values and derivatives of the |
| 49 |
* shape functions. |
| 50 |
* |
| 51 |
* <h3>Numbering of the degrees of freedom (DoFs)</h3> |
| 52 |
* |
| 53 |
* The original ordering of the shape functions represented by the |
| 54 |
* TensorProductPolynomials is a tensor product numbering. However, the shape |
| 55 |
* functions on a cell are renumbered beginning with the shape functions whose |
| 56 |
* support points are at the vertices, then on the line, on the quads, and |
| 57 |
* finally (for 3d) on the hexes. To be explicit, these numberings are listed |
| 58 |
* in the following: |
| 59 |
* |
| 60 |
* <h4>Q1 elements</h4> |
| 61 |
* |
| 62 |
* The $Q_1^H$ element is of polynomial degree one and, consequently, is |
| 63 |
* exactly the same as the $Q_1$ element in class FE_Q. In particular, the |
| 64 |
* shape function are defined in the exact same way: |
| 65 |
* |
| 66 |
* <ul> |
| 67 |
* <li> 1d case: |
| 68 |
* @verbatim |
| 69 |
* 0-------1 |
| 70 |
* @endverbatim |
| 71 |
* |
| 72 |
* <li> 2d case: |
| 73 |
* @verbatim |
| 74 |
* 2-------3 |
| 75 |
* | | |
| 76 |
* | | |
| 77 |
* | | |
| 78 |
* 0-------1 |
| 79 |
* @endverbatim |
| 80 |
* |
| 81 |
* <li> 3d case: |
| 82 |
* @verbatim |
| 83 |
* 6-------7 6-------7 |
| 84 |
* /| | / /| |
| 85 |
* / | | / / | |
| 86 |
* / | | / / | |
| 87 |
* 4 | | 4-------5 | |
| 88 |
* | 2-------3 | | 3 |
| 89 |
* | / / | | / |
| 90 |
* | / / | | / |
| 91 |
* |/ / | |/ |
| 92 |
* 0-------1 0-------1 |
| 93 |
* @endverbatim |
| 94 |
* |
| 95 |
* The respective coordinate values of the support points of the degrees of |
| 96 |
* freedom are as follows: |
| 97 |
* <ul> |
| 98 |
* <li> Shape function 0: <tt>[0, 0, 0]</tt>; |
| 99 |
* <li> Shape function 1: <tt>[1, 0, 0]</tt>; |
| 100 |
* <li> Shape function 2: <tt>[0, 1, 0]</tt>; |
| 101 |
* <li> Shape function 3: <tt>[1, 1, 0]</tt>; |
| 102 |
* <li> Shape function 4: <tt>[0, 0, 1]</tt>; |
| 103 |
* <li> Shape function 5: <tt>[1, 0, 1]</tt>; |
| 104 |
* <li> Shape function 6: <tt>[0, 1, 1]</tt>; |
| 105 |
* <li> Shape function 7: <tt>[1, 1, 1]</tt>; |
| 106 |
* </ul> |
| 107 |
* </ul> |
| 108 |
* |
| 109 |
* In 2d, these shape functions look as follows: <table> <tr> <td |
| 110 |
* align="center"> |
| 111 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q1/Q1H_shape0000.png |
| 112 |
* </td> |
| 113 |
* |
| 114 |
* <td align="center"> |
| 115 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q1/Q1H_shape0001.png |
| 116 |
* </td> </tr> <tr> <td align="center"> $Q_1^H$ element, shape function 0 |
| 117 |
* </td> |
| 118 |
* |
| 119 |
* <td align="center"> $Q_1^H$ element, shape function 1 </td> </tr> |
| 120 |
* |
| 121 |
* <tr> <td align="center"> |
| 122 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q1/Q1H_shape0002.png |
| 123 |
* </td> |
| 124 |
* |
| 125 |
* <td align="center"> |
| 126 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q1/Q1H_shape0003.png |
| 127 |
* </td> </tr> <tr> <td align="center"> $Q_1^H$ element, shape function 2 |
| 128 |
* </td> |
| 129 |
* |
| 130 |
* <td align="center"> $Q_1^H$ element, shape function 3 </td> </tr> </table> |
| 131 |
* |
| 132 |
* |
| 133 |
* <h4>Q2 elements</h4> |
| 134 |
* <ul> |
| 135 |
* <li> 1d case: |
| 136 |
* @verbatim |
| 137 |
* 0---2---1 |
| 138 |
* @endverbatim |
| 139 |
* |
| 140 |
* <li> 2d case: |
| 141 |
* @verbatim |
| 142 |
* 2---7---3 |
| 143 |
* | | |
| 144 |
* 4 8 5 |
| 145 |
* | | |
| 146 |
* 0---6---1 |
| 147 |
* @endverbatim |
| 148 |
* |
| 149 |
* <li> 3d case: |
| 150 |
* @verbatim |
| 151 |
* 6--15---7 6--15---7 |
| 152 |
* /| | / /| |
| 153 |
* 12 | 19 12 1319 |
| 154 |
* / 18 | / / | |
| 155 |
* 4 | | 4---14--5 | |
| 156 |
* | 2---11--3 | | 3 |
| 157 |
* | / / | 17 / |
| 158 |
* 16 8 9 16 | 9 |
| 159 |
* |/ / | |/ |
| 160 |
* 0---10--1 0---8---1 |
| 161 |
* |
| 162 |
* *-------* *-------* |
| 163 |
* /| | / /| |
| 164 |
* / | 23 | / 25 / | |
| 165 |
* / | | / / | |
| 166 |
* * | | *-------* | |
| 167 |
* |20 *-------* | |21 * |
| 168 |
* | / / | 22 | / |
| 169 |
* | / 24 / | | / |
| 170 |
* |/ / | |/ |
| 171 |
* *-------* *-------* |
| 172 |
* @endverbatim |
| 173 |
* The center node has number 26. |
| 174 |
* |
| 175 |
* The respective coordinate values of the support points of the degrees of |
| 176 |
* freedom are as follows: |
| 177 |
* <ul> |
| 178 |
* <li> Shape function 0: <tt>[0, 0, 0]</tt>; |
| 179 |
* <li> Shape function 1: <tt>[1, 0, 0]</tt>; |
| 180 |
* <li> Shape function 2: <tt>[0, 1, 0]</tt>; |
| 181 |
* <li> Shape function 3: <tt>[1, 1, 0]</tt>; |
| 182 |
* <li> Shape function 4: <tt>[0, 0, 1]</tt>; |
| 183 |
* <li> Shape function 5: <tt>[1, 0, 1]</tt>; |
| 184 |
* <li> Shape function 6: <tt>[0, 1, 1]</tt>; |
| 185 |
* <li> Shape function 7: <tt>[1, 1, 1]</tt>; |
| 186 |
* <li> Shape function 8: <tt>[0, 1/2, 0]</tt>; |
| 187 |
* <li> Shape function 9: <tt>[1, 1/2, 0]</tt>; |
| 188 |
* <li> Shape function 10: <tt>[1/2, 0, 0]</tt>; |
| 189 |
* <li> Shape function 11: <tt>[1/2, 1, 0]</tt>; |
| 190 |
* <li> Shape function 12: <tt>[0, 1/2, 1]</tt>; |
| 191 |
* <li> Shape function 13: <tt>[1, 1/2, 1]</tt>; |
| 192 |
* <li> Shape function 14: <tt>[1/2, 0, 1]</tt>; |
| 193 |
* <li> Shape function 15: <tt>[1/2, 1, 1]</tt>; |
| 194 |
* <li> Shape function 16: <tt>[0, 0, 1/2]</tt>; |
| 195 |
* <li> Shape function 17: <tt>[1, 0, 1/2]</tt>; |
| 196 |
* <li> Shape function 18: <tt>[0, 1, 1/2]</tt>; |
| 197 |
* <li> Shape function 19: <tt>[1, 1, 1/2]</tt>; |
| 198 |
* <li> Shape function 20: <tt>[0, 1/2, 1/2]</tt>; |
| 199 |
* <li> Shape function 21: <tt>[1, 1/2, 1/2]</tt>; |
| 200 |
* <li> Shape function 22: <tt>[1/2, 0, 1/2]</tt>; |
| 201 |
* <li> Shape function 23: <tt>[1/2, 1, 1/2]</tt>; |
| 202 |
* <li> Shape function 24: <tt>[1/2, 1/2, 0]</tt>; |
| 203 |
* <li> Shape function 25: <tt>[1/2, 1/2, 1]</tt>; |
| 204 |
* <li> Shape function 26: <tt>[1/2, 1/2, 1/2]</tt>; |
| 205 |
* </ul> |
| 206 |
* </ul> |
| 207 |
* |
| 208 |
* |
| 209 |
* In 2d, these shape functions look as follows (the black plane corresponds |
| 210 |
* to zero; negative shape function values may not be visible): <table> <tr> |
| 211 |
* <td align="center"> |
| 212 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q2/Q2H_shape0000.png |
| 213 |
* </td> |
| 214 |
* |
| 215 |
* <td align="center"> |
| 216 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q2/Q2H_shape0001.png |
| 217 |
* </td> </tr> <tr> <td align="center"> $Q_2^H$ element, shape function 0 |
| 218 |
* </td> |
| 219 |
* |
| 220 |
* <td align="center"> $Q_2^H$ element, shape function 1 </td> </tr> |
| 221 |
* |
| 222 |
* <tr> <td align="center"> |
| 223 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q2/Q2H_shape0002.png |
| 224 |
* </td> |
| 225 |
* |
| 226 |
* <td align="center"> |
| 227 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q2/Q2H_shape0003.png |
| 228 |
* </td> </tr> <tr> <td align="center"> $Q_2^H$ element, shape function 2 |
| 229 |
* </td> |
| 230 |
* |
| 231 |
* <td align="center"> $Q_2^H$ element, shape function 3 </td> </tr> |
| 232 |
* |
| 233 |
* <tr> <td align="center"> |
| 234 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q2/Q2H_shape0004.png |
| 235 |
* </td> |
| 236 |
* |
| 237 |
* <td align="center"> |
| 238 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q2/Q2H_shape0005.png |
| 239 |
* </td> </tr> <tr> <td align="center"> $Q_2^H$ element, shape function 4 |
| 240 |
* </td> |
| 241 |
* |
| 242 |
* <td align="center"> $Q_2^H$ element, shape function 5 </td> </tr> |
| 243 |
* |
| 244 |
* <tr> <td align="center"> |
| 245 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q2/Q2H_shape0006.png |
| 246 |
* </td> |
| 247 |
* |
| 248 |
* <td align="center"> |
| 249 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q2/Q2H_shape0007.png |
| 250 |
* </td> </tr> <tr> <td align="center"> $Q_2^H$ element, shape function 6 |
| 251 |
* </td> |
| 252 |
* |
| 253 |
* <td align="center"> $Q_2^H$ element, shape function 7 </td> </tr> |
| 254 |
* |
| 255 |
* <tr> <td align="center"> |
| 256 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q2/Q2H_shape0008.png |
| 257 |
* </td> |
| 258 |
* |
| 259 |
* <td align="center"> </td> </tr> <tr> <td align="center"> $Q_2^H$ element, |
| 260 |
* shape function 8 </td> |
| 261 |
* |
| 262 |
* <td align="center"> </td> </tr> </table> |
| 263 |
* |
| 264 |
* |
| 265 |
* <h4>Q3 elements</h4> |
| 266 |
* <ul> |
| 267 |
* <li> 1d case: |
| 268 |
* @verbatim |
| 269 |
* 0--2--3--1 |
| 270 |
* @endverbatim |
| 271 |
* |
| 272 |
* <li> 2d case: |
| 273 |
* @verbatim |
| 274 |
* 2--10-11-3 |
| 275 |
* | | |
| 276 |
* 5 14 15 7 |
| 277 |
* | | |
| 278 |
* 4 12 13 6 |
| 279 |
* | | |
| 280 |
* 0--8--9--1 |
| 281 |
* @endverbatim |
| 282 |
* </ul> |
| 283 |
* |
| 284 |
* In 2d, these shape functions look as follows (the black plane corresponds |
| 285 |
* to zero; negative shape function values may not be visible): <table> <tr> |
| 286 |
* <td align="center"> |
| 287 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q3/Q3H_shape0000.png |
| 288 |
* </td> |
| 289 |
* |
| 290 |
* <td align="center"> |
| 291 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q3/Q3H_shape0001.png |
| 292 |
* </td> </tr> <tr> <td align="center"> $Q_3^H$ element, shape function 0 |
| 293 |
* </td> |
| 294 |
* |
| 295 |
* <td align="center"> $Q_3^H$ element, shape function 1 </td> </tr> |
| 296 |
* |
| 297 |
* <tr> <td align="center"> |
| 298 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q3/Q3H_shape0002.png |
| 299 |
* </td> |
| 300 |
* |
| 301 |
* <td align="center"> |
| 302 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q3/Q3H_shape0003.png |
| 303 |
* </td> </tr> <tr> <td align="center"> $Q_3^H$ element, shape function 2 |
| 304 |
* </td> |
| 305 |
* |
| 306 |
* <td align="center"> $Q_3^H$ element, shape function 3 </td> </tr> |
| 307 |
* |
| 308 |
* <tr> <td align="center"> |
| 309 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q3/Q3H_shape0004.png |
| 310 |
* </td> |
| 311 |
* |
| 312 |
* <td align="center"> |
| 313 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q3/Q3H_shape0005.png |
| 314 |
* </td> </tr> <tr> <td align="center"> $Q_3^H$ element, shape function 4 |
| 315 |
* </td> |
| 316 |
* |
| 317 |
* <td align="center"> $Q_3^H$ element, shape function 5 </td> </tr> |
| 318 |
* |
| 319 |
* <tr> <td align="center"> |
| 320 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q3/Q3H_shape0006.png |
| 321 |
* </td> |
| 322 |
* |
| 323 |
* <td align="center"> |
| 324 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q3/Q3H_shape0007.png |
| 325 |
* </td> </tr> <tr> <td align="center"> $Q_3^H$ element, shape function 6 |
| 326 |
* </td> |
| 327 |
* |
| 328 |
* <td align="center"> $Q_3^H$ element, shape function 7 </td> </tr> |
| 329 |
* |
| 330 |
* <tr> <td align="center"> |
| 331 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q3/Q3H_shape0008.png |
| 332 |
* </td> |
| 333 |
* |
| 334 |
* <td align="center"> |
| 335 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q3/Q3H_shape0009.png |
| 336 |
* </td> </tr> <tr> <td align="center"> $Q_3^H$ element, shape function 8 |
| 337 |
* </td> |
| 338 |
* |
| 339 |
* <td align="center"> $Q_3^H$ element, shape function 9 </td> </tr> |
| 340 |
* |
| 341 |
* <tr> <td align="center"> |
| 342 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q3/Q3H_shape0010.png |
| 343 |
* </td> |
| 344 |
* |
| 345 |
* <td align="center"> |
| 346 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q3/Q3H_shape0011.png |
| 347 |
* </td> </tr> <tr> <td align="center"> $Q_3^H$ element, shape function 10 |
| 348 |
* </td> |
| 349 |
* |
| 350 |
* <td align="center"> $Q_3^H$ element, shape function 11 </td> </tr> |
| 351 |
* |
| 352 |
* <tr> <td align="center"> |
| 353 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q3/Q3H_shape0012.png |
| 354 |
* </td> |
| 355 |
* |
| 356 |
* <td align="center"> |
| 357 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q3/Q3H_shape0013.png |
| 358 |
* </td> </tr> <tr> <td align="center"> $Q_3^H$ element, shape function 12 |
| 359 |
* </td> |
| 360 |
* |
| 361 |
* <td align="center"> $Q_3^H$ element, shape function 13 </td> </tr> |
| 362 |
* |
| 363 |
* <tr> <td align="center"> |
| 364 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q3/Q3H_shape0014.png |
| 365 |
* </td> |
| 366 |
* |
| 367 |
* <td align="center"> |
| 368 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q3/Q3H_shape0015.png |
| 369 |
* </td> </tr> <tr> <td align="center"> $Q_3^H$ element, shape function 14 |
| 370 |
* </td> |
| 371 |
* |
| 372 |
* <td align="center"> $Q_3^H$ element, shape function 15 </td> </tr> </table> |
| 373 |
* |
| 374 |
* |
| 375 |
* <h4>Q4 elements</h4> |
| 376 |
* <ul> |
| 377 |
* <li> 1d case: |
| 378 |
* @verbatim |
| 379 |
* 0--2--3--4--1 |
| 380 |
* @endverbatim |
| 381 |
* |
| 382 |
* <li> 2d case: |
| 383 |
* @verbatim |
| 384 |
* 2--13-14-15-3 |
| 385 |
* | | |
| 386 |
* 6 22 23 24 9 |
| 387 |
* | | |
| 388 |
* 5 19 20 21 8 |
| 389 |
* | | |
| 390 |
* 4 16 17 18 7 |
| 391 |
* | | |
| 392 |
* 0--10-11-12-1 |
| 393 |
* @endverbatim |
| 394 |
* </ul> |
| 395 |
* |
| 396 |
* In 2d, these shape functions look as follows (the black plane corresponds |
| 397 |
* to zero; negative shape function values may not be visible): <table> <tr> |
| 398 |
* <td align="center"> |
| 399 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0000.png |
| 400 |
* </td> |
| 401 |
* |
| 402 |
* <td align="center"> |
| 403 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0001.png |
| 404 |
* </td> </tr> <tr> <td align="center"> $Q_4^H$ element, shape function 0 |
| 405 |
* </td> |
| 406 |
* |
| 407 |
* <td align="center"> $Q_4^H$ element, shape function 1 </td> </tr> |
| 408 |
* |
| 409 |
* <tr> <td align="center"> |
| 410 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0002.png |
| 411 |
* </td> |
| 412 |
* |
| 413 |
* <td align="center"> |
| 414 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0003.png |
| 415 |
* </td> </tr> <tr> <td align="center"> $Q_4^H$ element, shape function 2 |
| 416 |
* </td> |
| 417 |
* |
| 418 |
* <td align="center"> $Q_4^H$ element, shape function 3 </td> </tr> |
| 419 |
* |
| 420 |
* <tr> <td align="center"> |
| 421 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0004.png |
| 422 |
* </td> |
| 423 |
* |
| 424 |
* <td align="center"> |
| 425 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0005.png |
| 426 |
* </td> </tr> <tr> <td align="center"> $Q_4^H$ element, shape function 4 |
| 427 |
* </td> |
| 428 |
* |
| 429 |
* <td align="center"> $Q_4^H$ element, shape function 5 </td> </tr> |
| 430 |
* |
| 431 |
* <tr> <td align="center"> |
| 432 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0006.png |
| 433 |
* </td> |
| 434 |
* |
| 435 |
* <td align="center"> |
| 436 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0007.png |
| 437 |
* </td> </tr> <tr> <td align="center"> $Q_4^H$ element, shape function 6 |
| 438 |
* </td> |
| 439 |
* |
| 440 |
* <td align="center"> $Q_4^H$ element, shape function 7 </td> </tr> |
| 441 |
* |
| 442 |
* <tr> <td align="center"> |
| 443 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0008.png |
| 444 |
* </td> |
| 445 |
* |
| 446 |
* <td align="center"> |
| 447 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0009.png |
| 448 |
* </td> </tr> <tr> <td align="center"> $Q_4^H$ element, shape function 8 |
| 449 |
* </td> |
| 450 |
* |
| 451 |
* <td align="center"> $Q_4^H$ element, shape function 9 </td> </tr> |
| 452 |
* |
| 453 |
* <tr> <td align="center"> |
| 454 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0010.png |
| 455 |
* </td> |
| 456 |
* |
| 457 |
* <td align="center"> |
| 458 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0011.png |
| 459 |
* </td> </tr> <tr> <td align="center"> $Q_4^H$ element, shape function 10 |
| 460 |
* </td> |
| 461 |
* |
| 462 |
* <td align="center"> $Q_4^H$ element, shape function 11 </td> </tr> |
| 463 |
* |
| 464 |
* <tr> <td align="center"> |
| 465 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0012.png |
| 466 |
* </td> |
| 467 |
* |
| 468 |
* <td align="center"> |
| 469 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0013.png |
| 470 |
* </td> </tr> <tr> <td align="center"> $Q_4^H$ element, shape function 12 |
| 471 |
* </td> |
| 472 |
* |
| 473 |
* <td align="center"> $Q_4^H$ element, shape function 13 </td> </tr> |
| 474 |
* |
| 475 |
* <tr> <td align="center"> |
| 476 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0014.png |
| 477 |
* </td> |
| 478 |
* |
| 479 |
* <td align="center"> |
| 480 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0015.png |
| 481 |
* </td> </tr> <tr> <td align="center"> $Q_4^H$ element, shape function 14 |
| 482 |
* </td> |
| 483 |
* |
| 484 |
* <td align="center"> $Q_4^H$ element, shape function 15 </td> </tr> |
| 485 |
* |
| 486 |
* <tr> <td align="center"> |
| 487 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0016.png |
| 488 |
* </td> |
| 489 |
* |
| 490 |
* <td align="center"> |
| 491 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0017.png |
| 492 |
* </td> </tr> <tr> <td align="center"> $Q_4^H$ element, shape function 16 |
| 493 |
* </td> |
| 494 |
* |
| 495 |
* <td align="center"> $Q_4^H$ element, shape function 17 </td> </tr> |
| 496 |
* |
| 497 |
* <tr> <td align="center"> |
| 498 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0018.png |
| 499 |
* </td> |
| 500 |
* |
| 501 |
* <td align="center"> |
| 502 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0019.png |
| 503 |
* </td> </tr> <tr> <td align="center"> $Q_4^H$ element, shape function 18 |
| 504 |
* </td> |
| 505 |
* |
| 506 |
* <td align="center"> $Q_4^H$ element, shape function 19 </td> </tr> |
| 507 |
* |
| 508 |
* <tr> <td align="center"> |
| 509 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0020.png |
| 510 |
* </td> |
| 511 |
* |
| 512 |
* <td align="center"> |
| 513 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0021.png |
| 514 |
* </td> </tr> <tr> <td align="center"> $Q_4^H$ element, shape function 20 |
| 515 |
* </td> |
| 516 |
* |
| 517 |
* <td align="center"> $Q_4^H$ element, shape function 21 </td> </tr> |
| 518 |
* |
| 519 |
* <tr> <td align="center"> |
| 520 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0022.png |
| 521 |
* </td> |
| 522 |
* |
| 523 |
* <td align="center"> |
| 524 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0023.png |
| 525 |
* </td> </tr> <tr> <td align="center"> $Q_4^H$ element, shape function 22 |
| 526 |
* </td> |
| 527 |
* |
| 528 |
* <td align="center"> $Q_4^H$ element, shape function 23 </td> </tr> |
| 529 |
* |
| 530 |
* <tr> <td align="center"> |
| 531 |
* @image html http://www.dealii.org/images/shape-functions/hierarchical/Q4/Q4H_shape0024.png |
| 532 |
* </td> |
| 533 |
* |
| 534 |
* <td align="center"> </td> </tr> <tr> <td align="center"> $Q_4^H$ element, |
| 535 |
* shape function 24 </td> |
| 536 |
* |
| 537 |
* <td align="center"> </td> </tr> </table> |
| 538 |
*/ |
| 539 |
template <int dim> |
| 540 |
class FE_Q_Hierarchical : public FE_Poly<dim> |
| 541 |
{ |
| 542 |
public: |
| 543 |
/** |
| 544 |
* Constructor for tensor product polynomials of degree @p p. |
| 545 |
*/ |
| 546 |
FE_Q_Hierarchical(const unsigned int p); |
| 547 |
|
| 548 |
/** |
| 549 |
* Return a string that uniquely identifies a finite element. This class |
| 550 |
* returns <tt>FE_Q_Hierarchical<dim>(degree)</tt>, with @p dim and @p |
| 551 |
* degree replaced by appropriate values. |
| 552 |
*/ |
| 553 |
virtual std::string |
| 554 |
get_name() const override; |
| 555 |
|
| 556 |
virtual std::unique_ptr<FiniteElement<dim, dim>> |
| 557 |
clone() const override; |
| 558 |
|
| 559 |
/** |
| 560 |
* This function returns @p true, if the shape function @p shape_index has |
| 561 |
* non-zero function values somewhere on the face @p face_index. |
| 562 |
*/ |
| 563 |
virtual bool |
| 564 |
has_support_on_face(const unsigned int shape_index, |
| 565 |
const unsigned int face_index) const override; |
| 566 |
|
| 567 |
/** |
| 568 |
* @name Functions to support hp |
| 569 |
* @{ |
| 570 |
*/ |
| 571 |
|
| 572 |
/** |
| 573 |
* Return whether this element implements its hanging node constraints in |
| 574 |
* the new way, which has to be used to make elements "hp-compatible". |
| 575 |
* |
| 576 |
* For the FE_Q_Hierarchical class the result is always true (independent of |
| 577 |
* the degree of the element), as it implements the complete set of |
| 578 |
* functions necessary for hp-capability. |
| 579 |
*/ |
| 580 |
virtual bool |
| 581 |
hp_constraints_are_implemented() const override; |
| 582 |
|
| 583 |
/** |
| 584 |
* Return the matrix interpolating from the given finite element to the |
| 585 |
* present one. Interpolation only between FE_Q_Hierarchical is supported. |
| 586 |
*/ |
| 587 |
virtual void |
| 588 |
get_interpolation_matrix(const FiniteElement<dim> &source, |
| 589 |
FullMatrix<double> &matrix) const override; |
| 590 |
|
| 591 |
/** |
| 592 |
* Embedding matrix between grids. Only isotropic refinement is supported. |
| 593 |
*/ |
| 594 |
virtual const FullMatrix<double> & |
| 595 |
get_prolongation_matrix( |
| 596 |
const unsigned int child, |
| 597 |
const RefinementCase<dim> &refinement_case = |
| 598 |
RefinementCase<dim>::isotropic_refinement) const override; |
| 599 |
|
| 600 |
/** |
| 601 |
* If, on a vertex, several finite elements are active, the hp-code first |
| 602 |
* assigns the degrees of freedom of each of these FEs different global |
| 603 |
* indices. It then calls this function to find out which of them should get |
| 604 |
* identical values, and consequently can receive the same global DoF index. |
| 605 |
* This function therefore returns a list of identities between DoFs of the |
| 606 |
* present finite element object with the DoFs of @p fe_other, which is a |
| 607 |
* reference to a finite element object representing one of the other finite |
| 608 |
* elements active on this particular vertex. The function computes which of |
| 609 |
* the degrees of freedom of the two finite element objects are equivalent, |
| 610 |
* both numbered between zero and the corresponding value of |
| 611 |
* n_dofs_per_vertex() of the two finite elements. The first index of each |
| 612 |
* pair denotes one of the vertex dofs of the present element, whereas the |
| 613 |
* second is the corresponding index of the other finite element. |
| 614 |
*/ |
| 615 |
virtual std::vector<std::pair<unsigned int, unsigned int>> |
| 616 |
hp_vertex_dof_identities(const FiniteElement<dim> &fe_other) const override; |
| 617 |
|
| 618 |
/** |
| 619 |
* Same as above but for lines. |
| 620 |
*/ |
| 621 |
virtual std::vector<std::pair<unsigned int, unsigned int>> |
| 622 |
hp_line_dof_identities(const FiniteElement<dim> &fe_other) const override; |
| 623 |
|
| 624 |
/** |
| 625 |
* Same as above but for faces. |
| 626 |
*/ |
| 627 |
virtual std::vector<std::pair<unsigned int, unsigned int>> |
| 628 |
hp_quad_dof_identities(const FiniteElement<dim> &fe_other, |
| 629 |
const unsigned int face_no = 0) const override; |
| 630 |
|
| 631 |
/** |
| 632 |
* @copydoc FiniteElement::compare_for_domination() |
| 633 |
*/ |
| 634 |
virtual FiniteElementDomination::Domination |
| 635 |
compare_for_domination(const FiniteElement<dim> &fe_other, |
| 636 |
const unsigned int codim = 0) const override final; |
| 637 |
|
| 638 |
/** @} */ |
| 639 |
|
| 640 |
/** |
| 641 |
* Return the matrix interpolating from a face of one element to the face of |
| 642 |
* the neighboring element. The size of the matrix is then |
| 643 |
* <tt>source.dofs_per_face</tt> times <tt>this->dofs_per_face</tt>. |
| 644 |
* |
| 645 |
* Derived elements will have to implement this function. They may only |
| 646 |
* provide interpolation matrices for certain source finite elements, for |
| 647 |
* example those from the same family. If they don't implement interpolation |
| 648 |
* from a given element, then they must throw an exception of type |
| 649 |
* <tt>FiniteElement<dim>::ExcInterpolationNotImplemented</tt>. |
| 650 |
*/ |
| 651 |
virtual void |
| 652 |
get_face_interpolation_matrix(const FiniteElement<dim> &source, |
| 653 |
FullMatrix<double> &matrix, |
| 654 |
const unsigned int face_no = 0) const override; |
| 655 |
|
| 656 |
/** |
| 657 |
* Return the matrix interpolating from a face of one element to the subface |
| 658 |
* of the neighboring element. The size of the matrix is then |
| 659 |
* <tt>source.dofs_per_face</tt> times <tt>this->dofs_per_face</tt>. |
| 660 |
* |
| 661 |
* Derived elements will have to implement this function. They may only |
| 662 |
* provide interpolation matrices for certain source finite elements, for |
| 663 |
* example those from the same family. If they don't implement interpolation |
| 664 |
* from a given element, then they must throw an exception of type |
| 665 |
* <tt>ExcInterpolationNotImplemented</tt>. |
| 666 |
*/ |
| 667 |
virtual void |
| 668 |
get_subface_interpolation_matrix( |
| 669 |
const FiniteElement<dim> &source, |
| 670 |
const unsigned int subface, |
| 671 |
FullMatrix<double> &matrix, |
| 672 |
const unsigned int face_no = 0) const override; |
| 673 |
|
| 674 |
/** |
| 675 |
* Determine an estimate for the memory consumption (in bytes) of this |
| 676 |
* object. |
| 677 |
* |
| 678 |
* This function is made virtual, since finite element objects are usually |
| 679 |
* accessed through pointers to their base class, rather than the class |
| 680 |
* itself. |
| 681 |
*/ |
| 682 |
virtual std::size_t |
| 683 |
memory_consumption() const override; |
| 684 |
|
| 685 |
/** |
| 686 |
* For a finite element of degree @p sub_degree < @p degree, we return a |
| 687 |
* vector which maps the numbering on an FE of degree @p sub_degree into the |
| 688 |
* numbering on this element. |
| 689 |
*/ |
| 690 |
std::vector<unsigned int> |
| 691 |
get_embedding_dofs(const unsigned int sub_degree) const; |
| 692 |
|
| 693 |
/** |
| 694 |
* Return a list of constant modes of the element. For this element, the |
| 695 |
* list consists of true arguments for the first vertex shape functions and |
| 696 |
* false for the remaining ones. |
| 697 |
*/ |
| 698 |
virtual std::pair<Table<2, bool>, std::vector<unsigned int>> |
| 699 |
get_constant_modes() const override; |
| 700 |
|
| 701 |
private: |
| 702 |
/** |
| 703 |
* Only for internal use. Its full name is @p get_dofs_per_object_vector |
| 704 |
* function and it creates the @p dofs_per_object vector that is needed |
| 705 |
* within the constructor to be passed to the constructor of @p |
| 706 |
* FiniteElementData. |
| 707 |
*/ |
| 708 |
static std::vector<unsigned int> |
| 709 |
get_dpo_vector(const unsigned int degree); |
| 710 |
|
| 711 |
/** |
| 712 |
* The numbering of the degrees of freedom in continuous finite elements is |
| 713 |
* hierarchic, i.e. in such a way that we first number the vertex dofs, in |
| 714 |
* the order of the vertices as defined by the triangulation, then the line |
| 715 |
* dofs in the order and respecting the direction of the lines, then the |
| 716 |
* dofs on quads, etc. |
| 717 |
* |
| 718 |
* The dofs associated with 1d hierarchical polynomials are ordered with the |
| 719 |
* vertices first ($phi_0(x)=1-x$ and $phi_1(x)=x$) and then the line dofs |
| 720 |
* (the higher degree polynomials). The 2d and 3d hierarchical polynomials |
| 721 |
* originate from the 1d hierarchical polynomials by tensor product. In the |
| 722 |
* following, the resulting numbering of dofs will be denoted by |
| 723 |
* `fe_q_hierarchical numbering`. |
| 724 |
* |
| 725 |
* This function constructs a table which fe_q_hierarchical index each |
| 726 |
* degree of freedom in the hierarchic numbering would have. |
| 727 |
* |
| 728 |
* This function is analogous to the |
| 729 |
* FETools::hierarchic_to_lexicographic_numbering() function. However, in |
| 730 |
* contrast to the fe_q_hierarchical numbering defined above, the |
| 731 |
* lexicographic numbering originates from the tensor products of |
| 732 |
* consecutive numbered dofs (like for LagrangeEquidistant). |
| 733 |
* |
| 734 |
* It is assumed that the size of the output argument already matches the |
| 735 |
* correct size, which is equal to the number of degrees of freedom in the |
| 736 |
* finite element. |
| 737 |
*/ |
| 738 |
static std::vector<unsigned int> |
| 739 |
hierarchic_to_fe_q_hierarchical_numbering(const FiniteElementData<dim> &fe); |
| 740 |
|
| 741 |
/** |
| 742 |
* This is an analogon to the previous function, but working on faces. |
| 743 |
*/ |
| 744 |
static std::vector<unsigned int> |
| 745 |
face_fe_q_hierarchical_to_hierarchic_numbering(const unsigned int degree); |
| 746 |
|
| 747 |
/** |
| 748 |
* Initialize two auxiliary fields that will be used in setting up the |
| 749 |
* various matrices in the constructor. |
| 750 |
*/ |
| 751 |
void |
| 752 |
build_dofs_cell(std::vector<FullMatrix<double>> &dofs_cell, |
| 753 |
std::vector<FullMatrix<double>> &dofs_subcell) const; |
| 754 |
|
| 755 |
/** |
| 756 |
* Initialize the hanging node constraints matrices. Called from the |
| 757 |
* constructor. |
| 758 |
*/ |
| 759 |
void |
| 760 |
initialize_constraints(const std::vector<FullMatrix<double>> &dofs_subcell); |
| 761 |
|
| 762 |
/** |
| 763 |
* Initialize the embedding matrices. Called from the constructor. |
| 764 |
*/ |
| 765 |
void |
| 766 |
initialize_embedding_and_restriction( |
| 767 |
const std::vector<FullMatrix<double>> &dofs_cell, |
| 768 |
const std::vector<FullMatrix<double>> &dofs_subcell); |
| 769 |
|
| 770 |
/** |
| 771 |
* Initialize the @p generalized_support_points field of the FiniteElement class. |
| 772 |
* Called from the constructor. |
| 773 |
*/ |
| 774 |
void |
| 775 |
initialize_generalized_support_points(); |
| 776 |
|
| 777 |
/** |
| 778 |
* Initialize the @p generalized_face_support_points field of the FiniteElement |
| 779 |
* class. Called from the constructor. |
| 780 |
*/ |
| 781 |
void |
| 782 |
initialize_generalized_face_support_points(); |
| 783 |
|
| 784 |
/** |
| 785 |
* Mapping from lexicographic to shape function numbering on first face. |
| 786 |
*/ |
| 787 |
const std::vector<unsigned int> face_renumber; |
| 788 |
|
| 789 |
// Allow access from other dimensions. We need this since we want to call |
| 790 |
// the functions @p get_dpo_vector and @p |
| 791 |
// lexicographic_to_hierarchic_numbering for the faces of the finite element |
| 792 |
// of dimension dim+1. |
| 793 |
template <int dim1> |
| 794 |
friend class FE_Q_Hierarchical; |
| 795 |
}; |
| 796 |
|
| 797 |
/** @} */ |
| 798 |
|
| 799 |
/* -------------- declaration of explicit specializations ------------- */ |
| 800 |
|
| 801 |
template <> |
| 802 |
void |
| 803 |
FE_Q_Hierarchical<1>::initialize_generalized_face_support_points(); |
| 804 |
|
| 805 |
template <> |
| 806 |
bool |
| 807 |
FE_Q_Hierarchical<1>::has_support_on_face(const unsigned int, |
| 808 |
const unsigned int) const; |
| 809 |
|
| 810 |
template <> |
| 811 |
std::vector<unsigned int> |
| 812 |
FE_Q_Hierarchical<1>::face_fe_q_hierarchical_to_hierarchic_numbering( |
| 813 |
const unsigned int); |
| 814 |
|
| 815 |
DEAL_II_NAMESPACE_CLOSE |
| 816 |
|
| 817 |
#endif |