Reference documentation for deal.II version 8.5.1
fe_enriched.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2016 - 2017 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 // We require c++14 here even though we only need features that are part of
22 // c++11, but it turns out that gcc 4.6.x and 4.7.x don't support c++11
23 // features like delegating constructors.
24 
25 #ifdef DEAL_II_WITH_CXX14
26 #include <deal.II/fe/fe.h>
27 #include <deal.II/fe/fe_system.h>
28 #include <deal.II/fe/fe_nothing.h>
29 #include <deal.II/fe/fe_update_flags.h>
30 #include <deal.II/base/function.h>
31 #include <deal.II/base/symmetric_tensor.h>
32 #include <deal.II/base/quadrature.h>
33 
34 #include <vector>
35 #include <utility>
36 #include <numeric>
37 
38 DEAL_II_NAMESPACE_OPEN
39 
206 template <int dim, int spacedim=dim>
207 class FE_Enriched : public FiniteElement<dim, spacedim>
208 {
209 public:
210 
219  const FiniteElement<dim,spacedim> &fe_enriched,
220  const Function<spacedim> *enrichment_function);
221 
232  FE_Enriched (const FiniteElement<dim,spacedim> &fe_base);
233 
269  const std::vector<const FiniteElement<dim,spacedim> * > &fe_enriched,
270  const std::vector<std::vector<std::function<const Function<spacedim> *(const typename Triangulation<dim, spacedim>::cell_iterator &) > > > &functions);
271 
272 private:
278  FE_Enriched (const std::vector< const FiniteElement< dim, spacedim > * > &fes,
279  const std::vector< unsigned int > &multiplicities,
280  const std::vector<std::vector<std::function<const Function<spacedim> *(const typename Triangulation<dim, spacedim>::cell_iterator &) > > > &functions);
281 public:
282 
288  virtual FiniteElement<dim,spacedim> *clone() const;
289 
290  virtual
292  requires_update_flags (const UpdateFlags update_flags) const;
293 
297  virtual std::string get_name () const;
298 
305  virtual const FiniteElement<dim,spacedim> &
306  base_element (const unsigned int index) const;
307 
316  virtual double shape_value(const unsigned int i,
317  const Point< dim > &p) const;
318 
330  virtual const FullMatrix<double> &
331  get_restriction_matrix (const unsigned int child,
333 
340  virtual const FullMatrix<double> &
341  get_prolongation_matrix (const unsigned int child,
343 
345 
357  virtual bool hp_constraints_are_implemented () const;
358 
371  virtual void
373  FullMatrix<double> &matrix) const;
374 
387  virtual void
389  const unsigned int subface,
390  FullMatrix<double> &matrix) const;
391 
407  virtual
408  std::vector<std::pair<unsigned int, unsigned int> >
410 
415  virtual
416  std::vector<std::pair<unsigned int, unsigned int> >
417  hp_line_dof_identities (const FiniteElement<dim,spacedim> &fe_other) const;
418 
423  virtual
424  std::vector<std::pair<unsigned int, unsigned int> >
425  hp_quad_dof_identities (const FiniteElement<dim,spacedim> &fe_other) const;
426 
436  virtual
440 
441 
445  const std::vector<std::vector<std::function<const Function<spacedim> *(const typename Triangulation<dim, spacedim>::cell_iterator &) > > >
446  get_enrichments() const;
447 
451  const FESystem<dim,spacedim> &
452  get_fe_system() const;
453 
454 protected:
455 
459  class InternalData : public FiniteElement<dim,spacedim>::InternalDataBase
460  {
461  public:
467  {
468  std::vector<double> values;
469  std::vector<Tensor<1,spacedim> > gradients;
470  std::vector<SymmetricTensor<2, spacedim> > hessians;
471  };
472 
484 
490  get_fe_data (const unsigned int base_no) const;
491 
498  get_fe_output_object (const unsigned int base_no) const;
499 
504  std::unique_ptr<typename FESystem<dim,spacedim>::InternalData> fesystem_data;
505 
518  mutable std::vector<std::vector<EnrichmentValues> > enrichment;
519  };
520 
527  std::vector<std::vector<std::vector<unsigned int> > > base_no_mult_local_enriched_dofs;
528 
535  const std::vector<std::vector<std::function<const Function<spacedim> *(const typename Triangulation<dim, spacedim>::cell_iterator &) > > > enrichments;
536 
546  const bool is_enriched;
547 
558  template <int dim_1>
560  setup_data (std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase> fes_data,
561  const UpdateFlags flags,
562  const Quadrature<dim_1> &quadrature) const;
563 
571  get_data (const UpdateFlags flags,
572  const Mapping<dim,spacedim> &mapping,
573  const Quadrature<dim> &quadrature,
575 
577  get_face_data (const UpdateFlags update_flags,
578  const Mapping<dim,spacedim> &mapping,
579  const Quadrature<dim-1> &quadrature,
581 
583  get_subface_data (const UpdateFlags update_flags,
584  const Mapping<dim,spacedim> &mapping,
585  const Quadrature<dim-1> &quadrature,
587 
588  virtual
589  void fill_fe_values (const typename Triangulation<dim, spacedim>::cell_iterator &cell,
590  const CellSimilarity::Similarity cell_similarity,
591  const Quadrature<dim> &quadrature,
592  const Mapping<dim, spacedim> &mapping,
593  const typename Mapping<dim, spacedim>::InternalDataBase &mapping_internal,
594  const ::internal::FEValues::MappingRelatedData<dim, spacedim> &mapping_data,
595  const typename FiniteElement<dim,spacedim>::InternalDataBase &fe_internal,
597  ) const;
598 
599  virtual
600  void
601  fill_fe_face_values ( const typename Triangulation<dim, spacedim>::cell_iterator &cell,
602  const unsigned int face_no,
603  const Quadrature<dim-1> &quadrature,
604  const Mapping<dim, spacedim> &mapping,
605  const typename Mapping<dim, spacedim>::InternalDataBase &mapping_internal,
606  const ::internal::FEValues::MappingRelatedData<dim, spacedim> &mapping_data,
607  const typename FiniteElement<dim,spacedim>::InternalDataBase &fe_internal,
609  ) const;
610 
611  virtual
612  void
613  fill_fe_subface_values (const typename Triangulation< dim, spacedim >::cell_iterator &cell,
614  const unsigned int face_no,
615  const unsigned int sub_no,
616  const Quadrature<dim-1> &quadrature,
617  const Mapping<dim, spacedim> &mapping,
618  const typename Mapping< dim, spacedim >::InternalDataBase &mapping_internal,
619  const ::internal::FEValues::MappingRelatedData<dim, spacedim> &mapping_data,
620  const typename FiniteElement<dim,spacedim>::InternalDataBase &fe_internal,
622  ) const;
623 
624 private:
629  void initialize (const std::vector<const FiniteElement<dim,spacedim>*> &fes,
630  const std::vector<unsigned int> &multiplicities);
631 
636 
642  template <int dim_1>
643  void
644  multiply_by_enrichment (const Quadrature<dim_1> &quadrature,
645  const InternalData &fe_data,
649 };
650 
651 //}
652 DEAL_II_NAMESPACE_CLOSE
653 
654 #endif // CXX14
655 
656 #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:835
const std::vector< std::vector< std::function< const Function< spacedim > *(const typename Triangulation< dim, spacedim >::cell_iterator &) > > > get_enrichments() const
Definition: fe_enriched.cc:224
InternalData(std::unique_ptr< typename FESystem< dim, spacedim >::InternalData > fesystem_data)
Definition: fe_enriched.cc:917
FE_Enriched(const FiniteElement< dim, spacedim > &fe_base, const FiniteElement< dim, spacedim > &fe_enriched, const Function< spacedim > *enrichment_function)
Definition: fe_enriched.cc:127
void initialize(const std::vector< const FiniteElement< dim, spacedim > *> &fes, const std::vector< unsigned int > &multiplicities)
Definition: fe_enriched.cc:366
virtual void get_subface_interpolation_matrix(const FiniteElement< dim, spacedim > &source, const unsigned int subface, FullMatrix< double > &matrix) const
Definition: fe_enriched.cc:795
std::vector< std::vector< EnrichmentValues > > enrichment
Definition: fe_enriched.h:518
std::unique_ptr< typename FESystem< dim, spacedim >::InternalData > fesystem_data
Definition: fe_enriched.h:504
virtual const FiniteElement< dim, spacedim > & base_element(const unsigned int index) const
Definition: fe_enriched.cc:446
const bool is_enriched
Definition: fe_enriched.h:546
const FESystem< dim, spacedim > & get_fe_system() const
Definition: fe_enriched.cc:757
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const
Definition: fe_enriched.cc:259
virtual bool hp_constraints_are_implemented() const
Definition: fe_enriched.cc:766
virtual double shape_value(const unsigned int i, const Point< dim > &p) const
Definition: fe_enriched.cc:232
UpdateFlags
internal::FEValues::FiniteElementRelatedData< dim, spacedim > & get_fe_output_object(const unsigned int base_no) const
Definition: fe_enriched.cc:935
FiniteElement< dim, spacedim >::InternalDataBase & get_fe_data(const unsigned int base_no) const
Definition: fe_enriched.cc:926
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:897
Abstract base class for mapping classes.
Definition: dof_tools.h:46
virtual std::string get_name() const
Definition: fe_enriched.cc:423
Definition: fe.h:33
void multiply_by_enrichment(const Quadrature< dim_1 > &quadrature, const InternalData &fe_data, const internal::FEValues::MappingRelatedData< dim, spacedim > &mapping_data, const typename Triangulation< dim, spacedim >::cell_iterator &cell, internal::FEValues::FiniteElementRelatedData< dim, spacedim > &output_data) const
Definition: fe_enriched.cc:566
FESystem< dim, spacedim > fe_system
Definition: fe_enriched.h:635
FiniteElement< dim, spacedim >::InternalDataBase * setup_data(std::unique_ptr< typename FiniteElement< dim, spacedim >::InternalDataBase > fes_data, const UpdateFlags flags, const Quadrature< dim_1 > &quadrature) const
Definition: fe_enriched.cc:284
virtual FiniteElement< dim, spacedim >::InternalDataBase * get_data(const UpdateFlags flags, const Mapping< dim, spacedim > &mapping, const Quadrature< dim > &quadrature, ::internal::FEValues::FiniteElementRelatedData< dim, spacedim > &output_data) const
Definition: fe_enriched.cc:354
virtual FiniteElement< dim, spacedim >::InternalDataBase * get_face_data(const UpdateFlags update_flags, const Mapping< dim, spacedim > &mapping, const Quadrature< dim-1 > &quadrature, ::internal::FEValues::FiniteElementRelatedData< dim, spacedim > &output_data) const
Definition: fe_enriched.cc:328
virtual FiniteElement< dim, spacedim >::InternalDataBase * get_subface_data(const UpdateFlags update_flags, const Mapping< dim, spacedim > &mapping, const Quadrature< dim-1 > &quadrature, ::internal::FEValues::FiniteElementRelatedData< dim, spacedim > &output_data) const
Definition: fe_enriched.cc:341
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_quad_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const
Definition: fe_enriched.cc:853
std::vector< std::vector< std::vector< unsigned int > > > base_no_mult_local_enriched_dofs
Definition: fe_enriched.h:527
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_vertex_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const
Definition: fe_enriched.cc:817
virtual void get_face_interpolation_matrix(const FiniteElement< dim, spacedim > &source, FullMatrix< double > &matrix) const
Definition: fe_enriched.cc:775
virtual FiniteElement< dim, spacedim > * clone() const
Definition: fe_enriched.cc:242
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:906
virtual FiniteElementDomination::Domination compare_for_face_domination(const FiniteElement< dim, spacedim > &fe_other) const
Definition: fe_enriched.cc:871
const std::vector< std::vector< std::function< const Function< spacedim > *(const typename Triangulation< dim, spacedim >::cell_iterator &) > > > enrichments
Definition: fe_enriched.h:535