v0.9.0
FaceElementForcesAndSourcesCoreOnSide.hpp
Go to the documentation of this file.
1 /** \file FaceElementForcesAndSourcesCoreOnSide.hpp
2  \brief Implementation of face element.
3 
4 */
5 
6 /* This file is part of MoFEM.
7  * MoFEM is free software: you can redistribute it and/or modify it under
8  * the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation, either version 3 of the License, or (at your
10  * option) any later version.
11  *
12  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15  * License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>. */
19 
20 #ifndef __FACEELEMENTFORCESANDSOURCESCORE_ONSIDE__HPP__
21 #define __FACEELEMENTFORCESANDSOURCESCORE_ONSIDE__HPP__
22 
23 using namespace boost::numeric;
24 
25 namespace MoFEM {
26 
27 /**
28  * \brief Base face element used to integrate on skeleton
29  * \ingroup mofem_forces_and_sources_volume_element
30  */
33 
34  using FaceElementForcesAndSourcesCoreBase::
35  FaceElementForcesAndSourcesCoreBase;
36 
37  int getRule(int order);
38 
39  /**
40  * @brief Get the face nodes mapped on volume element
41  *
42  * \todo That this is not general, e.g., for quad number of nodes is 4.
43  *
44  * @return const std::array<int, 3>&
45  */
46  inline const std::array<int, 2> &getEdgeConnMap() const;
47 
48  /**
49  * @brief Get face nodes maped on volume
50  *
51  * @return const sdt::array<int, 3>&
52  */
53  inline const std::array<int, 3> &getFaceConnMap() const;
54 
55  /**
56  * @brief Get node on volume opposite to volume element
57  *
58  * @return int
59  */
60  inline int getOppositeNode() const;
61 
62  /**
63  * @brief Sense face on volume
64  *
65  * @return int
66  */
67  inline int getEdgeSense() const;
68 
69  /**
70  * @brief Face number on the volume
71  *
72  * @return int
73  */
74  inline int getEdgeSideNumber() const;
75 
76  /** \brief default operator for Face element
77  * \ingroup mofem_forces_and_sources_volume_element
78  */
81 
84 
85  /** \brief return pointer to Generic Volume Finite Element object
86  */
87  inline const FaceElementForcesAndSourcesCoreOnSideBase *getFaceFE() const;
88 
89  /**
90  * @brief Get the edge side finite element
91  *
92  * @return EdgeElementForcesAndSourcesCoreBase*
93  */
94  inline EdgeElementForcesAndSourcesCoreBase *getEdgeFE() const;
95 
96  /**
97  * \brief get face sense in respect to volume
98  * @return error code
99  */
100  inline int getEdgeSense() const;
101 
102  /**
103  * \brief get face side number in respect to volume
104  * @return error code
105  */
106  inline int getEdgeSideNumber() const;
107 
108  /**
109  * get face normal on side which is this element
110  * @return face normal
111  */
112  inline VectorDouble &getDirection();
113 
114  /** \brief get normal as tensor
115  */
116  inline auto getFTensor1Direction();
117 
118  /** \brief get face coordinates at Gauss pts.
119 
120  \note Coordinates should be the same what function getCoordsAtGaussPts
121  on face is returning. If both coordinates are different it is error, or you
122  do something very unusual.
123 
124  */
125  inline MatrixDouble &getEdgeCoordsAtGaussPts();
126  };
127 
128 protected:
129  MoFEMErrorCode setGaussPts(int order);
130 
131 private:
132  int edgeSense; ///< Sense of edge, could be 1 or -1
133  int edgeSideNumber; ///< Edge side number
134  std::array<int, 2> edgeConnMap;
135  std::array<int, 3> faceConnMap;
137 };
138 
139 /**
140  * @brief Face side finite element with switches
141  *
142  * Using SWITCH to off functions
143  *
144  * @tparam SWITCH
145  */
146 template <int SWITCH>
149 
150  using FaceElementForcesAndSourcesCoreOnSideBase::
151  FaceElementForcesAndSourcesCoreOnSideBase;
152 
153  using UserDataOperator =
155 
156  MoFEMErrorCode operator()();
157 };
158 
159 const std::array<int, 2> &
160 FaceElementForcesAndSourcesCoreOnSideBase::getEdgeConnMap() const {
161  return edgeConnMap;
162 }
163 
164 const std::array<int, 3> &
165 FaceElementForcesAndSourcesCoreOnSideBase::getFaceConnMap() const {
166  return faceConnMap;
167 }
168 
169 int FaceElementForcesAndSourcesCoreOnSideBase::getOppositeNode() const {
170  return oppositeNode;
171 }
172 
173 int FaceElementForcesAndSourcesCoreOnSideBase::getEdgeSense() const {
174  return edgeSense;
175 }
176 
177 int FaceElementForcesAndSourcesCoreOnSideBase::getEdgeSideNumber() const {
178  return edgeSideNumber;
179 }
180 
182 FaceElementForcesAndSourcesCoreOnSideBase::UserDataOperator::getFaceFE() const {
183  return static_cast<FaceElementForcesAndSourcesCoreOnSideBase *>(ptrFE);
184 }
185 
187 FaceElementForcesAndSourcesCoreOnSideBase::UserDataOperator::getEdgeFE() const {
188  return static_cast<EdgeElementForcesAndSourcesCoreBase *>(ptrFE->sidePtrFE);
189 }
190 
191 int FaceElementForcesAndSourcesCoreOnSideBase::UserDataOperator::getEdgeSense()
192  const {
193  return getFaceFE()->edgeSense;
194 }
195 
196 int FaceElementForcesAndSourcesCoreOnSideBase::UserDataOperator::
197  getEdgeSideNumber() const {
198  return getFaceFE()->edgeSideNumber;
199 }
200 
201 VectorDouble &
202 FaceElementForcesAndSourcesCoreOnSideBase::UserDataOperator::getDirection() {
203  return getEdgeFE()->dIrection;
204 }
205 
206 auto FaceElementForcesAndSourcesCoreOnSideBase::UserDataOperator::
207  getFTensor1Direction() {
208  double *ptr = &*getDirection().data().begin();
209  return FTensor::Tensor1<double *, 3>(ptr, &ptr[1], &ptr[2]);
210 }
211 
212 MatrixDouble &FaceElementForcesAndSourcesCoreOnSideBase::UserDataOperator::
213  getEdgeCoordsAtGaussPts() {
214  return getEdgeFE()->coordsAtGaussPts;
215 }
216 
217 template <int SWITCH>
220  return OpSwitch<SWITCH>();
221 }
222 
223 } // namespace MoFEM
224 
225 #endif //__FACEELEMENTFORCESANDSOURCESCORE_ONSIDE___HPP__
ublas::matrix< double, ublas::row_major, DoubleAllocator > MatrixDouble
Definition: Types.hpp:74
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
Edge finite elementUser is implementing own operator at Gauss points level, by own object derived fro...
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:66
ForcesAndSourcesCore::UserDataOperator UserDataOperator
ublas::vector< double, DoubleAllocator > VectorDouble
Definition: Types.hpp:72
Face finite elementUser is implementing own operator at Gauss point level, by own object derived from...