Flow123d  DF_patch_fevalues-8016b85
fe_values.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file fe_values.hh
15  * @brief Class FEValues calculates finite element data on the actual
16  * cells such as shape function values, gradients, Jacobian of
17  * the mapping from the reference cell etc.
18  * @author Jan Stebel
19  */
20 
21 #ifndef FE_VALUES_HH_
22 #define FE_VALUES_HH_
23 
24 #include <string.h> // for memcpy
25 #include <algorithm> // for swap
26 #include <new> // for operator new[]
27 #include <string> // for operator<<
28 #include <vector> // for vector
29 #include "fem/element_values.hh" // for ElementValues
30 #include "fem/fe_values_views.hh" // for FEValuesViews
31 #include "mesh/ref_element.hh" // for RefElement
32 #include "mesh/accessors.hh"
33 #include "fem/update_flags.hh" // for UpdateFlags
34 #include "tools/mixed.hh"
36 
37 class Quadrature;
38 template<unsigned int dim> class FiniteElement;
39 
40 template<class FV, unsigned int dim> class MapScalar;
41 template<class FV, unsigned int dim> class MapPiola;
42 template<class FV, unsigned int dim> class MapContravariant;
43 template<class FV, unsigned int dim> class MapVector;
44 template<class FV, unsigned int dim> class MapTensor;
45 template<class FV, unsigned int dim> class MapSystem;
46 
47 template<unsigned int spcedim> class FEValues;
48 template<unsigned int spcedim> class PatchFEValues;
49 
50 
51 
52 
53 
54 
55 
57 
58 
59 template<class FV, unsigned int spacedim = 3>
61 {
62 protected:
63  // internal structure that stores all possible views
64  // for scalar and vector-valued components of the FE
65  struct ViewsCache {
69 
70  template<unsigned int DIM>
71  void initialize(const FV &fv, const FiniteElement<DIM> &fe);
72  };
73 
74 
75 public:
76  /// Default constructor with postponed initialization.
77  FEValuesBase();
78 
79  /**
80  * @brief Initialize structures and calculates cell-independent data.
81  *
82  * @param _quadrature The quadrature rule for the cell associated
83  * to given finite element or for the cell side.
84  * @param _fe The finite element.
85  * @param _flags The update flags.
86  */
87  template<unsigned int DIM>
88  void initialize(Quadrature &_quadrature,
89  FiniteElement<DIM> &_fe,
90  UpdateFlags _flags);
91 
92  /**
93  * @brief Allocates space for computed data.
94  *
95  * @param n_points Number of quadrature points.
96  * @param _fe The finite element.
97  * @param flags The update flags.
98  */
99  template<unsigned int DIM>
100  void allocate(Quadrature &_quadrature,
101  FiniteElement<DIM> &_fe,
102  UpdateFlags flags);
103 
104  /**
105  * @brief Returns the number of quadrature points.
106  */
107  inline unsigned int n_points() const
108  { return n_points_; }
109 
110  /**
111  * @brief Returns the number of shape functions.
112  */
113  inline unsigned int n_dofs() const
114  {
115  return n_dofs_;
116  }
117 
118  /// Return dimension of reference space.
119  inline unsigned int dim() const
120  { return dim_; }
121 
122  /**
123  * @brief Accessor to scalar values of multicomponent FE.
124  * @param i Index of scalar component.
125  */
127  {
128  ASSERT_LT(i, views_cache_.scalars.size());
129  return views_cache_.scalars[i];
130  }
131 
132  /**
133  * @brief Accessor to vector values of multicomponent FE.
134  * @param i Index of first vector component.
135  */
137  {
138  ASSERT_LT(i, views_cache_.vectors.size());
139  return views_cache_.vectors[i];
140  }
141 
142  /**
143  * @brief Accessor to tensor values of multicomponent FE.
144  * @param i Index of first tensor component.
145  */
147  {
148  ASSERT_LT(i, views_cache_.tensors.size());
149  return views_cache_.tensors[i];
150  }
151 
152  /// Structure for storing the precomputed finite element data.
154  {
155  public:
156 
157  FEInternalData(unsigned int np, unsigned int nd);
158 
159  /// Create a new instance of FEInternalData for a FESystem component or subvector.
160  FEInternalData(const FEInternalData &fe_system_data,
161  const std::vector<unsigned int> &dof_indices,
162  unsigned int first_component_idx,
163  unsigned int ncomps = 1);
164 
165  /**
166  * @brief Precomputed values of basis functions at the quadrature points.
167  *
168  * Dimensions: (no. of quadrature points)
169  * x (no. of dofs)
170  * x (no. of components in ref. cell)
171  */
173 
174  /**
175  * @brief Precomputed gradients of basis functions at the quadrature points.
176  *
177  * Dimensions: (no. of quadrature points)
178  * x (no. of dofs)
179  * x ((dim_ of. ref. cell)x(no. of components in ref. cell))
180  */
182 
183  /// Number of quadrature points.
184  unsigned int n_points;
185 
186  /// Number of dofs (shape functions).
187  unsigned int n_dofs;
188  };
189 
190 
191 protected:
192  /**
193  * @brief Computes the shape function values and gradients on the actual cell
194  * and fills the FEValues structure.
195  *
196  * @param fe_data Precomputed finite element data.
197  */
198  void fill_data(const ElementValues<spacedim> &elm_values, const FEInternalData &fe_data);
199 
200  /**
201  * @brief Computes the shape function values and gradients on the actual cell
202  * and fills the FEValues structure. Specialized variant of previous method for
203  * different FETypes given by template parameter.
204  */
205  template<class MapType>
206  void fill_data_specialized(const ElementValues<spacedim> &elm_values, const FEInternalData &fe_data);
207 
208 
209  /// Initialize vectors declared separately in descendants.
210  virtual void allocate_in(unsigned int) =0;
211 
212  /// Initialize ElementValues separately in descendants.
213  virtual void initialize_in(Quadrature &, unsigned int) =0;
214 
215  /// Initialize @p fe_values_vec only in PatchFEValues.
216  virtual void init_fe_val_vec() =0;
217 
218  /// Precompute finite element data on reference element.
219  template<unsigned int DIM>
220  std::shared_ptr<typename FEValuesBase<FV, spacedim>::FEInternalData> init_fe_data(const FiniteElement<DIM> &fe, const Quadrature &q);
221 
222  /// Dimension of reference space.
223  unsigned int dim_;
224 
225  /// Number of integration points.
226  unsigned int n_points_;
227 
228  /// Number of finite element dofs.
229  unsigned int n_dofs_;
230 
231  /// Type of finite element (scalar, vector, tensor).
233 
234  /// Dof indices of FESystem sub-elements.
236 
237  /// Numbers of components of FESystem sub-elements in reference space.
239 
240  /// Numbers of components of FESystem sub-elements in real space.
242 
243  /// Flags that indicate which finite element quantities are to be computed.
245 
246  /// Vector of FEValues for sub-elements of FESystem.
248 
249  /// Number of components of the FE.
250  unsigned int n_components_;
251 
252  /// Auxiliary storage of FEValuesViews accessors.
254 
255  /// Precomputed finite element data.
256  std::shared_ptr<FEInternalData> fe_data_;
257 
258  /// Precomputed FE data (shape functions on reference element) for all side quadrature points.
260 
261  /// Helper object, we need its for ViewsCache initialization.
262  FV *fv_;
263 
264  friend class MapScalar<FV, spacedim>;
265  friend class MapPiola<FV, spacedim>;
266  friend class MapContravariant<FV, spacedim>;
267  friend class MapVector<FV, spacedim>;
268  friend class MapTensor<FV, spacedim>;
269  friend class MapSystem<FV, spacedim>;
270 };
271 
272 
273 
274 
275 
276 /**
277  * @brief Calculates finite element data on the actual cell.
278  *
279  * FEValues takes care of the calculation of finite element data on
280  * the actual cell or on its side, (values of shape functions at quadrature
281  * points, gradients of shape functions, Jacobians of the mapping
282  * from the reference cell etc.).
283  * @param spacedim Dimension of the Euclidean space where the actual
284  * cell lives.
285  */
286 template<unsigned int spacedim = 3>
287 class FEValues : public FEValuesBase<FEValues<spacedim>, spacedim>
288 {
289 public:
290 
291  /// Default constructor with postponed initialization.
292  FEValues();
293 
294  /// Constructor with initialization of data structures
295  /// (see initialize() for description of parameters).
296  template<unsigned int DIM>
297  FEValues(Quadrature &_quadrature,
298  FiniteElement<DIM> &_fe,
299  UpdateFlags _flags)
300  : FEValues()
301  {
302  this->initialize(_quadrature, _fe, _flags);
303  }
304 
305 
306  /// Correct deallocation of objects created by 'initialize' methods.
307  ~FEValues();
308 
309 
310  /**
311  * @brief Update cell-dependent data (gradients, Jacobians etc.)
312  *
313  * @param cell The actual cell.
314  */
315  void reinit(const ElementAccessor<spacedim> &cell);
316 
317  /**
318  * @brief Update cell side-dependent FE data (values, gradients).
319  *
320  * @param cell_side Accessor to cell side.
321  */
322  void reinit(const Side &cell_side);
323 
324  /**
325  * @brief Return the value of the @p function_no-th shape function at
326  * the @p point_no-th quadrature point.
327  *
328  * @param function_no Number of the shape function.
329  * @param point_no Number of the quadrature point.
330  */
331  inline double shape_value(const unsigned int function_no, const unsigned int point_no) const
332  {
333  ASSERT_LT(function_no, this->n_dofs_);
334  ASSERT_LT(point_no, this->n_points_);
335  return shape_values_[point_no][function_no];
336  }
337 
338 
339  /**
340  * @brief Return the gradient of the @p function_no-th shape function at
341  * the @p point_no-th quadrature point.
342  *
343  * @param function_no Number of the shape function.
344  * @param point_no Number of the quadrature point.
345  */
346  inline arma::vec::fixed<spacedim> shape_grad(const unsigned int function_no, const unsigned int point_no) const
347  {
348  ASSERT_LT(function_no, this->n_dofs_);
349  ASSERT_LT(point_no, this->n_points_);
350  return shape_gradients_[point_no][function_no];
351  }
352 
353  /**
354  * @brief Return the value of the @p function_no-th shape function at
355  * the @p point_no-th quadrature point.
356  *
357  * For vectorial finite elements.
358  *
359  * @param function_no Number of the shape function.
360  * @param point_no Number of the quadrature point.
361  */
362  inline double shape_value_component(const unsigned int function_no,
363  const unsigned int point_no,
364  const unsigned int comp) const
365  {
366  ASSERT_LT(function_no, this->n_dofs_);
367  ASSERT_LT(point_no, this->n_points_);
368  ASSERT_LT(comp, this->n_components_);
369  return shape_values_[point_no][function_no*this->n_components_+comp];
370  }
371 
372  /**
373  * @brief Return the gradient of the @p function_no-th shape function at
374  * the @p point_no-th quadrature point.
375  *
376  * For vectorial finite elements.
377  *
378  * @param function_no Number of the shape function.
379  * @param point_no Number of the quadrature point.
380  */
381  arma::vec::fixed<spacedim> shape_grad_component(const unsigned int function_no,
382  const unsigned int point_no,
383  const unsigned int comp) const;
384 
385  /**
386  * Set shape value @p val of the @p i_point and @p i_func_comp.
387  */
388  inline void set_shape_value(unsigned int i_point, unsigned int i_func_comp, double val)
389  {
390  shape_values_[i_point][i_func_comp] = val;
391  }
392 
393  /**
394  * Set shape gradient @p val of the @p i_point and @p i_func_comp.
395  */
396  inline void set_shape_gradient(unsigned int i_point, unsigned int i_func_comp, arma::vec::fixed<spacedim> val)
397  {
398  shape_gradients_[i_point][i_func_comp] = val;
399  }
400 
401  /**
402  * @brief Return the relative volume change of the cell (Jacobian determinant).
403  *
404  * If dim_==spacedim then the sign may be negative, otherwise the
405  * result is a positive number.
406  *
407  * @param point_no Number of the quadrature point.
408  */
409  inline double determinant(const unsigned int point_no)
410  {
411  ASSERT_LT(point_no, this->n_points_);
412  return elm_values_->determinant(point_no);
413  }
414 
415  /**
416  * @brief Return the product of Jacobian determinant and the quadrature
417  * weight at given quadrature point.
418  *
419  * @param point_no Number of the quadrature point.
420  */
421  inline double JxW(const unsigned int point_no)
422  {
423  ASSERT_LT(point_no, this->n_points_);
424  // TODO: This is temporary solution to distinguish JxW on element and side_JxW on side.
425  // In future we should call the appropriate method in elm_values_.
426  return (elm_values_->cell().is_valid()) ? elm_values_->JxW(point_no) : elm_values_->side_JxW(point_no);
427  }
428 
429  /**
430  * @brief Return coordinates of the quadrature point in the actual cell system.
431  *
432  * @param point_no Number of the quadrature point.
433  */
434  inline arma::vec::fixed<spacedim> point(const unsigned int point_no)
435  {
436  ASSERT_LT(point_no, this->n_points_);
437  return elm_values_->point(point_no);
438  }
439 
440  /**
441  * @brief Return coordinates of all quadrature points in the actual cell system.
442  *
443  */
444  inline const Armor::array &point_list() const
445  {
446  return elm_values_->point_list();
447  }
448 
449 
450  /**
451  * @brief Returns the normal vector to a side at given quadrature point.
452  *
453  * @param point_no Number of the quadrature point.
454  */
455  inline arma::vec::fixed<spacedim> normal_vector(unsigned int point_no)
456  {
457  ASSERT_LT(point_no, this->n_points_);
458  return elm_values_->normal_vector(point_no);
459  }
460 
461 
462 protected:
463 
464  /// Implement @p FEValuesBase::allocate_in
465  void allocate_in(unsigned int q_dim) override;
466 
467  /// Implement @p FEValuesBase::initialize_in
468  void initialize_in(Quadrature &q, unsigned int dim) override;
469 
470  /// Implement @p FEValuesBase::initialize_in
471  void init_fe_val_vec() override
472  {}
473 
474  /// Shape functions evaluated at the quadrature points.
476 
477  /// Gradients of shape functions evaluated at the quadrature points.
478  /// Each row of the matrix contains the gradient of one shape function.
480 
481  /// Auxiliary object for calculation of element-dependent data.
482  std::shared_ptr<ElementValues<spacedim> > elm_values_;
483 
484  friend class MapScalar<FEValues<spacedim>, spacedim>;
485  friend class MapPiola<FEValues<spacedim>, spacedim>;
486  friend class MapContravariant<FEValues<spacedim>, spacedim>;
487  friend class MapVector<FEValues<spacedim>, spacedim>;
488  friend class MapTensor<FEValues<spacedim>, spacedim>;
489  friend class MapSystem<FEValues<spacedim>, spacedim>;
490 };
491 
492 
493 
494 
495 
496 
497 template<unsigned int spacedim = 3>
498 class PatchFEValues : public FEValuesBase<PatchFEValues<spacedim>, spacedim> {
499 public:
500  /// Constructor, set maximal number of elements on patch
501  PatchFEValues(unsigned int max_size=0);
502 
503  /// Reinit data.
504  void reinit(PatchElementsList patch_elements);
505 
506  inline unsigned int used_size() const {
507  return used_size_;
508  }
509 
510  inline unsigned int max_size() const {
511  return element_data_.size();
512  }
513 
514  /// Set element that is selected for processing. Element is given by index on patch.
515  inline void get_cell(const unsigned int patch_cell_idx) {
516  patch_data_idx_ = element_patch_map_.find(patch_cell_idx)->second;
517  }
518 
519  /// Set element and side that are selected for processing. Element is given by index on patch.
520  inline void get_side(unsigned int patch_cell_idx, unsigned int side_idx) {
521  patch_data_idx_ = element_patch_map_.find(patch_cell_idx)->second * (this->dim_+1) + side_idx;
522  }
523 
524  /**
525  * @brief Return the value of the @p function_no-th shape function at
526  * the @p point_no-th quadrature point.
527  *
528  * @param function_no Number of the shape function.
529  * @param point_no Number of the quadrature point.
530  */
531  inline double shape_value(const unsigned int function_no, const unsigned int point_no) const
532  {
533  ASSERT_LT(function_no, this->n_dofs_);
534  ASSERT_LT(point_no, this->n_points_);
535  return element_data_[patch_data_idx_].shape_values_[point_no][function_no];
536  }
537 
538 
539  /**
540  * @brief Return the gradient of the @p function_no-th shape function at
541  * the @p point_no-th quadrature point.
542  *
543  * @param function_no Number of the shape function.
544  * @param point_no Number of the quadrature point.
545  */
546  inline arma::vec::fixed<spacedim> shape_grad(const unsigned int function_no, const unsigned int point_no) const
547  {
548  ASSERT_LT(function_no, this->n_dofs_);
549  ASSERT_LT(point_no, this->n_points_);
550  return element_data_[patch_data_idx_].shape_gradients_[point_no][function_no];
551  }
552 
553  /**
554  * @brief Return the value of the @p function_no-th shape function at
555  * the @p point_no-th quadrature point.
556  *
557  * For vectorial finite elements.
558  *
559  * @param function_no Number of the shape function.
560  * @param point_no Number of the quadrature point.
561  */
562  inline double shape_value_component(const unsigned int function_no,
563  const unsigned int point_no,
564  const unsigned int comp) const
565  {
566  ASSERT_LT(function_no, this->n_dofs_);
567  ASSERT_LT(point_no, this->n_points_);
568  ASSERT_LT(comp, this->n_components_);
569  return element_data_[patch_data_idx_].shape_values_[point_no][function_no*this->n_components_+comp];
570  }
571 
572  /**
573  * @brief Return the gradient of the @p function_no-th shape function at
574  * the @p point_no-th quadrature point.
575  *
576  * For vectorial finite elements.
577  *
578  * @param function_no Number of the shape function.
579  * @param point_no Number of the quadrature point.
580  */
581  arma::vec::fixed<spacedim> shape_grad_component(const unsigned int function_no,
582  const unsigned int point_no,
583  const unsigned int comp) const;
584 
585 
586  /**
587  * Set shape value @p val of the @p i_point and @p i_func_comp.
588  */
589  inline void set_shape_value(unsigned int i_point, unsigned int i_func_comp, double val)
590  {
591  element_data_[patch_data_idx_].shape_values_[i_point][i_func_comp] = val;
592  }
593 
594  /**
595  * Set shape gradient @p val of the @p i_point and @p i_func_comp.
596  */
597  inline void set_shape_gradient(unsigned int i_point, unsigned int i_func_comp, arma::vec::fixed<spacedim> val)
598  {
599  element_data_[patch_data_idx_].shape_gradients_[i_point][i_func_comp] = val;
600  }
601 
602  /**
603  * @brief Return the relative volume change of the cell (Jacobian determinant).
604  *
605  * If dim_==spacedim then the sign may be negative, otherwise the
606  * result is a positive number.
607  *
608  * @param point_no Number of the quadrature point.
609  */
610  inline double determinant(const unsigned int point_no)
611  {
612  ASSERT_LT(point_no, this->n_points_);
613  return element_data_[patch_data_idx_].elm_values_->determinant(point_no);
614  }
615 
616  /**
617  * @brief Return the product of Jacobian determinant and the quadrature
618  * weight at given quadrature point.
619  *
620  * @param point_no Number of the quadrature point.
621  */
622  inline double JxW(const unsigned int point_no)
623  {
624  ASSERT_LT(point_no, this->n_points_);
625  // TODO: This is temporary solution only for JxW on element.
626  return (object_type_==ElementFE) ? element_data_[patch_data_idx_].elm_values_->JxW(point_no)
627  : element_data_[patch_data_idx_].elm_values_->side_JxW(point_no);
628  }
629 
630  /**
631  * @brief Returns the normal vector to a side at given quadrature point.
632  *
633  * @param point_no Number of the quadrature point.
634  */
635  inline arma::vec::fixed<spacedim> normal_vector(unsigned int point_no)
636  {
637  ASSERT_LT(point_no, this->n_points_);
638  return element_data_[patch_data_idx_].elm_values_->normal_vector(point_no);
639  }
640 
641 
642 protected:
645  SideFE = 1
646  };
647 
649  {
650  public:
652 
653  /// Shape functions evaluated at the quadrature points.
655 
656  /// Gradients of shape functions evaluated at the quadrature points.
657  /// Each row of the matrix contains the gradient of one shape function.
659 
660  /// Auxiliary object for calculation of element-dependent data.
661  std::shared_ptr<ElementValues<spacedim> > elm_values_;
662 
663  };
664 
665  /// Set size of ElementFEData. Important: Use only during the initialization of FESystem !
666  void resize(unsigned int max_size) {
667  element_data_.resize(max_size);
668  }
669 
670  /// Implement @p FEValuesBase::allocate_in
671  void allocate_in(unsigned int q_dim) override;
672 
673  /// Implement @p FEValuesBase::initialize_in
674  void initialize_in(Quadrature &q, unsigned int dim) override;
675 
676  /// Implement @p FEValuesBase::initialize_in
677  void init_fe_val_vec() override;
678 
679  /// Patch index of processed element / side.
680  unsigned int patch_data_idx_;
681 
682  /// Map of element patch indexes to element_data_.
684 
685  /// Data of elements / sides on patch
687 
688  /// Number of elements / sides on patch. Must be less or equal to size of element_data vector
689  unsigned int used_size_;
690 
691  /// Maximal number of elements on patch.
692  unsigned int max_n_elem_;
693 
694  /// Distinguishes using of PatchFEValues for storing data of elements or sides.
696 
697 
698  friend class MapScalar<PatchFEValues<spacedim>, spacedim>;
699  friend class MapPiola<PatchFEValues<spacedim>, spacedim>;
700  friend class MapContravariant<PatchFEValues<spacedim>, spacedim>;
701  friend class MapVector<PatchFEValues<spacedim>, spacedim>;
702  friend class MapTensor<PatchFEValues<spacedim>, spacedim>;
703  friend class MapSystem<PatchFEValues<spacedim>, spacedim>;
704 };
705 
706 
707 
709  QGauss::array &quadrature,
711  UpdateFlags flags);
712 
713 
714 
715 
716 
717 
718 
719 #endif /* FE_VALUES_HH_ */
#define ASSERT_LT(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.
Definition: asserts.hh:301
Class for computation of data on cell and side.
Structure for storing the precomputed finite element data.
Definition: fe_values.hh:154
FEInternalData(const FEInternalData &fe_system_data, const std::vector< unsigned int > &dof_indices, unsigned int first_component_idx, unsigned int ncomps=1)
Create a new instance of FEInternalData for a FESystem component or subvector.
FEInternalData(unsigned int np, unsigned int nd)
Definition: fe_values.cc:49
unsigned int n_points
Number of quadrature points.
Definition: fe_values.hh:184
std::vector< std::vector< arma::vec > > ref_shape_values
Precomputed values of basis functions at the quadrature points.
Definition: fe_values.hh:172
std::vector< std::vector< arma::mat > > ref_shape_grads
Precomputed gradients of basis functions at the quadrature points.
Definition: fe_values.hh:181
unsigned int n_dofs
Number of dofs (shape functions).
Definition: fe_values.hh:187
UpdateFlags update_flags
Flags that indicate which finite element quantities are to be computed.
Definition: fe_values.hh:244
void allocate(Quadrature &_quadrature, FiniteElement< DIM > &_fe, UpdateFlags flags)
Allocates space for computed data.
Definition: fe_values.cc:176
unsigned int n_points_
Number of integration points.
Definition: fe_values.hh:226
FV * fv_
Helper object, we need its for ViewsCache initialization.
Definition: fe_values.hh:262
std::vector< shared_ptr< FEInternalData > > side_fe_data_
Precomputed FE data (shape functions on reference element) for all side quadrature points.
Definition: fe_values.hh:259
std::vector< unsigned int > fe_sys_n_space_components_
Numbers of components of FESystem sub-elements in real space.
Definition: fe_values.hh:241
FEType fe_type_
Type of finite element (scalar, vector, tensor).
Definition: fe_values.hh:232
unsigned int n_dofs_
Number of finite element dofs.
Definition: fe_values.hh:229
const FEValuesViews::Scalar< FV, spacedim > & scalar_view(unsigned int i) const
Accessor to scalar values of multicomponent FE.
Definition: fe_values.hh:126
unsigned int n_points() const
Returns the number of quadrature points.
Definition: fe_values.hh:107
virtual void init_fe_val_vec()=0
Initialize fe_values_vec only in PatchFEValues.
ViewsCache views_cache_
Auxiliary storage of FEValuesViews accessors.
Definition: fe_values.hh:253
virtual void allocate_in(unsigned int)=0
Initialize vectors declared separately in descendants.
void fill_data(const ElementValues< spacedim > &elm_values, const FEInternalData &fe_data)
Computes the shape function values and gradients on the actual cell and fills the FEValues structure.
Definition: fe_values.cc:257
std::vector< FV > fe_values_vec
Vector of FEValues for sub-elements of FESystem.
Definition: fe_values.hh:247
std::vector< unsigned int > fe_sys_n_components_
Numbers of components of FESystem sub-elements in reference space.
Definition: fe_values.hh:238
const FEValuesViews::Tensor< FV, spacedim > & tensor_view(unsigned int i) const
Accessor to tensor values of multicomponent FE.
Definition: fe_values.hh:146
std::vector< std::vector< unsigned int > > fe_sys_dofs_
Dof indices of FESystem sub-elements.
Definition: fe_values.hh:235
std::shared_ptr< typename FEValuesBase< FV, spacedim >::FEInternalData > init_fe_data(const FiniteElement< DIM > &fe, const Quadrature &q)
Precompute finite element data on reference element.
Definition: fe_values.cc:221
unsigned int n_components_
Number of components of the FE.
Definition: fe_values.hh:250
unsigned int dim() const
Return dimension of reference space.
Definition: fe_values.hh:119
FEValuesBase()
Default constructor with postponed initialization.
Definition: fe_values.cc:42
void fill_data_specialized(const ElementValues< spacedim > &elm_values, const FEInternalData &fe_data)
Computes the shape function values and gradients on the actual cell and fills the FEValues structure....
unsigned int n_dofs() const
Returns the number of shape functions.
Definition: fe_values.hh:113
void initialize(Quadrature &_quadrature, FiniteElement< DIM > &_fe, UpdateFlags _flags)
Initialize structures and calculates cell-independent data.
Definition: fe_values.cc:132
virtual void initialize_in(Quadrature &, unsigned int)=0
Initialize ElementValues separately in descendants.
std::shared_ptr< FEInternalData > fe_data_
Precomputed finite element data.
Definition: fe_values.hh:256
const FEValuesViews::Vector< FV, spacedim > & vector_view(unsigned int i) const
Accessor to vector values of multicomponent FE.
Definition: fe_values.hh:136
unsigned int dim_
Dimension of reference space.
Definition: fe_values.hh:223
Calculates finite element data on the actual cell.
Definition: fe_values.hh:288
double determinant(const unsigned int point_no)
Return the relative volume change of the cell (Jacobian determinant).
Definition: fe_values.hh:409
~FEValues()
Correct deallocation of objects created by 'initialize' methods.
Definition: fe_values.cc:317
void set_shape_value(unsigned int i_point, unsigned int i_func_comp, double val)
Definition: fe_values.hh:388
double JxW(const unsigned int point_no)
Return the product of Jacobian determinant and the quadrature weight at given quadrature point.
Definition: fe_values.hh:421
FEValues()
Default constructor with postponed initialization.
Definition: fe_values.cc:312
arma::vec::fixed< spacedim > shape_grad_component(const unsigned int function_no, const unsigned int point_no, const unsigned int comp) const
Return the gradient of the function_no-th shape function at the point_no-th quadrature point.
Definition: fe_values.cc:346
double shape_value(const unsigned int function_no, const unsigned int point_no) const
Return the value of the function_no-th shape function at the point_no-th quadrature point.
Definition: fe_values.hh:331
const Armor::array & point_list() const
Return coordinates of all quadrature points in the actual cell system.
Definition: fe_values.hh:444
FEValues(Quadrature &_quadrature, FiniteElement< DIM > &_fe, UpdateFlags _flags)
Definition: fe_values.hh:297
std::vector< std::vector< double > > shape_values_
Shape functions evaluated at the quadrature points.
Definition: fe_values.hh:475
void reinit(const ElementAccessor< spacedim > &cell)
Update cell-dependent data (gradients, Jacobians etc.)
Definition: fe_values.cc:563
void initialize_in(Quadrature &q, unsigned int dim) override
Implement FEValuesBase::initialize_in.
Definition: fe_values.cc:322
void init_fe_val_vec() override
Implement FEValuesBase::initialize_in.
Definition: fe_values.hh:471
arma::vec::fixed< spacedim > normal_vector(unsigned int point_no)
Returns the normal vector to a side at given quadrature point.
Definition: fe_values.hh:455
void set_shape_gradient(unsigned int i_point, unsigned int i_func_comp, arma::vec::fixed< spacedim > val)
Definition: fe_values.hh:396
double shape_value_component(const unsigned int function_no, const unsigned int point_no, const unsigned int comp) const
Return the value of the function_no-th shape function at the point_no-th quadrature point.
Definition: fe_values.hh:362
std::shared_ptr< ElementValues< spacedim > > elm_values_
Auxiliary object for calculation of element-dependent data.
Definition: fe_values.hh:482
arma::vec::fixed< spacedim > point(const unsigned int point_no)
Return coordinates of the quadrature point in the actual cell system.
Definition: fe_values.hh:434
arma::vec::fixed< spacedim > shape_grad(const unsigned int function_no, const unsigned int point_no) const
Return the gradient of the function_no-th shape function at the point_no-th quadrature point.
Definition: fe_values.hh:346
std::vector< std::vector< arma::vec::fixed< spacedim > > > shape_gradients_
Definition: fe_values.hh:479
void allocate_in(unsigned int q_dim) override
Implement FEValuesBase::allocate_in.
Definition: fe_values.cc:332
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
Helper class allows update values and gradients of FEValues of FEVectorContravariant type.
Helper class allows update values and gradients of FEValues of FEVectorPiola type.
Helper class allows update values and gradients of FEValues of FEScalar type.
Helper class allows update values and gradients of FEValues of FEMixedSystem type.
Helper class allows update values and gradients of FEValues of FETensor type.
Helper class allows update values and gradients of FEValues of FEVector type.
std::vector< std::vector< arma::vec::fixed< spacedim > > > shape_gradients_
Definition: fe_values.hh:658
std::shared_ptr< ElementValues< spacedim > > elm_values_
Auxiliary object for calculation of element-dependent data.
Definition: fe_values.hh:661
std::vector< std::vector< double > > shape_values_
Shape functions evaluated at the quadrature points.
Definition: fe_values.hh:654
void get_side(unsigned int patch_cell_idx, unsigned int side_idx)
Set element and side that are selected for processing. Element is given by index on patch.
Definition: fe_values.hh:520
unsigned int patch_data_idx_
Patch index of processed element / side.
Definition: fe_values.hh:680
arma::vec::fixed< spacedim > normal_vector(unsigned int point_no)
Returns the normal vector to a side at given quadrature point.
Definition: fe_values.hh:635
unsigned int max_size() const
Definition: fe_values.hh:510
void reinit(PatchElementsList patch_elements)
Reinit data.
PatchFEValues(unsigned int max_size=0)
Constructor, set maximal number of elements on patch.
double shape_value(const unsigned int function_no, const unsigned int point_no) const
Return the value of the function_no-th shape function at the point_no-th quadrature point.
Definition: fe_values.hh:531
void set_shape_gradient(unsigned int i_point, unsigned int i_func_comp, arma::vec::fixed< spacedim > val)
Definition: fe_values.hh:597
double determinant(const unsigned int point_no)
Return the relative volume change of the cell (Jacobian determinant).
Definition: fe_values.hh:610
void get_cell(const unsigned int patch_cell_idx)
Set element that is selected for processing. Element is given by index on patch.
Definition: fe_values.hh:515
double shape_value_component(const unsigned int function_no, const unsigned int point_no, const unsigned int comp) const
Return the value of the function_no-th shape function at the point_no-th quadrature point.
Definition: fe_values.hh:562
unsigned int max_n_elem_
Maximal number of elements on patch.
Definition: fe_values.hh:692
double JxW(const unsigned int point_no)
Return the product of Jacobian determinant and the quadrature weight at given quadrature point.
Definition: fe_values.hh:622
std::vector< ElementFEData > element_data_
Data of elements / sides on patch.
Definition: fe_values.hh:686
unsigned int used_size_
Number of elements / sides on patch. Must be less or equal to size of element_data vector.
Definition: fe_values.hh:689
void init_fe_val_vec() override
Implement FEValuesBase::initialize_in.
MeshObjectType object_type_
Distinguishes using of PatchFEValues for storing data of elements or sides.
Definition: fe_values.hh:695
void set_shape_value(unsigned int i_point, unsigned int i_func_comp, double val)
Definition: fe_values.hh:589
unsigned int used_size() const
Definition: fe_values.hh:506
arma::vec::fixed< spacedim > shape_grad(const unsigned int function_no, const unsigned int point_no) const
Return the gradient of the function_no-th shape function at the point_no-th quadrature point.
Definition: fe_values.hh:546
arma::vec::fixed< spacedim > shape_grad_component(const unsigned int function_no, const unsigned int point_no, const unsigned int comp) const
Return the gradient of the function_no-th shape function at the point_no-th quadrature point.
void allocate_in(unsigned int q_dim) override
Implement FEValuesBase::allocate_in.
void initialize_in(Quadrature &q, unsigned int dim) override
Implement FEValuesBase::initialize_in.
std::map< unsigned int, unsigned int > element_patch_map_
Map of element patch indexes to element_data_.
Definition: fe_values.hh:683
void resize(unsigned int max_size)
Set size of ElementFEData. Important: Use only during the initialization of FESystem !
Definition: fe_values.hh:666
std::array< QGauss, 4 > array
Base class for quadrature rules on simplices in arbitrary dimensions.
Definition: quadrature.hh:48
Class ElementValues calculates data related to transformation of reference cell to actual cell (Jacob...
std::vector< FEValues< 3 > > mixed_fe_values(QGauss::array &quadrature, MixedPtr< FiniteElement > fe, UpdateFlags flags)
Definition: fe_values.cc:688
std::list< std::pair< ElementAccessor< 3 >, unsigned int > > PatchElementsList
Definition: fe_values.hh:48
FEType
Definitions of particular quadrature rules on simplices.
Class RefElement defines numbering of vertices, sides, calculation of normal vectors etc.
vector< FEValuesViews::Scalar< FV, spacedim > > scalars
Definition: fe_values.hh:66
vector< FEValuesViews::Vector< FV, spacedim > > vectors
Definition: fe_values.hh:67
void initialize(const FV &fv, const FiniteElement< DIM > &fe)
Definition: fe_values.cc:77
vector< FEValuesViews::Tensor< FV, spacedim > > tensors
Definition: fe_values.hh:68
Enum type UpdateFlags indicates which quantities are to be recomputed on each finite element cell.
UpdateFlags
Enum type UpdateFlags indicates which quantities are to be recomputed on each finite element cell.
Definition: update_flags.hh:68