Flow123d  release_2.2.0-914-gf1a3a4f
fe_values_views.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_system.hh
15  * @brief Class FESystem for compound finite elements.
16  * @author Jan Stebel
17  */
18 
19 #ifndef FE_VALUES_VIEWS_HH
20 #define FE_VALUES_VIEWS_HH
21 
22 #include <vector>
23 #include <armadillo>
24 
25 template<unsigned int dim, unsigned int spacedim> class FEValuesBase;
26 
27 
28 
29 /**
30  * FEValuesViews classes realize access to shape functions and their derivatives
31  * for scalar, vector, tensor etc. part of the finite element.
32  *
33  * The classes are motivated by deal.II.
34  */
35 namespace FEValuesViews {
36 
37  template<unsigned int dim, unsigned int spacedim>
38  class Scalar {
39 
40  public:
41 
42  Scalar(FEValuesBase<dim,spacedim> &fe_values, unsigned int component)
43  : fe_values_(fe_values),
44  component_(component)
45  {};
46 
47  /**
48  * @brief Return value of scalar shape function.
49  * @param function_no Index of shape function within the FE.
50  * @param point_no Index of quadrature point.
51  */
52  double value(unsigned int function_no, unsigned int point_no) const;
53 
54  /**
55  * @brief Return gradient of scalar shape function.
56  * @param function_no Index of shape function within the FE.
57  * @param point_no Index of quadrature point.
58  */
59  arma::vec::fixed<spacedim> grad(unsigned int function_no, unsigned int point_no) const;
60 
61  /// Returns the FEValuesBase class.
63 
64  private:
65 
66  /// Base FEValues class for access to the FE.
68 
69  /// Index of the scalar component.
70  unsigned int component_;
71  };
72 
73 
74  template<unsigned int dim, unsigned int spacedim>
75  class Vector {
76 
77  public:
78 
79  Vector(FEValuesBase<dim,spacedim> &fe_values, unsigned int component)
80  : fe_values_(fe_values),
81  first_vector_component_(component)
82  {};
83 
84  /**
85  * @brief Return value of vector-valued shape function.
86  * @param function_no Index of shape function within the FE.
87  * @param point_no Index of quadrature point.
88  */
89  arma::vec::fixed<spacedim> value(unsigned int function_no, unsigned int point_no) const;
90 
91  /**
92  * @brief Return gradient of vector-valued shape function.
93  * @param function_no Index of shape function within the FE.
94  * @param point_no Index of quadrature point.
95  */
96  arma::mat::fixed<spacedim,spacedim> grad(unsigned int function_no, unsigned int point_no) const;
97 
98  /**
99  * @brief Return symmetric gradient of vector-valued shape function.
100  * @param function_no Index of shape function within the FE.
101  * @param point_no Index of quadrature point.
102  */
103  arma::mat::fixed<spacedim,spacedim> sym_grad(unsigned int function_no, unsigned int point_no) const;
104 
105  /**
106  * @brief Return divergence of vector-valued shape function.
107  * @param function_no Index of shape function within the FE.
108  * @param point_no Index of quadrature point.
109  */
110  double divergence(unsigned int function_no, unsigned int point_no) const;
111 
112  /// Returns the FEValuesBase class.
114 
115  private:
116 
117  /// Base FEValues class for access to the FE.
119 
120  /// Index of the first component of the vector.
122  };
123 
124 
125  template<unsigned int dim, unsigned int spacedim>
126  class Tensor {};
127 
128 };
129 
130 
131 
132 
133 
134 
135 #endif
unsigned int first_vector_component_
Index of the first component of the vector.
unsigned int component_
Index of the scalar component.
FEValuesBase< dim, spacedim > & fe_values_
Base FEValues class for access to the FE.
FEValuesBase< dim, spacedim > & fe_values_
Base FEValues class for access to the FE.
Vector(FEValuesBase< dim, spacedim > &fe_values, unsigned int component)
double value(unsigned int function_no, unsigned int point_no) const
Return value of scalar shape function.
FEValuesBase< dim, spacedim > & base() const
Returns the FEValuesBase class.
arma::vec::fixed< spacedim > grad(unsigned int function_no, unsigned int point_no) const
Return gradient of scalar shape function.
Base class for FEValues and FESideValues.
Definition: fe_values.hh:34
Scalar(FEValuesBase< dim, spacedim > &fe_values, unsigned int component)