Reference documentation for deal.II version 9.3.2
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
fe_point_evaluation.cc
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2021 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
18 
19 #include <deal.II/fe/fe_dgp.h>
20 #include <deal.II/fe/fe_dgq.h>
21 #include <deal.II/fe/fe_poly.h>
22 #include <deal.II/fe/fe_q_dg0.h>
23 
26 
27 #include <memory>
28 
30 
31 
32 namespace internal
33 {
34  namespace FEPointEvaluation
35  {
40  template <int dim, int spacedim>
41  bool
43  const unsigned int base_element_number)
44  {
45  // check if supported
46  const bool flag = [&]() {
47  if (dim != spacedim)
48  return false;
49 
50  const FiniteElement<dim, spacedim> *fe_ptr =
51  &(fe.base_element(base_element_number));
52  if (fe_ptr->n_components() != 1)
53  return false;
54 
55  // then check if the base element is supported or not
56  if (dynamic_cast<const FE_Poly<dim, spacedim> *>(fe_ptr) != nullptr)
57  {
58  const FE_Poly<dim, spacedim> *fe_poly_ptr =
59  dynamic_cast<const FE_Poly<dim, spacedim> *>(fe_ptr);
60 
61  if (dynamic_cast<const TensorProductPolynomials<dim> *>(
62  &fe_poly_ptr->get_poly_space()) == nullptr)
63  return false;
64  }
65  else
66  return false;
67 
68  return true;
69  }();
70 
71  // make sure that if supported also ShapeInfo is supporting it
72  if (flag)
74  fe),
76 
77  return flag;
78  }
79 
80 
81  template <int dim, int spacedim>
82  std::vector<Polynomials::Polynomial<double>>
84  {
86  const FE_Poly<dim, spacedim> *fe_poly_ptr =
87  dynamic_cast<const FE_Poly<dim, spacedim> *>(&fe);
88 
89  // we should catch the case that we cannot dynamic cast in
90  // is_fast_path_supported
91  Assert(fe_poly_ptr != nullptr, ExcNotImplemented());
92  if (const auto polyspace =
93  dynamic_cast<const TensorProductPolynomials<dim> *>(
94  &fe_poly_ptr->get_poly_space()))
95  return polyspace->get_underlying_polynomials();
96  else
97  Assert(false, ExcNotImplemented());
98  return {};
99  }
100  } // namespace FEPointEvaluation
101 } // namespace internal
102 
103 
104 // explicit instantiations
105 #include "fe_point_evaluation.inst"
106 
107 
const ScalarPolynomialsBase< dim > & get_poly_space() const
unsigned int n_components() const
virtual const FiniteElement< dim, spacedim > & base_element(const unsigned int index) const
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:396
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:397
static ::ExceptionBase & ExcInternalError()
#define Assert(cond, exc)
Definition: exceptions.h:1465
static ::ExceptionBase & ExcNotImplemented()
std::vector< Polynomials::Polynomial< double > > get_polynomial_space(const FiniteElement< dim, spacedim > &fe)
bool is_fast_path_supported(const FiniteElement< dim, spacedim > &fe, const unsigned int base_element_number)