Reference documentation for deal.II version 9.0.0
fe_poly_face.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2009 - 2018 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_fe_poly_face_h
17 #define dealii_fe_poly_face_h
18 
19 
20 #include <deal.II/base/qprojector.h>
21 #include <deal.II/base/std_cxx14/memory.h>
22 #include <deal.II/fe/fe.h>
23 
24 
25 DEAL_II_NAMESPACE_OPEN
26 
29 
55 template <class PolynomialType, int dim=PolynomialType::dimension+1, int spacedim=dim>
56 class FE_PolyFace : public FiniteElement<dim,spacedim>
57 {
58 public:
62  FE_PolyFace (const PolynomialType &poly_space,
63  const FiniteElementData<dim> &fe_data,
64  const std::vector<bool> &restriction_is_additive_flags);
65 
70  unsigned int get_degree () const;
71 
72  // for documentation, see the FiniteElement base class
73  virtual
75  requires_update_flags (const UpdateFlags update_flags) const;
76 
77 protected:
78  /*
79  * NOTE: The following functions have their definitions inlined into the class declaration
80  * because we otherwise run into a compiler error with MS Visual Studio.
81  */
82 
83 
84  virtual
85  std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
86  get_data (const UpdateFlags /*update_flags*/,
87  const Mapping<dim,spacedim> &/*mapping*/,
88  const Quadrature<dim> &/*quadrature*/,
90  {
91  return std_cxx14::make_unique<InternalData>();
92  }
93 
94  std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
95  get_face_data(const UpdateFlags update_flags,
96  const Mapping<dim,spacedim> &/*mapping*/,
97  const Quadrature<dim-1> &quadrature,
99  {
100  // generate a new data object and
101  // initialize some fields
102  auto data = std_cxx14::make_unique<InternalData>();
103  data->update_each = requires_update_flags(update_flags);
104 
105  const unsigned int n_q_points = quadrature.size();
106 
107  // some scratch arrays
108  std::vector<double> values(0);
109  std::vector<Tensor<1,dim-1> > grads(0);
110  std::vector<Tensor<2,dim-1> > grad_grads(0);
111  std::vector<Tensor<3,dim-1> > empty_vector_of_3rd_order_tensors;
112  std::vector<Tensor<4,dim-1> > empty_vector_of_4th_order_tensors;
113 
114  // initialize fields only if really
115  // necessary. otherwise, don't
116  // allocate memory
117  if (data->update_each & update_values)
118  {
119  values.resize (poly_space.n());
120  data->shape_values.resize (poly_space.n(),
121  std::vector<double> (n_q_points));
122  for (unsigned int i=0; i<n_q_points; ++i)
123  {
124  poly_space.compute(quadrature.point(i),
125  values, grads, grad_grads,
126  empty_vector_of_3rd_order_tensors,
127  empty_vector_of_4th_order_tensors);
128 
129  for (unsigned int k=0; k<poly_space.n(); ++k)
130  data->shape_values[k][i] = values[k];
131  }
132  }
133  // No derivatives of this element
134  // are implemented.
135  if (data->update_each & update_gradients || data->update_each & update_hessians)
136  {
137  Assert(false, ExcNotImplemented());
138  }
139 
140  return std::move(data);
141  }
142 
143  std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
144  get_subface_data(const UpdateFlags update_flags,
145  const Mapping<dim,spacedim> &mapping,
146  const Quadrature<dim-1> &quadrature,
148  {
149  return get_face_data(update_flags, mapping,
151  output_data);
152  }
153 
154  virtual
155  void
156  fill_fe_values (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
157  const CellSimilarity::Similarity cell_similarity,
158  const Quadrature<dim> &quadrature,
159  const Mapping<dim,spacedim> &mapping,
160  const typename Mapping<dim,spacedim>::InternalDataBase &mapping_internal,
161  const ::internal::FEValuesImplementation::MappingRelatedData<dim, spacedim> &mapping_data,
162  const typename FiniteElement<dim,spacedim>::InternalDataBase &fe_internal,
164 
165  virtual
166  void
167  fill_fe_face_values (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
168  const unsigned int face_no,
169  const Quadrature<dim-1> &quadrature,
170  const Mapping<dim,spacedim> &mapping,
171  const typename Mapping<dim,spacedim>::InternalDataBase &mapping_internal,
172  const ::internal::FEValuesImplementation::MappingRelatedData<dim, spacedim> &mapping_data,
173  const typename FiniteElement<dim,spacedim>::InternalDataBase &fe_internal,
175 
176  virtual
177  void
178  fill_fe_subface_values (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
179  const unsigned int face_no,
180  const unsigned int sub_no,
181  const Quadrature<dim-1> &quadrature,
182  const Mapping<dim,spacedim> &mapping,
183  const typename Mapping<dim,spacedim>::InternalDataBase &mapping_internal,
184  const ::internal::FEValuesImplementation::MappingRelatedData<dim, spacedim> &mapping_data,
185  const typename FiniteElement<dim,spacedim>::InternalDataBase &fe_internal,
187 
194  class InternalData : public FiniteElement<dim,spacedim>::InternalDataBase
195  {
196  public:
210  std::vector<std::vector<double> > shape_values;
211  };
212 
217  PolynomialType poly_space;
218 };
219 
222 DEAL_II_NAMESPACE_CLOSE
223 
224 #endif
Shape function values.
std::vector< std::vector< double > > shape_values
Definition: fe_poly_face.h:210
std::unique_ptr< typename FiniteElement< dim, spacedim >::InternalDataBase > get_face_data(const UpdateFlags update_flags, const Mapping< dim, spacedim > &, const Quadrature< dim-1 > &quadrature, ::internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &) const
Definition: fe_poly_face.h:95
const Point< dim > & point(const unsigned int i) const
std::unique_ptr< typename FiniteElement< dim, spacedim >::InternalDataBase > get_subface_data(const UpdateFlags update_flags, const Mapping< dim, spacedim > &mapping, const Quadrature< dim-1 > &quadrature, ::internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const
Definition: fe_poly_face.h:144
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const
#define Assert(cond, exc)
Definition: exceptions.h:1142
UpdateFlags
Abstract base class for mapping classes.
Definition: dof_tools.h:46
Second derivatives of shape functions.
PolynomialType poly_space
Definition: fe_poly_face.h:217
unsigned int size() const
Definition: mpi.h:53
unsigned int get_degree() const
Shape function gradients.
static ::ExceptionBase & ExcNotImplemented()
virtual std::unique_ptr< typename FiniteElement< dim, spacedim >::InternalDataBase > get_data(const UpdateFlags, const Mapping< dim, spacedim > &, const Quadrature< dim > &, ::internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &) const
Definition: fe_poly_face.h:86
FE_PolyFace(const PolynomialType &poly_space, const FiniteElementData< dim > &fe_data, const std::vector< bool > &restriction_is_additive_flags)
const std::vector< bool > restriction_is_additive_flags
Definition: fe.h:2541