v0.14.0
TetPolynomialBase.hpp
Go to the documentation of this file.
1 /** \file TetPolynomialBase.hpp
2 \brief Implementation of Ainsworth-Coyle / Demkowicz or any other H1, Hcurl,
3 Hdiv and L2 base on tetrahedral
4 
5 */
6 
7 #ifndef __TETPOLYNOMIALBASE_HPP__
8 #define __TETPOLYNOMIALBASE_HPP__
9 
10 namespace MoFEM {
11 
12 /**
13  * \brief Calculate base functions on tetrahedral
14  *
15  * \ingroup mofem_base_functions
16  */
18 
19  MoFEMErrorCode query_interface(boost::typeindex::type_index type_index,
20  UnknownInterface **iface) const;
21 
22  TetPolynomialBase(const void *ptr = nullptr);
23  virtual ~TetPolynomialBase();
24 
25  template <int SPACE>
26  static bool switchCacheBaseFace(FieldApproximationBase base, void *ptr);
27 
28  template <int SPACE>
29  static bool switchCacheBaseInterior(FieldApproximationBase base, void *ptr);
30 
31  template <int SPACE>
33  void *ptr);
34 
35  template <int SPACE>
37  std::vector<void *> v);
38 
39  template <int SPACE>
41  std::vector<void *> v);
42 
43  template <int SPACE> static void switchCacheBaseOn(std::vector<void *> v);
44 
45  template <int SPACE> static void switchCacheBaseOff(std::vector<void *> v);
46 
48  boost::shared_ptr<BaseFunctionCtx> ctx_ptr);
49 
50  /**
51  * @brief Set map of dof to side number
52  *
53  * That is used for broken space to establish connection between dofs in the
54  * interior of element/entity and side of element/entity to which that dof is
55  * associated. That depends on implementation of the base for given space, and
56  * has to be implemented while implementing base function for given space.
57  *
58  * @param space
59  * @param continuity
60  * @param base
61  * @param DofsSideMap
62  * @return MoFEMErrorCode
63  */
64  static MoFEMErrorCode
65  setDofsSideMap(const FieldSpace space, const FieldContinuity continuity,
66  const FieldApproximationBase base,
67  DofsSideMap &);
68 
69 private:
70  const void *vPtr;
72 
73  /**
74  * @brief Get base functions for H1 space
75  *
76  * @param pts matrix of integration pts
77  * @return MoFEMErrorCode
78  *
79  * \note matrix of integration points on rows has local coordinates of
80  * finite element on columns are integration pts.
81  */
83 
84  /**
85  * @brief Get base functions for L2 space
86  *
87  * @param pts matrix of integration pts
88  * @return MoFEMErrorCode
89  *
90  * \note matrix of integration points on rows has local coordinates of finite
91  * element on columns are integration pts.
92  */
94 
95  /**
96  * @brief Get base functions for Hdiv space
97  *
98  * @param pts matrix of integration pts
99  * @return MoFEMErrorCode
100  *
101  * \note matrix of integration points on rows has local coordinates of finite
102  * element on columns are integration pts.
103  */
105 
106  /**
107  * @brief Get base functions for Hcurl space
108  *
109  * @param pts matrix of integration pts
110  * @return MoFEMErrorCode
111  *
112  * \note matrix of integration points on rows has local coordinates of finite
113  * element on columns are integration pts.
114  */
116 
117  /**
118  * @brief Set the Dofs Side Map Hdiv object
119  *
120  * @param space
121  * @param continuity
122  * @param base
123  * @param dofs_side_map
124  * @return MoFEMErrorCode
125  */
126  static MoFEMErrorCode setDofsSideMapHdiv(const FieldContinuity continuity,
127  const FieldApproximationBase base,
128  DofsSideMap &dofs_side_map);
129 
130 private:
133 
136 
138 
139  MatrixDouble &pts,
140 
141  MatrixDouble &shape_functions, MatrixDouble &diff_shape_functions,
142 
143  int volume_order, std::array<int, 4> &faces_order,
144  std::array<int, 3 * 4> &faces_nodes,
145 
146  boost::function<int(int)> broken_nbfacetri_edge_hdiv,
147  boost::function<int(int)> broken_nbfacetri_face_hdiv,
148  boost::function<int(int)> broken_nbvolumetet_edge_hdiv,
149  boost::function<int(int)> broken_nbvolumetet_face_hdiv,
150  boost::function<int(int)> broken_nbvolumetet_volume_hdiv
151 
152  );
153 
157 
161 
163 
164  ublas::matrix<MatrixDouble> N_face_edge;
165  ublas::vector<MatrixDouble> N_face_bubble;
166  ublas::vector<MatrixDouble> N_volume_edge;
167  ublas::vector<MatrixDouble> N_volume_face;
169 
170  ublas::matrix<MatrixDouble> diffN_face_edge;
171  ublas::vector<MatrixDouble> diffN_face_bubble;
172  ublas::vector<MatrixDouble> diffN_volume_edge;
173  ublas::vector<MatrixDouble> diffN_volume_face;
175 };
176 
177 template <>
178 bool TetPolynomialBase::switchCacheBaseFace<HDIV>(FieldApproximationBase base,
179  void *ptr);
180 template <>
181 bool TetPolynomialBase::switchCacheBaseInterior<HDIV>(
182  FieldApproximationBase base, void *ptr);
183 
184 template <>
185 bool TetPolynomialBase::switchCacheBrokenBaseInterior<HDIV>(
186  FieldApproximationBase base, void *ptr);
187 
188 template <>
189 void TetPolynomialBase::switchCacheBaseOn<HDIV>(FieldApproximationBase base,
190  std::vector<void *> v);
191 
192 template <>
193 void TetPolynomialBase::switchCacheBaseOff<HDIV>(FieldApproximationBase base,
194  std::vector<void *> v);
195 
196 template <>
197 void TetPolynomialBase::switchCacheBaseOn<HDIV>(std::vector<void *> v);
198 
199 template <>
200 void TetPolynomialBase::switchCacheBaseOff<HDIV>(std::vector<void *> v);
201 
202 template <>
203 bool TetPolynomialBase::switchCacheBaseInterior<L2>(FieldApproximationBase base,
204  void *ptr);
205 
206 template <>
207 void TetPolynomialBase::switchCacheBaseOn<L2>(FieldApproximationBase base,
208  std::vector<void *> v);
209 
210 template <>
211 void TetPolynomialBase::switchCacheBaseOff<L2>(FieldApproximationBase base,
212  std::vector<void *> v);
213 
214 template <>
215 void TetPolynomialBase::switchCacheBaseOn<L2>(std::vector<void *> v);
216 
217 template <>
218 void TetPolynomialBase::switchCacheBaseOff<L2>(std::vector<void *> v);
219 
220 
221 } // namespace MoFEM
222 
223 #endif //__TETPOLYNOMIALBASE_HPP__
UBlasMatrix< double >
MoFEM::TetPolynomialBase::getValueH1
MoFEMErrorCode getValueH1(MatrixDouble &pts)
Get base functions for H1 space.
Definition: TetPolynomialBase.cpp:113
MoFEM::TetPolynomialBase::getValueL2
MoFEMErrorCode getValueL2(MatrixDouble &pts)
Get base functions for L2 space.
Definition: TetPolynomialBase.cpp:525
MoFEM::EntPolynomialBaseCtx
Class used to pass element data to calculate base functions on tet,triangle,edge.
Definition: EntPolynomialBaseCtx.hpp:22
MoFEM::BaseFunction::DofsSideMap
multi_index_container< DofsSideMapData, indexed_by< ordered_non_unique< tag< TypeSide_mi_tag >, composite_key< DofsSideMapData, member< DofsSideMapData, EntityType, &DofsSideMapData::type >, member< DofsSideMapData, int, &DofsSideMapData::side > >>, ordered_unique< tag< EntDofIdx_mi_tag >, member< DofsSideMapData, int, &DofsSideMapData::dof > > > > DofsSideMap
Map entity stype and side to element/entity dof index.
Definition: BaseFunction.hpp:73
MoFEM::TetPolynomialBase::N_face_bubble
ublas::vector< MatrixDouble > N_face_bubble
Definition: TetPolynomialBase.hpp:165
MoFEM::TetPolynomialBase::getValueHcurlAinsworthBase
MoFEMErrorCode getValueHcurlAinsworthBase(MatrixDouble &pts)
Definition: TetPolynomialBase.cpp:1752
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
MoFEM::TetPolynomialBase::setDofsSideMapHdiv
static MoFEMErrorCode setDofsSideMapHdiv(const FieldContinuity continuity, const FieldApproximationBase base, DofsSideMap &dofs_side_map)
Set the Dofs Side Map Hdiv object.
Definition: TetPolynomialBase.cpp:2132
MoFEM::TetPolynomialBase::senseFaceAlpha
MatrixInt senseFaceAlpha
Definition: TetPolynomialBase.hpp:162
MoFEM::TetPolynomialBase::N_face_edge
ublas::matrix< MatrixDouble > N_face_edge
Definition: TetPolynomialBase.hpp:164
MoFEM::BaseFunction
Base class if inherited used to calculate base functions.
Definition: BaseFunction.hpp:40
MoFEM::TetPolynomialBase::getValueH1AinsworthBase
MoFEMErrorCode getValueH1AinsworthBase(MatrixDouble &pts)
Definition: TetPolynomialBase.cpp:131
MoFEM::TetPolynomialBase::diffN_volume_edge
ublas::vector< MatrixDouble > diffN_volume_edge
Definition: TetPolynomialBase.hpp:172
MoFEM::TetPolynomialBase::switchCacheBrokenBaseInterior
static bool switchCacheBrokenBaseInterior(FieldApproximationBase base, void *ptr)
MoFEM::TetPolynomialBase::getValueL2AinsworthBase
MoFEMErrorCode getValueL2AinsworthBase(MatrixDouble &pts)
Definition: TetPolynomialBase.cpp:544
MoFEM::TetPolynomialBase::TetPolynomialBase
TetPolynomialBase(const void *ptr=nullptr)
Definition: TetPolynomialBase.cpp:95
FieldSpace
FieldSpace
approximation spaces
Definition: definitions.h:82
MoFEM::TetPolynomialBase::getValueHcurl
MoFEMErrorCode getValueHcurl(MatrixDouble &pts)
Get base functions for Hcurl space.
Definition: TetPolynomialBase.cpp:2002
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
MoFEM::TetPolynomialBase::switchCacheBaseInterior
static bool switchCacheBaseInterior(FieldApproximationBase base, void *ptr)
MoFEM::TetPolynomialBase::diffN_volume_bubble
MatrixDouble diffN_volume_bubble
Definition: TetPolynomialBase.hpp:174
MoFEM::TetPolynomialBase::N_volume_edge
ublas::vector< MatrixDouble > N_volume_edge
Definition: TetPolynomialBase.hpp:166
FieldContinuity
FieldContinuity
Field continuity.
Definition: definitions.h:99
MoFEM::Types::MatrixInt
UBlasMatrix< int > MatrixInt
Definition: Types.hpp:76
MoFEM::TetPolynomialBase::vPtr
const void * vPtr
Definition: TetPolynomialBase.hpp:70
MoFEM::TetPolynomialBase::getValueHdivAinsworthBaseImpl
MoFEMErrorCode getValueHdivAinsworthBaseImpl(MatrixDouble &pts, MatrixDouble &shape_functions, MatrixDouble &diff_shape_functions, int volume_order, std::array< int, 4 > &faces_order, std::array< int, 3 *4 > &faces_nodes, boost::function< int(int)> broken_nbfacetri_edge_hdiv, boost::function< int(int)> broken_nbfacetri_face_hdiv, boost::function< int(int)> broken_nbvolumetet_edge_hdiv, boost::function< int(int)> broken_nbvolumetet_face_hdiv, boost::function< int(int)> broken_nbvolumetet_volume_hdiv)
Definition: TetPolynomialBase.cpp:781
MoFEM::TetPolynomialBase::diffN_face_edge
ublas::matrix< MatrixDouble > diffN_face_edge
Definition: TetPolynomialBase.hpp:170
MoFEM::TetPolynomialBase::N_volume_face
ublas::vector< MatrixDouble > N_volume_face
Definition: TetPolynomialBase.hpp:167
MoFEM::TetPolynomialBase::getValueHdiv
MoFEMErrorCode getValueHdiv(MatrixDouble &pts)
Get base functions for Hdiv space.
Definition: TetPolynomialBase.cpp:1717
MoFEM::TetPolynomialBase::getValueHdivAinsworthBase
MoFEMErrorCode getValueHdivAinsworthBase(MatrixDouble &pts)
Definition: TetPolynomialBase.cpp:909
MoFEM::TetPolynomialBase::diffN_volume_face
ublas::vector< MatrixDouble > diffN_volume_face
Definition: TetPolynomialBase.hpp:173
MoFEM::TetPolynomialBase::getValueHcurlDemkowiczBase
MoFEMErrorCode getValueHcurlDemkowiczBase(MatrixDouble &pts)
Definition: TetPolynomialBase.cpp:1870
MoFEM::TetPolynomialBase::switchCacheBaseOn
static void switchCacheBaseOn(FieldApproximationBase base, std::vector< void * > v)
MoFEM::TetPolynomialBase::getValueL2BernsteinBezierBase
MoFEMErrorCode getValueL2BernsteinBezierBase(MatrixDouble &pts)
Definition: TetPolynomialBase.cpp:605
MoFEM::UnknownInterface
base class for all interface classes
Definition: UnknownInterface.hpp:34
v
const double v
phase velocity of light in medium (cm/ns)
Definition: initial_diffusion.cpp:40
MoFEM::TetPolynomialBase::getValueHdivDemkowiczBrokenBase
MoFEMErrorCode getValueHdivDemkowiczBrokenBase(MatrixDouble &pts)
Definition: TetPolynomialBase.cpp:1566
MoFEM::TetPolynomialBase::setDofsSideMap
static MoFEMErrorCode setDofsSideMap(const FieldSpace space, const FieldContinuity continuity, const FieldApproximationBase base, DofsSideMap &)
Set map of dof to side number.
Definition: TetPolynomialBase.cpp:2102
MoFEM::TetPolynomialBase::switchCacheBaseOff
static void switchCacheBaseOff(FieldApproximationBase base, std::vector< void * > v)
MoFEM::TetPolynomialBase::cTx
EntPolynomialBaseCtx * cTx
Definition: TetPolynomialBase.hpp:71
MoFEM::TetPolynomialBase::diffN_face_bubble
ublas::vector< MatrixDouble > diffN_face_bubble
Definition: TetPolynomialBase.hpp:171
MoFEM::TetPolynomialBase::getValueHdivDemkowiczBase
MoFEMErrorCode getValueHdivDemkowiczBase(MatrixDouble &pts)
Definition: TetPolynomialBase.cpp:1429
MoFEM::TetPolynomialBase::getValue
MoFEMErrorCode getValue(MatrixDouble &pts, boost::shared_ptr< BaseFunctionCtx > ctx_ptr)
Definition: TetPolynomialBase.cpp:2021
FieldApproximationBase
FieldApproximationBase
approximation base
Definition: definitions.h:58
MoFEM::TetPolynomialBase::N_volume_bubble
MatrixDouble N_volume_bubble
Definition: TetPolynomialBase.hpp:168
MoFEM::TetPolynomialBase::getValueH1BernsteinBezierBase
MoFEMErrorCode getValueH1BernsteinBezierBase(MatrixDouble &pts)
Definition: TetPolynomialBase.cpp:243
MoFEM::TetPolynomialBase::switchCacheBaseFace
static bool switchCacheBaseFace(FieldApproximationBase base, void *ptr)
MoFEM::TetPolynomialBase::~TetPolynomialBase
virtual ~TetPolynomialBase()
Definition: TetPolynomialBase.cpp:97
MoFEM::TetPolynomialBase::query_interface
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Definition: TetPolynomialBase.cpp:87
MoFEM::TetPolynomialBase::getValueHdivAinsworthBrokenBase
MoFEMErrorCode getValueHdivAinsworthBrokenBase(MatrixDouble &pts)
Definition: TetPolynomialBase.cpp:1165
MoFEM::TetPolynomialBase
Calculate base functions on tetrahedral.
Definition: TetPolynomialBase.hpp:17