Flow123d  release_3.0.0-1026-ga6b0c21
fe_values.cc
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.cc
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 #include "fem/mapping.hh"
22 #include "quadrature/quadrature.hh"
23 #include "fem/finite_element.hh"
24 #include "fem/fe_values.hh"
25 #include "fem/fe_system.hh"
26 
27 
28 
29 using namespace arma;
30 using namespace std;
31 
32 
33 
34 
35 
36 
37 
38 
39 FEInternalData::FEInternalData(unsigned int np, unsigned int nd)
40  : n_points(np),
41  n_dofs(nd)
42 {
43  ref_shape_values.resize(np, vector<arma::vec>(nd));
44  ref_shape_grads.resize(np, vector<arma::mat>(nd));
45 }
46 
47 
48 
49 template<unsigned int dim, unsigned int spacedim>
50 void FEValuesData<dim,spacedim>::allocate(unsigned int size, UpdateFlags flags, unsigned int n_comp)
51 {
52  update_flags = flags;
53 
54  // resize the arrays of computed quantities
55  if (update_flags & update_jacobians)
56  jacobians.resize(size);
57 
58  if (update_flags & update_volume_elements)
59  determinants.resize(size);
60 
61  if ((update_flags & update_JxW_values) |
62  (update_flags & update_side_JxW_values))
63  JxW_values.resize(size);
64 
65  if (update_flags & update_inverse_jacobians)
66  inverse_jacobians.resize(size);
67 
68  if (update_flags & update_values)
69  {
70  shape_values.resize(size, vector<double>(n_comp));
71  }
72 
73  if (update_flags & update_gradients)
74  {
75  shape_gradients.resize(size, vector<arma::vec::fixed<spacedim> >(n_comp));
76  }
77 
78  if (update_flags & update_quadrature_points)
79  points.resize(size);
80 
81  if (update_flags & update_normal_vectors)
82  normal_vectors.resize(size);
83 }
84 
85 
86 template<unsigned int dim, unsigned int spacedim>
88 {
89  scalars.clear();
90  vectors.clear();
91  tensors.clear();
92  switch (fv.get_fe()->type_) {
93  case FEType::FEScalar:
94  scalars.push_back(FEValuesViews::Scalar<dim,spacedim>(fv, 0));
95  break;
96  case FEType::FEVector:
99  vectors.push_back(FEValuesViews::Vector<dim,spacedim>(fv, 0));
100  break;
101  case FEType::FETensor:
102  tensors.push_back(FEValuesViews::Tensor<dim,spacedim>(fv, 0));
103  break;
105  FESystem<dim> *fe = dynamic_cast<FESystem<dim>*>(fv.get_fe());
106  OLD_ASSERT(fe != nullptr, "Mixed system must be represented by FESystem.");
110  for (auto si : sc)
111  scalars.push_back(FEValuesViews::Scalar<dim,spacedim>(fv,si));
112  for (auto vi : vc)
113  vectors.push_back(FEValuesViews::Vector<dim,spacedim>(fv,vi));
114  for (auto ti : tc)
115  tensors.push_back(FEValuesViews::Tensor<dim,spacedim>(fv,ti));
116  break;
117  }
118 }
119 
120 
121 
122 template<unsigned int dim,unsigned int spacedim>
124 : mapping(NULL), quadrature(NULL), fe(NULL), mapping_data(NULL), fe_data(NULL)
125 {
126 }
127 
128 
129 
130 template<unsigned int dim,unsigned int spacedim>
132  if (mapping_data) delete mapping_data;
133  if (fe_data) delete fe_data;
134 }
135 
136 
137 
138 template<unsigned int dim, unsigned int spacedim>
140  Quadrature<dim> & _quadrature,
141  FiniteElement<dim> & _fe,
142  UpdateFlags _flags)
143 {
144  // For FEVector and FETensor check number of components.
145  // This cannot be done in FiniteElement since it does not know spacedim.
146  if (_fe.type_ == FEVector)
147  ASSERT_DBG(_fe.n_components() == spacedim).error("FEVector must have spacedim components.");
148  else if (_fe.type_ == FETensor)
149  ASSERT_DBG(_fe.n_components() == spacedim*spacedim).error("FETensor must have spacedim*spacedim components.");
150 
151  mapping = &_mapping;
152  quadrature = &_quadrature;
153  fe = &_fe;
154 
155  switch (fe->type_) {
156  case FEScalar:
157  n_components_ = 1;
158  break;
159  case FEVector:
161  case FEVectorPiola:
162  n_components_ = spacedim;
163  break;
164  case FETensor:
165  n_components_ = spacedim*spacedim;
166  break;
167  case FEMixedSystem:
168  n_components_ = fe->n_components();
169  break;
170  }
171  // add flags required by the finite element or mapping
172  data.allocate(quadrature->size(), update_each(_flags), fe->n_dofs()*n_components_);
173 
174  views_cache_.initialize(*this);
175 }
176 
177 
178 
179 template<unsigned int dim, unsigned int spacedim>
181 {
182  FEInternalData *data = new FEInternalData(q->size(), fe->n_dofs());
183 
184  arma::mat shape_values(fe->n_dofs(), fe->n_components());
185  for (unsigned int i=0; i<q->size(); i++)
186  {
187  for (unsigned int j=0; j<fe->n_dofs(); j++)
188  {
189  for (unsigned int c=0; c<fe->n_components(); c++)
190  shape_values(j,c) = fe->shape_value(j, q->point(i), c);
191 
192  data->ref_shape_values[i][j] = trans(shape_values.row(j));
193  }
194  }
195 
196  arma::mat grad(dim, fe->n_components());
197  for (unsigned int i=0; i<q->size(); i++)
198  {
199  for (unsigned int j=0; j<fe->n_dofs(); j++)
200  {
201  grad.zeros();
202  for (unsigned int c=0; c<fe->n_components(); c++)
203  grad.col(c) += fe->shape_grad(j, q->point(i), c);
204 
205  data->ref_shape_grads[i][j] = grad;
206  }
207  }
208 
209  return data;
210 }
211 
212 
213 
214 template<unsigned int dim, unsigned int spacedim>
216 {
217  UpdateFlags f = flags | fe->update_each(flags);
218  f |= mapping->update_each(f);
219  return f;
220 }
221 
222 
223 template<unsigned int dim, unsigned int spacedim>
224 double FEValuesBase<dim,spacedim>::shape_value(const unsigned int function_no, const unsigned int point_no)
225 {
226  ASSERT_LT_DBG(function_no, fe->n_dofs());
227  ASSERT_LT_DBG(point_no, quadrature->size());
228  return data.shape_values[point_no][function_no];
229 }
230 
231 
232 template<unsigned int dim, unsigned int spacedim>
233 arma::vec::fixed<spacedim> FEValuesBase<dim,spacedim>::shape_grad(const unsigned int function_no, const unsigned int point_no)
234 {
235  ASSERT_LT_DBG(function_no, fe->n_dofs());
236  ASSERT_LT_DBG(point_no, quadrature->size());
237  return data.shape_gradients[point_no][function_no];
238 }
239 
240 
241 template<unsigned int dim, unsigned int spacedim>
242 double FEValuesBase<dim,spacedim>::shape_value_component(const unsigned int function_no,
243  const unsigned int point_no,
244  const unsigned int comp) const
245 {
246  ASSERT_LT_DBG(function_no, fe->n_dofs());
247  ASSERT_LT_DBG(point_no, quadrature->size());
249  return data.shape_values[point_no][function_no*n_components_+comp];
250 }
251 
252 
253 template<unsigned int dim, unsigned int spacedim>
254 arma::vec::fixed<spacedim> FEValuesBase<dim,spacedim>::shape_grad_component(const unsigned int function_no,
255  const unsigned int point_no,
256  const unsigned int comp) const
257 {
258  ASSERT_LT_DBG(function_no, fe->n_dofs());
259  ASSERT_LT_DBG(point_no, quadrature->size());
261  return data.shape_gradients[point_no][function_no*n_components_+comp];
262 }
263 
264 
265 template<unsigned int dim, unsigned int spacedim>
267 {
268  ASSERT_DBG(fe->type_ == FEScalar);
269 
270  // shape values
271  if (data.update_flags & update_values)
272  for (unsigned int i = 0; i < fe_data.n_points; i++)
273  for (unsigned int j = 0; j < fe_data.n_dofs; j++)
274  data.shape_values[i][j] = fe_data.ref_shape_values[i][j][0];
275 
276  // shape gradients
277  if (data.update_flags & update_gradients)
278  for (unsigned int i = 0; i < fe_data.n_points; i++)
279  for (unsigned int j = 0; j < fe_data.n_dofs; j++)
280  data.shape_gradients[i][j] = trans(data.inverse_jacobians[i]) * fe_data.ref_shape_grads[i][j];
281 }
282 
283 
284 template<unsigned int dim, unsigned int spacedim>
286 {
287  ASSERT_DBG(fe->type_ == FEVector);
288 
289  // shape values
290  if (data.update_flags & update_values)
291  {
292  for (unsigned int i = 0; i < fe_data.n_points; i++)
293  for (unsigned int j = 0; j < fe_data.n_dofs; j++)
294  {
295  arma::vec fv_vec = fe_data.ref_shape_values[i][j];
296  for (unsigned int c=0; c<spacedim; c++)
297  data.shape_values[i][j*spacedim+c] = fv_vec[c];
298  }
299  }
300 
301  // shape gradients
302  if (data.update_flags & update_gradients)
303  {
304  for (unsigned int i = 0; i < fe_data.n_points; i++)
305  for (unsigned int j = 0; j < fe_data.n_dofs; j++)
306  {
307  arma::mat grads = trans(data.inverse_jacobians[i]) * fe_data.ref_shape_grads[i][j];
308  for (unsigned int c=0; c<spacedim; c++)
309  data.shape_gradients[i][j*spacedim+c] = grads.col(c);
310  }
311  }
312 }
313 
314 
315 template<unsigned int dim, unsigned int spacedim>
317 {
319 
320  // shape values
321  if (data.update_flags & update_values)
322  {
323  for (unsigned int i = 0; i < fe_data.n_points; i++)
324  for (unsigned int j = 0; j < fe_data.n_dofs; j++)
325  {
326  arma::vec fv_vec = data.jacobians[i] * fe_data.ref_shape_values[i][j];
327  for (unsigned int c=0; c<spacedim; c++)
328  data.shape_values[i][j*spacedim+c] = fv_vec[c];
329  }
330  }
331 
332  // shape gradients
333  if (data.update_flags & update_gradients)
334  {
335  for (unsigned int i = 0; i < fe_data.n_points; i++)
336  for (unsigned int j = 0; j < fe_data.n_dofs; j++)
337  {
338  arma::mat grads = trans(data.inverse_jacobians[i]) * fe_data.ref_shape_grads[i][j] * trans(data.jacobians[i]);
339  for (unsigned int c=0; c<spacedim; c++)
340  data.shape_gradients[i][j*spacedim+c] = grads.col(c);
341  }
342  }
343 }
344 
345 
346 template<unsigned int dim, unsigned int spacedim>
348 {
349  ASSERT_DBG(fe->type_ == FEVectorPiola);
350 
351  // shape values
352  if (data.update_flags & update_values)
353  {
354  for (unsigned int i = 0; i < fe_data.n_points; i++)
355  for (unsigned int j = 0; j < fe_data.n_dofs; j++)
356  {
357  arma::vec fv_vec = data.jacobians[i]*fe_data.ref_shape_values[i][j]/data.determinants[i];
358  for (unsigned int c=0; c<spacedim; c++)
359  data.shape_values[i][j*spacedim+c] = fv_vec(c);
360  }
361  }
362 
363  // shape gradients
364  if (data.update_flags & update_gradients)
365  {
366  for (unsigned int i = 0; i < fe_data.n_points; i++)
367  for (unsigned int j = 0; j < fe_data.n_dofs; j++)
368  {
369  arma::mat grads = trans(data.inverse_jacobians[i]) * fe_data.ref_shape_grads[i][j] * trans(data.jacobians[i])
370  / data.determinants[i];
371  for (unsigned int c=0; c<spacedim; c++)
372  data.shape_gradients[i][j*spacedim+c] = grads.col(c);
373  }
374  }
375 }
376 
377 
378 template<unsigned int dim, unsigned int spacedim>
380 {
381  ASSERT_DBG(fe->type_ == FETensor);
382 
383  // shape values
384  if (data.update_flags & update_values)
385  {
386  for (unsigned int i = 0; i < fe_data.n_points; i++)
387  for (unsigned int j = 0; j < fe_data.n_dofs; j++)
388  {
389  arma::vec fv_vec = fe_data.ref_shape_values[i][j];
390  for (unsigned int c=0; c<spacedim*spacedim; c++)
391  data.shape_values[i][j*spacedim*spacedim+c] = fv_vec[c];
392  }
393  }
394 
395  // shape gradients
396  if (data.update_flags & update_gradients)
397  {
398  for (unsigned int i = 0; i < fe_data.n_points; i++)
399  for (unsigned int j = 0; j < fe_data.n_dofs; j++)
400  {
401  arma::mat grads = trans(data.inverse_jacobians[i]) * fe_data.ref_shape_grads[i][j];
402  for (unsigned int c=0; c<spacedim*spacedim; c++)
403  data.shape_gradients[i][j*spacedim*spacedim+c] = grads.col(c);
404  }
405  }
406 }
407 
408 
409 template<unsigned int dim, unsigned int spacedim>
411 {
412  ASSERT_DBG(fe->type_ == FEMixedSystem);
413 
414  // for mixed system we first fill data in sub-elements
415  FESystem<dim> *fe_sys = dynamic_cast<FESystem<dim>*>(fe);
416  ASSERT_DBG(fe_sys != nullptr).error("Mixed system must be represented by FESystem.");
417  for (unsigned int f=0; f<fe_sys->fe().size(); f++)
418  {
419  // fill fe_values for base FE
420  fe_values_vec[f]->data.jacobians = data.jacobians;
421  fe_values_vec[f]->data.inverse_jacobians = data.inverse_jacobians;
422  fe_values_vec[f]->data.determinants = data.determinants;
423  fe_values_vec[f]->fill_data(*fe_values_vec[f]->fe_data);
424  }
425 
426  // shape values
427  if (data.update_flags & update_values)
428  {
429  /// initialize gradients by zeros since we fill only some components
430  for (unsigned int i=0; i<fe_data.n_points; i++)
431  for (unsigned int j=0; j<fe_sys->n_dofs()*fe_sys->function_space_->n_components(); j++)
432  data.shape_values[i][j] = 0;
433 
434  arma::vec fv_vec;
435  unsigned int comp_offset = 0;
436  unsigned int shape_offset = 0;
437  for (unsigned int f=0; f<fe_sys->fe().size(); f++)
438  {
439  // gather fe_values in vectors for FESystem
440  for (unsigned int i=0; i<fe_data.n_points; i++)
441  for (unsigned int n=0; n<fe_sys->fe()[f]->n_dofs(); n++)
442  for (unsigned int c=0; c<fe_sys->fe()[f]->n_components(); c++)
443  data.shape_values[i][shape_offset+fe_sys->function_space_->n_components()*n+comp_offset+c] = fe_values_vec[f]->data.shape_values[i][n*fe_sys->fe()[f]->n_components()+c];
444 
445  comp_offset += fe_sys->fe()[f]->n_components();
446  shape_offset += fe_sys->fe()[f]->n_dofs()*fe_sys->function_space_->n_components();
447  }
448  }
449 
450  // shape gradients
451  if (data.update_flags & update_gradients)
452  {
453  /// initialize gradients by zeros since we fill only some components
454  for (unsigned int i=0; i<fe_data.n_points; i++)
455  for (unsigned int j=0; j<fe_sys->n_dofs()*fe_sys->function_space_->n_components(); j++)
456  data.shape_gradients[i][j].zeros();
457 
458  arma::mat grads;
459  unsigned int comp_offset = 0;
460  unsigned int shape_offset = 0;
461  for (unsigned int f=0; f<fe_sys->fe().size(); f++)
462  {
463  // gather fe_values in vectors for FESystem
464  for (unsigned int i=0; i<fe_data.n_points; i++)
465  for (unsigned int n=0; n<fe_sys->fe()[f]->n_dofs(); n++)
466  for (unsigned int c=0; c<fe_sys->fe()[f]->n_components(); c++)
467  data.shape_gradients[i][shape_offset+fe_sys->function_space_->n_components()*n+comp_offset+c] = fe_values_vec[f]->data.shape_gradients[i][n*fe_sys->fe()[f]->n_components()+c];
468 
469  comp_offset += fe_sys->fe()[f]->n_components();
470  shape_offset += fe_sys->fe()[f]->n_dofs()*fe_sys->function_space_->n_components();
471  }
472  }
473 
474 }
475 
476 
477 template<unsigned int dim, unsigned int spacedim>
479 {
480  switch (fe->type_) {
481  case FEScalar:
482  fill_scalar_data(fe_data);
483  break;
484  case FEVector:
485  fill_vec_data(fe_data);
486  break;
489  break;
490  case FEVectorPiola:
491  fill_vec_piola_data(fe_data);
492  break;
493  case FETensor:
494  fill_tensor_data(fe_data);
495  break;
496  case FEMixedSystem:
497  fill_system_data(fe_data);
498  break;
499  default:
500  ASSERT(false).error("Not implemented.");
501  }
502 }
503 
504 
505 
506 
507 
508 
509 
510 
511 template<unsigned int dim, unsigned int spacedim>
513  Quadrature<dim> &_quadrature,
514  FiniteElement<dim> &_fe,
515  UpdateFlags _flags)
516 :FEValuesBase<dim, spacedim>()
517 {
518  this->allocate(_mapping, _quadrature, _fe, _flags);
519 
520  // precompute the maping data and finite element data
521  this->mapping_data = this->mapping->initialize(*this->quadrature, this->data.update_flags);
522  this->fe_data = this->init_fe_data(this->quadrature);
523 
524  // In case of mixed system allocate data for sub-elements.
525  if (this->fe->type_ == FEMixedSystem)
526  {
527  FESystem<dim> *fe = dynamic_cast<FESystem<dim>*>(this->fe);
528  ASSERT_DBG(fe != nullptr).error("Mixed system must be represented by FESystem.");
529 
530  for (auto fe_sub : fe->fe())
531  this->fe_values_vec.push_back(make_shared<FEValues<dim,spacedim> >(_mapping, _quadrature, *fe_sub, _flags));
532  }
533 }
534 
535 
536 
537 template<unsigned int dim,unsigned int spacedim>
539 {
540  OLD_ASSERT_EQUAL( dim, cell->dim() );
541  this->data.present_cell = &cell;
542 
543  // calculate Jacobian of mapping, JxW, inverse Jacobian, normal vector(s)
544  this->mapping->fill_fe_values(cell,
545  *this->quadrature,
546  *this->mapping_data,
547  this->data);
548 
549  this->fill_data(*this->fe_data);
550 }
551 
552 
553 
554 
555 
556 
557 
558 
559 
560 template<unsigned int dim,unsigned int spacedim>
562  Quadrature<dim-1> & _sub_quadrature,
563  FiniteElement<dim> & _fe,
564  const UpdateFlags _flags)
565 :FEValuesBase<dim,spacedim>()
566 {
567  sub_quadrature = &_sub_quadrature;
568  Quadrature<dim> *q = new Quadrature<dim>(_sub_quadrature.size());
569  this->allocate(_mapping, *q, _fe, _flags);
570 
571  for (unsigned int sid = 0; sid < RefElement<dim>::n_sides; sid++)
572  {
573  for (unsigned int pid = 0; pid < RefElement<dim>::n_side_permutations; pid++)
574  {
575  // transform the side quadrature points to the cell quadrature points
576  side_quadrature[sid][pid] = Quadrature<dim>(_sub_quadrature, sid, pid);
577  side_mapping_data[sid][pid] = this->mapping->initialize(side_quadrature[sid][pid], this->data.update_flags);
578  side_fe_data[sid][pid] = this->init_fe_data(&side_quadrature[sid][pid]);
579  }
580  }
581 
582  // In case of mixed system allocate data for sub-elements.
583  if (this->fe->type_ == FEMixedSystem)
584  {
585  FESystem<dim> *fe = dynamic_cast<FESystem<dim>*>(this->fe);
586  ASSERT_DBG(fe != nullptr).error("Mixed system must be represented by FESystem.");
587 
588  for (auto fe_sub : fe->fe())
589  this->fe_values_vec.push_back(make_shared<FESideValues<dim,spacedim> >(_mapping, _sub_quadrature, *fe_sub, _flags));
590  }
591 }
592 
593 
594 
595 template<unsigned int dim,unsigned int spacedim>
597 {
598  for (unsigned int sid=0; sid<RefElement<dim>::n_sides; sid++)
599  {
600  for (unsigned int pid=0; pid<RefElement<dim>::n_side_permutations; pid++)
601  {
602  delete side_mapping_data[sid][pid];
603  delete side_fe_data[sid][pid];
604  }
605  }
606 
607  // Since quadrature is an auxiliary internal variable allocated
608  // by the constructor, it must be destroyed here.
609  delete this->quadrature;
610 }
611 
612 
613 template<unsigned int dim,unsigned int spacedim>
615  unsigned int sid)
616 {
617  ASSERT_LT_DBG( sid, cell->n_sides());
618  ASSERT_EQ_DBG(dim, cell->dim());
619  this->data.present_cell = &cell;
620 
621  unsigned int pid = cell->permutation_idx(sid);
623  // calculate Jacobian of mapping, JxW, inverse Jacobian, normal vector(s)
624  this->mapping->fill_fe_side_values(cell,
625  sid,
626  side_quadrature[sid][pid],
627  *side_mapping_data[sid][pid],
628  this->data);
629 
630  // calculation of finite element data
631  this->fill_data(*side_fe_data[sid][pid]);
632 }
633 
634 
635 
636 
637 
638 
639 
640 template class FEValuesBase<0,3>;
641 template class FEValuesBase<1,3>;
642 template class FEValuesBase<2,3>;
643 template class FEValuesBase<3,3>;
644 
645 template class FEValues<0,3>;
646 template class FEValues<1,3>;
647 template class FEValues<2,3>;
648 template class FEValues<3,3>;
649 
650 template class FESideValues<1,3>;
651 template class FESideValues<2,3>;
652 template class FESideValues<3,3>;
653 
Shape function values.
Definition: update_flags.hh:87
UpdateFlags
Enum type UpdateFlags indicates which quantities are to be recomputed on each finite element cell...
Definition: update_flags.hh:67
void fill_vec_contravariant_data(const FEInternalData &fe_data)
Compute shape functions and gradients on the actual cell for vectorial FE.
Definition: fe_values.cc:316
const std::vector< std::shared_ptr< FiniteElement< dim > > > & fe()
Definition: fe_system.hh:140
Transformed quadrature weight for cell sides.
#define ASSERT_EQ_DBG(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
Definition: asserts.hh:331
std::vector< unsigned int > get_tensor_components() const
Definition: fe_system.hh:135
void reinit(ElementAccessor< 3 > &cell, unsigned int sid)
Update cell-dependent data (gradients, Jacobians etc.)
Definition: fe_values.cc:614
void fill_scalar_data(const FEInternalData &fe_data)
Compute shape functions and gradients on the actual cell for scalar FE.
Definition: fe_values.cc:266
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:254
Determinant of the Jacobian.
void fill_data(const FEInternalData &fe_data)
Computes the shape function values and gradients on the actual cell and fills the FEValues structure...
Definition: fe_values.cc:478
void allocate(Mapping< dim, spacedim > &_mapping, Quadrature< dim > &_quadrature, FiniteElement< dim > &_fe, UpdateFlags flags)
Allocates space for computed data.
Definition: fe_values.cc:139
MappingInternalData * mapping_data
Precomputed mapping data.
Definition: fe_values.hh:495
void initialize(FEValuesBase &fv)
Definition: fe_values.cc:87
UpdateFlags update_each(UpdateFlags flags)
Determine quantities to be recomputed on each cell.
Definition: fe_values.cc:215
virtual ~FEValuesBase()
Definition: fe_values.cc:131
FEValuesBase()
Default constructor.
Definition: fe_values.cc:123
Class FEValues calculates finite element data on the actual cells such as shape function values...
FEValuesData< dim, spacedim > data
Data computed by the mapping and finite element.
Definition: fe_values.hh:505
Class FESystem for compound finite elements.
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
Definition: asserts.hh:346
std::vector< unsigned int > get_scalar_components() const
Definition: fe_system.hh:129
FEInternalData * fe_data
Precomputed finite element data.
Definition: fe_values.hh:500
FiniteElement< dim > * get_fe() const
Returns the finite element in use.
Definition: fe_values.hh:432
void allocate(unsigned int size, UpdateFlags flags, unsigned n_comp)
Resize the data arrays.
Definition: fe_values.cc:50
Base class for quadrature rules on simplices in arbitrary dimensions.
Definition: fe_values.hh:35
Volume element.
unsigned int n_components_
Number of components of the FE.
Definition: fe_values.hh:511
virtual ~FESideValues()
Destructor.
Definition: fe_values.cc:596
FEValues(Mapping< dim, spacedim > &_mapping, Quadrature< dim > &_quadrature, FiniteElement< dim > &_fe, UpdateFlags _flags)
Constructor.
Definition: fe_values.cc:512
unsigned int dim() const
Definition: elements.h:124
#define OLD_ASSERT(...)
Definition: global_defs.h:131
Transformed quadrature points.
std::vector< unsigned int > get_vector_components() const
Definition: fe_system.hh:132
Abstract class for the mapping between reference and actual cell.
Definition: fe_values.hh:38
Compound finite element on dim dimensional simplex.
Definition: fe_system.hh:99
void fill_tensor_data(const FEInternalData &fe_data)
Compute shape functions and gradients on the actual cell for tensorial FE.
Definition: fe_values.cc:379
unsigned int n_sides() const
Definition: elements.h:135
void fill_system_data(const FEInternalData &fe_data)
Compute shape functions and gradients on the actual cell for mixed system of FE.
Definition: fe_values.cc:410
void fill_vec_piola_data(const FEInternalData &fe_data)
Compute shape functions and gradients on the actual cell for Raviart-Thomas FE.
Definition: fe_values.cc:347
unsigned int n_components() const
Returns numer of components of the basis function.
Basic definitions of numerical quadrature rules.
const Quadrature< dim-1 > * sub_quadrature
Quadrature for the integration on the element sides.
Definition: fe_values.hh:617
Shape function gradients.
Definition: update_flags.hh:95
MappingInternalData * side_mapping_data[RefElement< dim >::n_sides][RefElement< dim >::n_side_permutations]
Definition: fe_values.hh:621
Quadrature< dim > side_quadrature[RefElement< dim >::n_sides][RefElement< dim >::n_side_permutations]
Definition: fe_values.hh:619
FEInternalData * init_fe_data(const Quadrature< dim > *q)
Precompute finite element data on reference element.
Definition: fe_values.cc:180
FEInternalData(unsigned int np, unsigned int nd)
Definition: fe_values.cc:39
Quadrature< dim > * quadrature
The quadrature rule used to calculate integrals.
Definition: fe_values.hh:485
double shape_value(const unsigned int function_no, const unsigned int point_no)
Return the value of the function_no-th shape function at the point_no-th quadrature point...
Definition: fe_values.cc:224
Class Mapping calculates data related to the mapping of the reference cell to the actual cell...
Normal vectors.
void fill_vec_data(const FEInternalData &fe_data)
Compute shape functions and gradients on the actual cell for vectorial FE.
Definition: fe_values.cc:285
std::vector< std::vector< arma::mat > > ref_shape_grads
Precomputed gradients of basis functions at the quadrature points.
Definition: fe_values.hh:69
FEInternalData * side_fe_data[RefElement< dim >::n_sides][RefElement< dim >::n_side_permutations]
Definition: fe_values.hh:623
FESideValues(Mapping< dim, spacedim > &_mapping, Quadrature< dim-1 > &_sub_quadrature, FiniteElement< dim > &_fe, UpdateFlags flags)
Constructor.
Definition: fe_values.cc:561
ViewsCache views_cache_
Auxiliary storage of FEValuesViews accessors.
Definition: fe_values.hh:514
std::shared_ptr< FunctionSpace > function_space_
Function space defining the FE.
const unsigned int n_dofs() const
Returns the number of degrees of freedom needed by the finite element.
Mapping< dim, spacedim > * mapping
The mapping from the reference cell to the actual cell.
Definition: fe_values.hh:480
const unsigned int size() const
Returns number of quadrature points.
Definition: quadrature.hh:139
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.cc:242
FiniteElement< dim > * fe
The used finite element.
Definition: fe_values.hh:490
#define ASSERT_DBG(expr)
Definition: asserts.hh:349
arma::vec::fixed< spacedim > shape_grad(const unsigned int function_no, const unsigned int point_no)
Return the gradient of the function_no-th shape function at the point_no-th quadrature point...
Definition: fe_values.cc:233
const arma::vec::fixed< dim > & point(const unsigned int i) const
Returns the ith quadrature point.
Definition: quadrature.hh:144
Calculates finite element data on the actual cell.
Definition: fe_values.hh:532
unsigned int n_points
Number of quadrature points.
Definition: fe_values.hh:72
#define OLD_ASSERT_EQUAL(a, b)
Definition: global_defs.h:133
std::vector< std::shared_ptr< FEValuesBase< dim, spacedim > > > fe_values_vec
Vector of FEValues for sub-elements of FESystem.
Definition: fe_values.hh:508
Structure for storing the precomputed finite element data.
Definition: fe_values.hh:47
std::vector< std::vector< arma::vec > > ref_shape_values
Precomputed values of basis functions at the quadrature points.
Definition: fe_values.hh:60
Abstract class for description of finite elements.
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
Base class for FEValues and FESideValues.
Definition: fe_values.hh:37
unsigned int n_dofs
Number of dofs (shape functions).
Definition: fe_values.hh:75
unsigned int permutation_idx(unsigned int prm_idx) const
Return permutation_idx of given index.
Definition: elements.h:144
void reinit(ElementAccessor< 3 > &cell)
Update cell-dependent data (gradients, Jacobians etc.)
Definition: fe_values.cc:538
Transformed quadrature weights.
FEType type_
Type of FiniteElement.
Calculates finite element data on a side.
Definition: fe_values.hh:577
#define ASSERT_LT_DBG(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.
Definition: asserts.hh:299