v0.10.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  protected:
128 
129  MoFEMErrorCode setPtrFE(ForcesAndSourcesCore *ptr);
130 
131  };
132 
133 protected:
134 
135  MoFEMErrorCode setGaussPts(int order);
136 
137 private:
138  int edgeSense; ///< Sense of edge, could be 1 or -1
139  int edgeSideNumber; ///< Edge side number
140  std::array<int, 2> edgeConnMap;
141  std::array<int, 3> faceConnMap;
143 };
144 
145 /**
146  * @brief Face side finite element with switches
147  *
148  * Using SWITCH to off functions
149  *
150  * @tparam SWITCH
151  */
152 template <int SWITCH>
155 
156  using FaceElementForcesAndSourcesCoreOnSideBase::
157  FaceElementForcesAndSourcesCoreOnSideBase;
158 
159  using UserDataOperator =
161 
162  MoFEMErrorCode operator()();
163 };
164 
165 const std::array<int, 2> &
166 FaceElementForcesAndSourcesCoreOnSideBase::getEdgeConnMap() const {
167  return edgeConnMap;
168 }
169 
170 const std::array<int, 3> &
171 FaceElementForcesAndSourcesCoreOnSideBase::getFaceConnMap() const {
172  return faceConnMap;
173 }
174 
175 int FaceElementForcesAndSourcesCoreOnSideBase::getOppositeNode() const {
176  return oppositeNode;
177 }
178 
179 int FaceElementForcesAndSourcesCoreOnSideBase::getEdgeSense() const {
180  return edgeSense;
181 }
182 
183 int FaceElementForcesAndSourcesCoreOnSideBase::getEdgeSideNumber() const {
184  return edgeSideNumber;
185 }
186 
188 FaceElementForcesAndSourcesCoreOnSideBase::UserDataOperator::getFaceFE() const {
189  return static_cast<FaceElementForcesAndSourcesCoreOnSideBase *>(ptrFE);
190 }
191 
193 FaceElementForcesAndSourcesCoreOnSideBase::UserDataOperator::getEdgeFE() const {
194  return static_cast<EdgeElementForcesAndSourcesCoreBase *>(ptrFE->sidePtrFE);
195 }
196 
197 int FaceElementForcesAndSourcesCoreOnSideBase::UserDataOperator::getEdgeSense()
198  const {
199  return getFaceFE()->edgeSense;
200 }
201 
202 int FaceElementForcesAndSourcesCoreOnSideBase::UserDataOperator::
203  getEdgeSideNumber() const {
204  return getFaceFE()->edgeSideNumber;
205 }
206 
207 VectorDouble &
208 FaceElementForcesAndSourcesCoreOnSideBase::UserDataOperator::getDirection() {
209  return getEdgeFE()->dIrection;
210 }
211 
212 auto FaceElementForcesAndSourcesCoreOnSideBase::UserDataOperator::
213  getFTensor1Direction() {
214  double *ptr = &*getDirection().data().begin();
215  return FTensor::Tensor1<double *, 3>(ptr, &ptr[1], &ptr[2]);
216 }
217 
218 MatrixDouble &FaceElementForcesAndSourcesCoreOnSideBase::UserDataOperator::
219  getEdgeCoordsAtGaussPts() {
220  return getEdgeFE()->coordsAtGaussPts;
221 }
222 
223 template <int SWITCH>
226  return OpSwitch<SWITCH>();
227 }
228 
229 } // namespace MoFEM
230 
231 #endif //__FACEELEMENTFORCESANDSOURCESCORE_ONSIDE___HPP__
ublas::matrix< double, ublas::row_major, DoubleAllocator > MatrixDouble
Definition: Types.hpp:76
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...
ForcesAndSourcesCore::UserDataOperator UserDataOperator
constexpr int order
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:67
structure to get information form mofem into DataForcesAndSourcesCore
ublas::vector< double, DoubleAllocator > VectorDouble
Definition: Types.hpp:74
Data operator to do calculations at integration points.Is inherited and implemented by user to do cal...
Face finite elementUser is implementing own operator at Gauss point level, by own object derived from...