Reference documentation for deal.II version 9.0.0
fe_enriched.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2016 - 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_enriched_h
17 #define dealii_fe_enriched_h
18 
19 #include <deal.II/base/config.h>
20 
21 #include <deal.II/fe/fe.h>
22 #include <deal.II/fe/fe_system.h>
23 #include <deal.II/fe/fe_nothing.h>
24 #include <deal.II/fe/fe_update_flags.h>
25 #include <deal.II/base/function.h>
27 #include <deal.II/base/quadrature.h>
28 
29 #include <vector>
30 #include <utility>
31 #include <numeric>
32 
33 DEAL_II_NAMESPACE_OPEN
34 
205 template <int dim, int spacedim=dim>
206 class FE_Enriched : public FiniteElement<dim, spacedim>
207 {
208 public:
209 
218  const FiniteElement<dim,spacedim> &fe_enriched,
219  const Function<spacedim> *enrichment_function);
220 
231  FE_Enriched (const FiniteElement<dim,spacedim> &fe_base);
232 
268  const std::vector<const FiniteElement<dim,spacedim> * > &fe_enriched,
269  const std::vector<std::vector<std::function<const Function<spacedim> *(const typename Triangulation<dim, spacedim>::cell_iterator &) > > > &functions);
270 
271 private:
277  FE_Enriched (const std::vector< const FiniteElement< dim, spacedim > * > &fes,
278  const std::vector< unsigned int > &multiplicities,
279  const std::vector<std::vector<std::function<const Function<spacedim> *(const typename Triangulation<dim, spacedim>::cell_iterator &) > > > &functions);
280 public:
281 
282  virtual
283  std::unique_ptr<FiniteElement<dim,spacedim> >
284  clone() const;
285 
286  virtual
288  requires_update_flags (const UpdateFlags update_flags) const;
289 
293  virtual std::string get_name () const;
294 
301  virtual const FiniteElement<dim,spacedim> &
302  base_element (const unsigned int index) const;
303 
312  virtual double shape_value(const unsigned int i,
313  const Point< dim > &p) const;
314 
326  virtual const FullMatrix<double> &
327  get_restriction_matrix (const unsigned int child,
329 
336  virtual const FullMatrix<double> &
337  get_prolongation_matrix (const unsigned int child,
339 
341 
353  virtual bool hp_constraints_are_implemented () const;
354 
367  virtual void
369  FullMatrix<double> &matrix) const;
370 
383  virtual void
385  const unsigned int subface,
386  FullMatrix<double> &matrix) const;
387 
403  virtual
404  std::vector<std::pair<unsigned int, unsigned int> >
406 
411  virtual
412  std::vector<std::pair<unsigned int, unsigned int> >
413  hp_line_dof_identities (const FiniteElement<dim,spacedim> &fe_other) const;
414 
419  virtual
420  std::vector<std::pair<unsigned int, unsigned int> >
421  hp_quad_dof_identities (const FiniteElement<dim,spacedim> &fe_other) const;
422 
432  virtual
436 
437 
441  const std::vector<std::vector<std::function<const Function<spacedim> *(const typename Triangulation<dim, spacedim>::cell_iterator &) > > >
442  get_enrichments() const;
443 
447  const FESystem<dim,spacedim> &
448  get_fe_system() const;
449 
450 protected:
451 
455  class InternalData : public FiniteElement<dim,spacedim>::InternalDataBase
456  {
457  public:
463  {
464  std::vector<double> values;
465  std::vector<Tensor<1,spacedim> > gradients;
466  std::vector<SymmetricTensor<2, spacedim> > hessians;
467  };
468 
480 
486  get_fe_data (const unsigned int base_no) const;
487 
494  get_fe_output_object (const unsigned int base_no) const;
495 
500  std::unique_ptr<typename FESystem<dim,spacedim>::InternalData> fesystem_data;
501 
514  mutable std::vector<std::vector<EnrichmentValues> > enrichment;
515  };
516 
523  std::vector<std::vector<std::vector<unsigned int> > > base_no_mult_local_enriched_dofs;
524 
531  const std::vector<std::vector<std::function<const Function<spacedim> *(const typename Triangulation<dim, spacedim>::cell_iterator &) > > > enrichments;
532 
542  const bool is_enriched;
543 
554  template <int dim_1>
555  std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
556  setup_data (std::unique_ptr<typename FESystem<dim,spacedim>::InternalData> fes_data,
557  const UpdateFlags flags,
558  const Quadrature<dim_1> &quadrature) const;
559 
566  virtual std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
567  get_data (const UpdateFlags flags,
568  const Mapping<dim,spacedim> &mapping,
569  const Quadrature<dim> &quadrature,
571 
572  virtual std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
573  get_face_data (const UpdateFlags update_flags,
574  const Mapping<dim,spacedim> &mapping,
575  const Quadrature<dim-1> &quadrature,
577 
578  virtual std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
579  get_subface_data (const UpdateFlags update_flags,
580  const Mapping<dim,spacedim> &mapping,
581  const Quadrature<dim-1> &quadrature,
583 
584  virtual
585  void fill_fe_values (const typename Triangulation<dim, spacedim>::cell_iterator &cell,
586  const CellSimilarity::Similarity cell_similarity,
587  const Quadrature<dim> &quadrature,
588  const Mapping<dim, spacedim> &mapping,
589  const typename Mapping<dim, spacedim>::InternalDataBase &mapping_internal,
590  const ::internal::FEValuesImplementation::MappingRelatedData<dim, spacedim> &mapping_data,
591  const typename FiniteElement<dim,spacedim>::InternalDataBase &fe_internal,
593  ) const;
594 
595  virtual
596  void
597  fill_fe_face_values ( const typename Triangulation<dim, spacedim>::cell_iterator &cell,
598  const unsigned int face_no,
599  const Quadrature<dim-1> &quadrature,
600  const Mapping<dim, spacedim> &mapping,
601  const typename Mapping<dim, spacedim>::InternalDataBase &mapping_internal,
602  const ::internal::FEValuesImplementation::MappingRelatedData<dim, spacedim> &mapping_data,
603  const typename FiniteElement<dim,spacedim>::InternalDataBase &fe_internal,
605  ) const;
606 
607  virtual
608  void
609  fill_fe_subface_values (const typename Triangulation< dim, spacedim >::cell_iterator &cell,
610  const unsigned int face_no,
611  const unsigned int sub_no,
612  const Quadrature<dim-1> &quadrature,
613  const Mapping<dim, spacedim> &mapping,
614  const typename Mapping< dim, spacedim >::InternalDataBase &mapping_internal,
615  const ::internal::FEValuesImplementation::MappingRelatedData<dim, spacedim> &mapping_data,
616  const typename FiniteElement<dim,spacedim>::InternalDataBase &fe_internal,
618  ) const;
619 
620 private:
625  void initialize (const std::vector<const FiniteElement<dim,spacedim>*> &fes,
626  const std::vector<unsigned int> &multiplicities);
627 
631  const std::unique_ptr<const FESystem<dim,spacedim> > fe_system;
632 
638  template <int dim_1>
639  void
640  multiply_by_enrichment (const Quadrature<dim_1> &quadrature,
641  const InternalData &fe_data,
645 };
646 
647 //}
648 DEAL_II_NAMESPACE_CLOSE
649 
650 #endif // dealii_fe_enriched_h
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_line_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const
Definition: fe_enriched.cc:846
const std::vector< std::vector< std::function< const Function< spacedim > *(const typename Triangulation< dim, spacedim >::cell_iterator &) > > > get_enrichments() const
Definition: fe_enriched.cc:230
InternalData(std::unique_ptr< typename FESystem< dim, spacedim >::InternalData > fesystem_data)
Definition: fe_enriched.cc:928
FE_Enriched(const FiniteElement< dim, spacedim > &fe_base, const FiniteElement< dim, spacedim > &fe_enriched, const Function< spacedim > *enrichment_function)
Definition: fe_enriched.cc:133
void initialize(const std::vector< const FiniteElement< dim, spacedim > *> &fes, const std::vector< unsigned int > &multiplicities)
Definition: fe_enriched.cc:372
internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > & get_fe_output_object(const unsigned int base_no) const
Definition: fe_enriched.cc:946
virtual void get_subface_interpolation_matrix(const FiniteElement< dim, spacedim > &source, const unsigned int subface, FullMatrix< double > &matrix) const
Definition: fe_enriched.cc:806
std::vector< std::vector< EnrichmentValues > > enrichment
Definition: fe_enriched.h:514
std::unique_ptr< typename FESystem< dim, spacedim >::InternalData > fesystem_data
Definition: fe_enriched.h:500
virtual const FiniteElement< dim, spacedim > & base_element(const unsigned int index) const
Definition: fe_enriched.cc:452
void multiply_by_enrichment(const Quadrature< dim_1 > &quadrature, const InternalData &fe_data, const internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &mapping_data, const typename Triangulation< dim, spacedim >::cell_iterator &cell, internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const
Definition: fe_enriched.cc:572
const bool is_enriched
Definition: fe_enriched.h:542
const std::unique_ptr< const FESystem< dim, spacedim > > fe_system
Definition: fe_enriched.h:631
const FESystem< dim, spacedim > & get_fe_system() const
Definition: fe_enriched.cc:768
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const
Definition: fe_enriched.cc:267
virtual bool hp_constraints_are_implemented() const
Definition: fe_enriched.cc:777
virtual double shape_value(const unsigned int i, const Point< dim > &p) const
Definition: fe_enriched.cc:238
UpdateFlags
FiniteElement< dim, spacedim >::InternalDataBase & get_fe_data(const unsigned int base_no) const
Definition: fe_enriched.cc:937
virtual const FullMatrix< double > & get_prolongation_matrix(const unsigned int child, const RefinementCase< dim > &refinement_case=RefinementCase< dim >::isotropic_refinement) const
Definition: fe_enriched.cc:908
Abstract base class for mapping classes.
Definition: dof_tools.h:46
virtual std::string get_name() const
Definition: fe_enriched.cc:429
Definition: fe.h:36
virtual std::unique_ptr< typename FiniteElement< dim, spacedim >::InternalDataBase > get_face_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_enriched.cc:331
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_quad_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const
Definition: fe_enriched.cc:864
std::vector< std::vector< std::vector< unsigned int > > > base_no_mult_local_enriched_dofs
Definition: fe_enriched.h:523
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_vertex_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const
Definition: fe_enriched.cc:828
virtual void get_face_interpolation_matrix(const FiniteElement< dim, spacedim > &source, FullMatrix< double > &matrix) const
Definition: fe_enriched.cc:786
virtual 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_enriched.cc:345
std::unique_ptr< typename FiniteElement< dim, spacedim >::InternalDataBase > setup_data(std::unique_ptr< typename FESystem< dim, spacedim >::InternalData > fes_data, const UpdateFlags flags, const Quadrature< dim_1 > &quadrature) const
Definition: fe_enriched.cc:292
virtual std::unique_ptr< FiniteElement< dim, spacedim > > clone() const
Definition: fe_enriched.cc:248
virtual const FullMatrix< double > & get_restriction_matrix(const unsigned int child, const RefinementCase< dim > &refinement_case=RefinementCase< dim >::isotropic_refinement) const
Definition: fe_enriched.cc:917
virtual FiniteElementDomination::Domination compare_for_face_domination(const FiniteElement< dim, spacedim > &fe_other) const
Definition: fe_enriched.cc:882
const std::vector< std::vector< std::function< const Function< spacedim > *(const typename Triangulation< dim, spacedim >::cell_iterator &) > > > enrichments
Definition: fe_enriched.h:531
virtual std::unique_ptr< typename FiniteElement< dim, spacedim >::InternalDataBase > get_data(const UpdateFlags flags, const Mapping< dim, spacedim > &mapping, const Quadrature< dim > &quadrature, ::internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const
Definition: fe_enriched.cc:359