| 1 |
// ------------------------------------------------------------------------ |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 |
// Copyright (C) 1998 - 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_values_h |
| 16 |
#define dealii_fe_values_h |
| 17 |
|
| 18 |
|
| 19 |
#include <deal.II/base/config.h> |
| 20 |
|
| 21 |
#include <deal.II/base/derivative_form.h> |
| 22 |
#include <deal.II/base/enable_observer_pointer.h> |
| 23 |
#include <deal.II/base/exceptions.h> |
| 24 |
#include <deal.II/base/point.h> |
| 25 |
#include <deal.II/base/quadrature.h> |
| 26 |
#include <deal.II/base/std_cxx20/iota_view.h> |
| 27 |
#include <deal.II/base/symmetric_tensor.h> |
| 28 |
|
| 29 |
#include <deal.II/dofs/dof_accessor.h> |
| 30 |
#include <deal.II/dofs/dof_handler.h> |
| 31 |
|
| 32 |
#include <deal.II/fe/fe.h> |
| 33 |
#include <deal.II/fe/fe_update_flags.h> |
| 34 |
#include <deal.II/fe/fe_values_base.h> |
| 35 |
#include <deal.II/fe/fe_values_extractors.h> |
| 36 |
#include <deal.II/fe/mapping.h> |
| 37 |
#include <deal.II/fe/mapping_related_data.h> |
| 38 |
|
| 39 |
#include <deal.II/grid/tria.h> |
| 40 |
#include <deal.II/grid/tria_iterator.h> |
| 41 |
|
| 42 |
#include <deal.II/hp/q_collection.h> |
| 43 |
|
| 44 |
#include <deal.II/lac/read_vector.h> |
| 45 |
|
| 46 |
#include <algorithm> |
| 47 |
#include <memory> |
| 48 |
#include <type_traits> |
| 49 |
|
| 50 |
DEAL_II_NAMESPACE_OPEN |
| 51 |
|
| 52 |
/** |
| 53 |
* Finite element evaluated in quadrature points of a cell. |
| 54 |
* |
| 55 |
* This function implements the initialization routines for FEValuesBase, if |
| 56 |
* values in quadrature points of a cell are needed. For further documentation |
| 57 |
* see this class. |
| 58 |
* |
| 59 |
* @ingroup feaccess |
| 60 |
*/ |
| 61 |
template <int dim, int spacedim = dim> |
| 62 |
class FEValues : public FEValuesBase<dim, spacedim> |
| 63 |
{ |
| 64 |
public: |
| 65 |
/** |
| 66 |
* Dimension of the object over which we integrate. For the present class, |
| 67 |
* this is equal to <code>dim</code>. |
| 68 |
*/ |
| 69 |
static constexpr unsigned int integral_dimension = dim; |
| 70 |
|
| 71 |
/** |
| 72 |
* Constructor. Gets cell independent data from mapping and finite element |
| 73 |
* objects, matching the quadrature rule and update flags. |
| 74 |
*/ |
| 75 |
FEValues(const Mapping<dim, spacedim> &mapping, |
| 76 |
const FiniteElement<dim, spacedim> &fe, |
| 77 |
const Quadrature<dim> &quadrature, |
| 78 |
const UpdateFlags update_flags); |
| 79 |
|
| 80 |
/** |
| 81 |
* Like the function above, but taking a collection of quadrature rules. |
| 82 |
* |
| 83 |
* @note We require, in contrast to FEFaceValues, that the number of quadrature |
| 84 |
* rules in the collection is one. |
| 85 |
*/ |
| 86 |
FEValues(const Mapping<dim, spacedim> &mapping, |
| 87 |
const FiniteElement<dim, spacedim> &fe, |
| 88 |
const hp::QCollection<dim> &quadrature, |
| 89 |
const UpdateFlags update_flags); |
| 90 |
|
| 91 |
/** |
| 92 |
* Constructor. This constructor is equivalent to the other one except that |
| 93 |
* it makes the object use a $Q_1$ mapping (i.e., an object of type |
| 94 |
* MappingQ(1)) implicitly. |
| 95 |
*/ |
| 96 |
FEValues(const FiniteElement<dim, spacedim> &fe, |
| 97 |
const Quadrature<dim> &quadrature, |
| 98 |
const UpdateFlags update_flags); |
| 99 |
|
| 100 |
/** |
| 101 |
* Like the function above, but taking a collection of quadrature rules. |
| 102 |
* |
| 103 |
* @note We require, in contrast to FEFaceValues, that the number of quadrature |
| 104 |
* rules in the collection is one. |
| 105 |
*/ |
| 106 |
FEValues(const FiniteElement<dim, spacedim> &fe, |
| 107 |
const hp::QCollection<dim> &quadrature, |
| 108 |
const UpdateFlags update_flags); |
| 109 |
|
| 110 |
/** |
| 111 |
* Reinitialize the gradients, Jacobi determinants, etc for the given cell |
| 112 |
* of type "iterator into a DoFHandler object", and the finite element |
| 113 |
* associated with this object. It is assumed that the finite element used |
| 114 |
* by the given cell is also the one used by this FEValues object. |
| 115 |
*/ |
| 116 |
template <bool level_dof_access> |
| 117 |
void |
| 118 |
reinit( |
| 119 |
const TriaIterator<DoFCellAccessor<dim, spacedim, level_dof_access>> &cell); |
| 120 |
|
| 121 |
/** |
| 122 |
* Reinitialize the gradients, Jacobi determinants, etc for the given cell |
| 123 |
* of type "iterator into a Triangulation object", and the given finite |
| 124 |
* element. Since iterators into triangulation alone only convey information |
| 125 |
* about the geometry of a cell, but not about degrees of freedom possibly |
| 126 |
* associated with this cell, you will not be able to call some functions of |
| 127 |
* this class if they need information about degrees of freedom. These |
| 128 |
* functions are, above all, the |
| 129 |
* <tt>get_function_value/gradients/hessians/laplacians/third_derivatives</tt> |
| 130 |
* functions. If you want to call these functions, you have to call the @p |
| 131 |
* reinit variants that take iterators into DoFHandler or other DoF handler |
| 132 |
* type objects. |
| 133 |
*/ |
| 134 |
void |
| 135 |
reinit(const typename Triangulation<dim, spacedim>::cell_iterator &cell); |
| 136 |
|
| 137 |
/** |
| 138 |
* Return a reference to the copy of the quadrature formula stored by this |
| 139 |
* object. |
| 140 |
*/ |
| 141 |
const Quadrature<dim> & |
| 142 |
get_quadrature() const; |
| 143 |
|
| 144 |
/** |
| 145 |
* Determine an estimate for the memory consumption (in bytes) of this |
| 146 |
* object. |
| 147 |
*/ |
| 148 |
std::size_t |
| 149 |
memory_consumption() const; |
| 150 |
|
| 151 |
/** |
| 152 |
* Return a reference to this very object. |
| 153 |
* |
| 154 |
* Though it seems that it is not very useful, this function is there to |
| 155 |
* provide capability to the hp::FEValues class, in which case it provides |
| 156 |
* the FEValues object for the present cell (remember that for hp-finite |
| 157 |
* elements, the actual FE object used may change from cell to cell, so we |
| 158 |
* also need different FEValues objects for different cells; once you |
| 159 |
* reinitialize the hp::FEValues object for a specific cell, it retrieves |
| 160 |
* the FEValues object for the FE on that cell and returns it through a |
| 161 |
* function of the same name as this one; this function here therefore only |
| 162 |
* provides the same interface so that one can templatize on FEValues and |
| 163 |
* hp::FEValues). |
| 164 |
*/ |
| 165 |
const FEValues<dim, spacedim> & |
| 166 |
get_present_fe_values() const; |
| 167 |
|
| 168 |
private: |
| 169 |
/** |
| 170 |
* Store a copy of the quadrature formula here. |
| 171 |
*/ |
| 172 |
const Quadrature<dim> quadrature; |
| 173 |
|
| 174 |
/** |
| 175 |
* Do work common to the two constructors. |
| 176 |
*/ |
| 177 |
void |
| 178 |
initialize(const UpdateFlags update_flags); |
| 179 |
|
| 180 |
/** |
| 181 |
* The reinit() functions do only that part of the work that requires |
| 182 |
* knowledge of the type of iterator. After setting present_cell(), they |
| 183 |
* pass on to this function, which does the real work, and which is |
| 184 |
* independent of the actual type of the cell iterator. |
| 185 |
*/ |
| 186 |
void |
| 187 |
do_reinit(); |
| 188 |
}; |
| 189 |
|
| 190 |
|
| 191 |
/** |
| 192 |
* Extend the interface of FEValuesBase to values that only make sense when |
| 193 |
* evaluating something on the surface of a cell. All the data that is |
| 194 |
* available in the interior of cells is also available here. |
| 195 |
* |
| 196 |
* See FEValuesBase |
| 197 |
* |
| 198 |
* @ingroup feaccess |
| 199 |
*/ |
| 200 |
template <int dim, int spacedim = dim> |
| 201 |
class FEFaceValuesBase : public FEValuesBase<dim, spacedim> |
| 202 |
{ |
| 203 |
public: |
| 204 |
/** |
| 205 |
* Dimension of the object over which we integrate. For the present class, |
| 206 |
* this is equal to <code>dim-1</code>. |
| 207 |
*/ |
| 208 |
static constexpr unsigned int integral_dimension = dim - 1; |
| 209 |
|
| 210 |
/** |
| 211 |
* Constructor. Call the constructor of the base class and set up the arrays |
| 212 |
* of this class with the right sizes. Actually filling these arrays is a |
| 213 |
* duty of the derived class's constructors. |
| 214 |
* |
| 215 |
* @p n_faces_or_subfaces is the number of faces or subfaces that this |
| 216 |
* object is to store. The actual number depends on the derived class, for |
| 217 |
* FEFaceValues it is <tt>2*dim</tt>, while for the FESubfaceValues class it |
| 218 |
* is <tt>2*dim*(1<<(dim-1))</tt>, i.e. the number of faces times the number |
| 219 |
* of subfaces per face. |
| 220 |
*/ |
| 221 |
FEFaceValuesBase(const unsigned int dofs_per_cell, |
| 222 |
const UpdateFlags update_flags, |
| 223 |
const Mapping<dim, spacedim> &mapping, |
| 224 |
const FiniteElement<dim, spacedim> &fe, |
| 225 |
const Quadrature<dim - 1> &quadrature); |
| 226 |
|
| 227 |
/** |
| 228 |
* Like the function above, but taking a collection of quadrature rules. This |
| 229 |
* allows to assign each face a different quadrature rule. In the case that |
| 230 |
* the collection only contains a single face quadrature, this quadrature |
| 231 |
* rule is use on all faces. |
| 232 |
*/ |
| 233 |
FEFaceValuesBase(const unsigned int dofs_per_cell, |
| 234 |
const UpdateFlags update_flags, |
| 235 |
const Mapping<dim, spacedim> &mapping, |
| 236 |
const FiniteElement<dim, spacedim> &fe, |
| 237 |
const hp::QCollection<dim - 1> &quadrature); |
| 238 |
|
| 239 |
/** |
| 240 |
* Boundary form of the transformation of the cell at the <tt>q_point</tt>th |
| 241 |
* quadrature point. See |
| 242 |
* @ref GlossBoundaryForm. |
| 243 |
* |
| 244 |
* @dealiiRequiresUpdateFlags{update_boundary_forms} |
| 245 |
*/ |
| 246 |
const Tensor<1, spacedim> & |
| 247 |
boundary_form(const unsigned int q_point) const; |
| 248 |
|
| 249 |
/** |
| 250 |
* Return the list of outward normal vectors times the Jacobian of the |
| 251 |
* surface mapping. |
| 252 |
* |
| 253 |
* @dealiiRequiresUpdateFlags{update_boundary_forms} |
| 254 |
*/ |
| 255 |
const std::vector<Tensor<1, spacedim>> & |
| 256 |
get_boundary_forms() const; |
| 257 |
|
| 258 |
/** |
| 259 |
* Return the number of the face selected the last time the reinit() function |
| 260 |
* was called. |
| 261 |
*/ |
| 262 |
unsigned int |
| 263 |
get_face_number() const; |
| 264 |
|
| 265 |
/** |
| 266 |
* Return the index of the face selected the last time the reinit() function |
| 267 |
* was called. |
| 268 |
*/ |
| 269 |
unsigned int |
| 270 |
get_face_index() const; |
| 271 |
|
| 272 |
/** |
| 273 |
* Return a reference to the copy of the quadrature formula stored by this |
| 274 |
* object. |
| 275 |
*/ |
| 276 |
const Quadrature<dim - 1> & |
| 277 |
get_quadrature() const; |
| 278 |
|
| 279 |
/** |
| 280 |
* Determine an estimate for the memory consumption (in bytes) of this |
| 281 |
* object. |
| 282 |
*/ |
| 283 |
std::size_t |
| 284 |
memory_consumption() const; |
| 285 |
|
| 286 |
protected: |
| 287 |
/** |
| 288 |
* Number of the face selected the last time the reinit() function was |
| 289 |
* called. |
| 290 |
*/ |
| 291 |
unsigned int present_face_no; |
| 292 |
|
| 293 |
/** |
| 294 |
* Index of the face selected the last time the reinit() function was |
| 295 |
* called. |
| 296 |
*/ |
| 297 |
unsigned int present_face_index; |
| 298 |
|
| 299 |
/** |
| 300 |
* Store a copy of the quadrature formula here. |
| 301 |
*/ |
| 302 |
const hp::QCollection<dim - 1> quadrature; |
| 303 |
}; |
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
/** |
| 308 |
* Finite element evaluated in quadrature points on a face. |
| 309 |
* |
| 310 |
* This class adds the functionality of FEFaceValuesBase to FEValues; see |
| 311 |
* there for more documentation. |
| 312 |
* |
| 313 |
* Since finite element functions and their derivatives may be discontinuous |
| 314 |
* at cell boundaries, there is no restriction of this function to a mesh |
| 315 |
* face. But, there are limits of these values approaching the face from |
| 316 |
* either of the neighboring cells. |
| 317 |
* |
| 318 |
* @ingroup feaccess |
| 319 |
*/ |
| 320 |
template <int dim, int spacedim = dim> |
| 321 |
class FEFaceValues : public FEFaceValuesBase<dim, spacedim> |
| 322 |
{ |
| 323 |
public: |
| 324 |
/** |
| 325 |
* Dimension in which this object operates. |
| 326 |
*/ |
| 327 |
|
| 328 |
static constexpr unsigned int dimension = dim; |
| 329 |
|
| 330 |
static constexpr unsigned int space_dimension = spacedim; |
| 331 |
|
| 332 |
/** |
| 333 |
* Dimension of the object over which we integrate. For the present class, |
| 334 |
* this is equal to <code>dim-1</code>. |
| 335 |
*/ |
| 336 |
static constexpr unsigned int integral_dimension = dim - 1; |
| 337 |
|
| 338 |
/** |
| 339 |
* Constructor. Gets cell independent data from mapping and finite element |
| 340 |
* objects, matching the quadrature rule and update flags. |
| 341 |
*/ |
| 342 |
FEFaceValues(const Mapping<dim, spacedim> &mapping, |
| 343 |
const FiniteElement<dim, spacedim> &fe, |
| 344 |
const Quadrature<dim - 1> &quadrature, |
| 345 |
const UpdateFlags update_flags); |
| 346 |
|
| 347 |
/** |
| 348 |
* Like the function above, but taking a collection of quadrature rules. This |
| 349 |
* allows to assign each face a different quadrature rule. In the case that |
| 350 |
* the collection only contains a single face quadrature, this quadrature |
| 351 |
* rule is use on all faces. |
| 352 |
*/ |
| 353 |
FEFaceValues(const Mapping<dim, spacedim> &mapping, |
| 354 |
const FiniteElement<dim, spacedim> &fe, |
| 355 |
const hp::QCollection<dim - 1> &quadrature, |
| 356 |
const UpdateFlags update_flags); |
| 357 |
|
| 358 |
/** |
| 359 |
* Constructor. This constructor is equivalent to the other one except that |
| 360 |
* it makes the object use a $Q_1$ mapping (i.e., an object of type |
| 361 |
* MappingQ(1)) implicitly. |
| 362 |
*/ |
| 363 |
FEFaceValues(const FiniteElement<dim, spacedim> &fe, |
| 364 |
const Quadrature<dim - 1> &quadrature, |
| 365 |
const UpdateFlags update_flags); |
| 366 |
|
| 367 |
/** |
| 368 |
* Like the function above, but taking a collection of quadrature rules. This |
| 369 |
* allows to assign each face a different quadrature rule. In the case that |
| 370 |
* the collection only contains a single face quadrature, this quadrature |
| 371 |
* rule is use on all faces. |
| 372 |
*/ |
| 373 |
FEFaceValues(const FiniteElement<dim, spacedim> &fe, |
| 374 |
const hp::QCollection<dim - 1> &quadrature, |
| 375 |
const UpdateFlags update_flags); |
| 376 |
|
| 377 |
/** |
| 378 |
* Reinitialize the gradients, Jacobi determinants, etc for the face with |
| 379 |
* number @p face_no of @p cell and the given finite element. |
| 380 |
*/ |
| 381 |
template <bool level_dof_access> |
| 382 |
void |
| 383 |
reinit( |
| 384 |
const TriaIterator<DoFCellAccessor<dim, spacedim, level_dof_access>> &cell, |
| 385 |
const unsigned int face_no); |
| 386 |
|
| 387 |
/** |
| 388 |
* Reinitialize the gradients, Jacobi determinants, etc for face @p face |
| 389 |
* and cell @p cell. |
| 390 |
* |
| 391 |
* @note @p face must be one of @p cell's face iterators. |
| 392 |
*/ |
| 393 |
template <bool level_dof_access> |
| 394 |
void |
| 395 |
reinit( |
| 396 |
const TriaIterator<DoFCellAccessor<dim, spacedim, level_dof_access>> &cell, |
| 397 |
const typename Triangulation<dim, spacedim>::face_iterator &face); |
| 398 |
|
| 399 |
/** |
| 400 |
* Reinitialize the gradients, Jacobi determinants, etc for the given face |
| 401 |
* on a given cell of type "iterator into a Triangulation object", and the |
| 402 |
* given finite element. Since iterators into a triangulation alone only |
| 403 |
* convey information about the geometry of a cell, but not about degrees of |
| 404 |
* freedom possibly associated with this cell, you will not be able to call |
| 405 |
* some functions of this class if they need information about degrees of |
| 406 |
* freedom. These functions are, above all, the |
| 407 |
* <tt>get_function_value/gradients/hessians/third_derivatives</tt> |
| 408 |
* functions. If you want to call these functions, you have to call the @p |
| 409 |
* reinit variants that take iterators into DoFHandler or other DoF handler |
| 410 |
* type objects. |
| 411 |
*/ |
| 412 |
void |
| 413 |
reinit(const typename Triangulation<dim, spacedim>::cell_iterator &cell, |
| 414 |
const unsigned int face_no); |
| 415 |
|
| 416 |
/* |
| 417 |
* Reinitialize the gradients, Jacobi determinants, etc for the given face |
| 418 |
* on a given cell of type "iterator into a Triangulation object", and the |
| 419 |
* given finite element. Since iterators into a triangulation alone only |
| 420 |
* convey information about the geometry of a cell, but not about degrees of |
| 421 |
* freedom possibly associated with this cell, you will not be able to call |
| 422 |
* some functions of this class if they need information about degrees of |
| 423 |
* freedom. These functions are, above all, the |
| 424 |
* <tt>get_function_value/gradients/hessians/third_derivatives</tt> |
| 425 |
* functions. If you want to call these functions, you have to call the @p |
| 426 |
* reinit variants that take iterators into DoFHandler or other DoF handler |
| 427 |
* type objects. |
| 428 |
* |
| 429 |
* @note @p face must be one of @p cell's face iterators. |
| 430 |
*/ |
| 431 |
void |
| 432 |
reinit(const typename Triangulation<dim, spacedim>::cell_iterator &cell, |
| 433 |
const typename Triangulation<dim, spacedim>::face_iterator &face); |
| 434 |
|
| 435 |
/** |
| 436 |
* Return a reference to this very object. |
| 437 |
* |
| 438 |
* Though it seems that it is not very useful, this function is there to |
| 439 |
* provide capability to the hp::FEValues class, in which case it provides |
| 440 |
* the FEValues object for the present cell (remember that for hp-finite |
| 441 |
* elements, the actual FE object used may change from cell to cell, so we |
| 442 |
* also need different FEValues objects for different cells; once you |
| 443 |
* reinitialize the hp::FEValues object for a specific cell, it retrieves |
| 444 |
* the FEValues object for the FE on that cell and returns it through a |
| 445 |
* function of the same name as this one; this function here therefore only |
| 446 |
* provides the same interface so that one can templatize on FEValues and |
| 447 |
* hp::FEValues). |
| 448 |
*/ |
| 449 |
const FEFaceValues<dim, spacedim> & |
| 450 |
get_present_fe_values() const; |
| 451 |
|
| 452 |
private: |
| 453 |
/** |
| 454 |
* Do work common to the two constructors. |
| 455 |
*/ |
| 456 |
void |
| 457 |
initialize(const UpdateFlags update_flags); |
| 458 |
|
| 459 |
/** |
| 460 |
* The reinit() functions do only that part of the work that requires |
| 461 |
* knowledge of the type of iterator. After setting present_cell(), they |
| 462 |
* pass on to this function, which does the real work, and which is |
| 463 |
* independent of the actual type of the cell iterator. |
| 464 |
*/ |
| 465 |
void |
| 466 |
do_reinit(const unsigned int face_no); |
| 467 |
}; |
| 468 |
|
| 469 |
|
| 470 |
/** |
| 471 |
* Finite element evaluated in quadrature points on a face. |
| 472 |
* |
| 473 |
* This class adds the functionality of FEFaceValuesBase to FEValues; see |
| 474 |
* there for more documentation. |
| 475 |
* |
| 476 |
* This class is used for faces lying on a refinement edge. In this case, the |
| 477 |
* neighboring cell is refined. To be able to compute differences between |
| 478 |
* interior and exterior function values, the refinement of the neighboring |
| 479 |
* cell must be simulated on this cell. This is achieved by applying a |
| 480 |
* quadrature rule that simulates the refinement. The resulting data fields |
| 481 |
* are split up to reflect the refinement structure of the neighbor: a subface |
| 482 |
* number corresponds to the number of the child of the neighboring face. |
| 483 |
* |
| 484 |
* @ingroup feaccess |
| 485 |
*/ |
| 486 |
template <int dim, int spacedim = dim> |
| 487 |
class FESubfaceValues : public FEFaceValuesBase<dim, spacedim> |
| 488 |
{ |
| 489 |
public: |
| 490 |
/** |
| 491 |
* Dimension in which this object operates. |
| 492 |
*/ |
| 493 |
static constexpr unsigned int dimension = dim; |
| 494 |
|
| 495 |
/** |
| 496 |
* Dimension of the space in which this object operates. |
| 497 |
*/ |
| 498 |
static constexpr unsigned int space_dimension = spacedim; |
| 499 |
|
| 500 |
/** |
| 501 |
* Dimension of the object over which we integrate. For the present class, |
| 502 |
* this is equal to <code>dim-1</code>. |
| 503 |
*/ |
| 504 |
static constexpr unsigned int integral_dimension = dim - 1; |
| 505 |
|
| 506 |
/** |
| 507 |
* Constructor. Gets cell independent data from mapping and finite element |
| 508 |
* objects, matching the quadrature rule and update flags. |
| 509 |
*/ |
| 510 |
FESubfaceValues(const Mapping<dim, spacedim> &mapping, |
| 511 |
const FiniteElement<dim, spacedim> &fe, |
| 512 |
const Quadrature<dim - 1> &face_quadrature, |
| 513 |
const UpdateFlags update_flags); |
| 514 |
|
| 515 |
/** |
| 516 |
* Like the function above, but taking a collection of quadrature rules. |
| 517 |
* |
| 518 |
* @note We require, in contrast to FEFaceValues, that the number of quadrature |
| 519 |
* rules in the collection is one. |
| 520 |
*/ |
| 521 |
FESubfaceValues(const Mapping<dim, spacedim> &mapping, |
| 522 |
const FiniteElement<dim, spacedim> &fe, |
| 523 |
const hp::QCollection<dim - 1> &face_quadrature, |
| 524 |
const UpdateFlags update_flags); |
| 525 |
|
| 526 |
/** |
| 527 |
* Constructor. This constructor is equivalent to the other one except that |
| 528 |
* it makes the object use a $Q_1$ mapping (i.e., an object of type |
| 529 |
* MappingQ(1)) implicitly. |
| 530 |
*/ |
| 531 |
FESubfaceValues(const FiniteElement<dim, spacedim> &fe, |
| 532 |
const Quadrature<dim - 1> &face_quadrature, |
| 533 |
const UpdateFlags update_flags); |
| 534 |
|
| 535 |
/** |
| 536 |
* Like the function above, but taking a collection of quadrature rules. |
| 537 |
* |
| 538 |
* @note We require, in contrast to FEFaceValues, that the number of quadrature |
| 539 |
* rules in the collection is one. |
| 540 |
*/ |
| 541 |
FESubfaceValues(const FiniteElement<dim, spacedim> &fe, |
| 542 |
const hp::QCollection<dim - 1> &face_quadrature, |
| 543 |
const UpdateFlags update_flags); |
| 544 |
|
| 545 |
/** |
| 546 |
* Reinitialize the gradients, Jacobi determinants, etc for the given cell |
| 547 |
* of type "iterator into a DoFHandler object", and the finite element |
| 548 |
* associated with this object. It is assumed that the finite element used |
| 549 |
* by the given cell is also the one used by this FESubfaceValues object. |
| 550 |
*/ |
| 551 |
template <bool level_dof_access> |
| 552 |
void |
| 553 |
reinit( |
| 554 |
const TriaIterator<DoFCellAccessor<dim, spacedim, level_dof_access>> &cell, |
| 555 |
const unsigned int face_no, |
| 556 |
const unsigned int subface_no); |
| 557 |
|
| 558 |
/** |
| 559 |
* Alternative reinitialization function that takes, as arguments, iterators |
| 560 |
* to the face and subface instead of their numbers. |
| 561 |
*/ |
| 562 |
template <bool level_dof_access> |
| 563 |
void |
| 564 |
reinit( |
| 565 |
const TriaIterator<DoFCellAccessor<dim, spacedim, level_dof_access>> &cell, |
| 566 |
const typename Triangulation<dim, spacedim>::face_iterator &face, |
| 567 |
const typename Triangulation<dim, spacedim>::face_iterator &subface); |
| 568 |
|
| 569 |
/** |
| 570 |
* Reinitialize the gradients, Jacobi determinants, etc for the given |
| 571 |
* subface on a given cell of type "iterator into a Triangulation object", and |
| 572 |
* the given finite element. Since iterators into a triangulation alone only |
| 573 |
* convey information about the geometry of a cell, but not about degrees of |
| 574 |
* freedom possibly associated with this cell, you will not be able to call |
| 575 |
* some functions of this class if they need information about degrees of |
| 576 |
* freedom. These functions are, above all, the |
| 577 |
* <tt>get_function_value/gradients/hessians/third_derivatives</tt> |
| 578 |
* functions. If you want to call these functions, you have to call the @p |
| 579 |
* reinit variants that take iterators into DoFHandler or other DoF handler |
| 580 |
* type objects. |
| 581 |
*/ |
| 582 |
void |
| 583 |
reinit(const typename Triangulation<dim, spacedim>::cell_iterator &cell, |
| 584 |
const unsigned int face_no, |
| 585 |
const unsigned int subface_no); |
| 586 |
|
| 587 |
/** |
| 588 |
* Reinitialize the gradients, Jacobi determinants, etc for the given |
| 589 |
* subface on a given cell of type "iterator into a Triangulation object", and |
| 590 |
* the given finite element. Since iterators into a triangulation alone only |
| 591 |
* convey information about the geometry of a cell, but not about degrees of |
| 592 |
* freedom possibly associated with this cell, you will not be able to call |
| 593 |
* some functions of this class if they need information about degrees of |
| 594 |
* freedom. These functions are, above all, the |
| 595 |
* <tt>get_function_value/gradients/hessians/third_derivatives</tt> |
| 596 |
* functions. If you want to call these functions, you have to call the @p |
| 597 |
* reinit variants that take iterators into DoFHandler or other DoF handler |
| 598 |
* type objects. |
| 599 |
* |
| 600 |
* This does the same thing as the previous function but takes iterators |
| 601 |
* instead of numbers as arguments. |
| 602 |
* |
| 603 |
* @note @p face and @p subface must correspond to a face (and a subface of |
| 604 |
* that face) of @p cell. |
| 605 |
*/ |
| 606 |
void |
| 607 |
reinit(const typename Triangulation<dim, spacedim>::cell_iterator &cell, |
| 608 |
const typename Triangulation<dim, spacedim>::face_iterator &face, |
| 609 |
const typename Triangulation<dim, spacedim>::face_iterator &subface); |
| 610 |
|
| 611 |
/** |
| 612 |
* Return a reference to this very object. |
| 613 |
* |
| 614 |
* Though it seems that it is not very useful, this function is there to |
| 615 |
* provide capability to the hp::FEValues class, in which case it provides |
| 616 |
* the FEValues object for the present cell (remember that for hp-finite |
| 617 |
* elements, the actual FE object used may change from cell to cell, so we |
| 618 |
* also need different FEValues objects for different cells; once you |
| 619 |
* reinitialize the hp::FEValues object for a specific cell, it retrieves |
| 620 |
* the FEValues object for the FE on that cell and returns it through a |
| 621 |
* function of the same name as this one; this function here therefore only |
| 622 |
* provides the same interface so that one can templatize on FEValues and |
| 623 |
* hp::FEValues). |
| 624 |
*/ |
| 625 |
const FESubfaceValues<dim, spacedim> & |
| 626 |
get_present_fe_values() const; |
| 627 |
|
| 628 |
/** |
| 629 |
* @todo Document this |
| 630 |
* |
| 631 |
* @ingroup Exceptions |
| 632 |
*/ |
| 633 |
DeclException0(ExcReinitCalledWithBoundaryFace); |
| 634 |
|
| 635 |
/** |
| 636 |
* @todo Document this |
| 637 |
* |
| 638 |
* @ingroup Exceptions |
| 639 |
*/ |
| 640 |
DeclException0(ExcFaceHasNoSubfaces); |
| 641 |
|
| 642 |
private: |
| 643 |
/** |
| 644 |
* Do work common to the two constructors. |
| 645 |
*/ |
| 646 |
void |
| 647 |
initialize(const UpdateFlags update_flags); |
| 648 |
|
| 649 |
/** |
| 650 |
* The reinit() functions do only that part of the work that requires |
| 651 |
* knowledge of the type of iterator. After setting present_cell(), they |
| 652 |
* pass on to this function, which does the real work, and which is |
| 653 |
* independent of the actual type of the cell iterator. |
| 654 |
*/ |
| 655 |
void |
| 656 |
do_reinit(const unsigned int face_no, const unsigned int subface_no); |
| 657 |
}; |
| 658 |
|
| 659 |
|
| 660 |
#ifndef DOXYGEN |
| 661 |
|
| 662 |
|
| 663 |
/*--------------------- Inline functions: FEValues --------------------------*/ |
| 664 |
|
| 665 |
|
| 666 |
template <int dim, int spacedim> |
| 667 |
inline const Quadrature<dim> & |
| 668 |
FEValues<dim, spacedim>::get_quadrature() const |
| 669 |
{ |
| 670 |
return quadrature; |
| 671 |
} |
| 672 |
|
| 673 |
|
| 674 |
|
| 675 |
template <int dim, int spacedim> |
| 676 |
inline const FEValues<dim, spacedim> & |
| 677 |
FEValues<dim, spacedim>::get_present_fe_values() const |
| 678 |
{ |
| 679 |
return *this; |
| 680 |
} |
| 681 |
|
| 682 |
|
| 683 |
/*---------------------- Inline functions: FEFaceValuesBase -----------------*/ |
| 684 |
|
| 685 |
|
| 686 |
template <int dim, int spacedim> |
| 687 |
inline unsigned int |
| 688 |
FEFaceValuesBase<dim, spacedim>::get_face_number() const |
| 689 |
{ |
| 690 |
return present_face_no; |
| 691 |
} |
| 692 |
|
| 693 |
|
| 694 |
template <int dim, int spacedim> |
| 695 |
inline unsigned int |
| 696 |
FEFaceValuesBase<dim, spacedim>::get_face_index() const |
| 697 |
{ |
| 698 |
return present_face_index; |
| 699 |
} |
| 700 |
|
| 701 |
|
| 702 |
/*----------------------- Inline functions: FE*FaceValues -------------------*/ |
| 703 |
|
| 704 |
template <int dim, int spacedim> |
| 705 |
inline const Quadrature<dim - 1> & |
| 706 |
FEFaceValuesBase<dim, spacedim>::get_quadrature() const |
| 707 |
{ |
| 708 |
return quadrature[quadrature.size() == 1 ? 0 : present_face_no]; |
| 709 |
} |
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
template <int dim, int spacedim> |
| 714 |
inline const FEFaceValues<dim, spacedim> & |
| 715 |
FEFaceValues<dim, spacedim>::get_present_fe_values() const |
| 716 |
{ |
| 717 |
return *this; |
| 718 |
} |
| 719 |
|
| 720 |
|
| 721 |
|
| 722 |
template <int dim, int spacedim> |
| 723 |
inline const FESubfaceValues<dim, spacedim> & |
| 724 |
FESubfaceValues<dim, spacedim>::get_present_fe_values() const |
| 725 |
{ |
| 726 |
return *this; |
| 727 |
} |
| 728 |
|
| 729 |
|
| 730 |
|
| 731 |
template <int dim, int spacedim> |
| 732 |
inline const Tensor<1, spacedim> & |
| 733 |
FEFaceValuesBase<dim, spacedim>::boundary_form(const unsigned int q_point) const |
| 734 |
{ |
| 735 |
AssertIndexRange(q_point, this->mapping_output.boundary_forms.size()); |
| 736 |
Assert(this->update_flags & update_boundary_forms, |
| 737 |
(typename FEValuesBase<dim, spacedim>::ExcAccessToUninitializedField( |
| 738 |
"update_boundary_forms"))); |
| 739 |
|
| 740 |
return this->mapping_output.boundary_forms[q_point]; |
| 741 |
} |
| 742 |
|
| 743 |
#endif // DOXYGEN |
| 744 |
|
| 745 |
DEAL_II_NAMESPACE_CLOSE |
| 746 |
|
| 747 |
#endif |