OOFEM 3.0
Loading...
Searching...
No Matches
feinterpol3d.C
Go to the documentation of this file.
1/*
2 *
3 * ##### ##### ###### ###### ### ###
4 * ## ## ## ## ## ## ## ### ##
5 * ## ## ## ## #### #### ## # ##
6 * ## ## ## ## ## ## ## ##
7 * ## ## ## ## ## ## ## ##
8 * ##### ##### ## ###### ## ##
9 *
10 *
11 * OOFEM : Object Oriented Finite Element Code
12 *
13 * Copyright (C) 1993 - 2025 Borek Patzak
14 *
15 *
16 *
17 * Czech Technical University, Faculty of Civil Engineering,
18 * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19 *
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License as published by the Free Software Foundation; either
23 * version 2.1 of the License, or (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public
31 * License along with this library; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 */
34
35#include "feinterpol3d.h"
36#include "floatarray.h"
37#include "floatarrayf.h"
38#include "floatmatrixf.h"
40
41namespace oofem {
43{
44 OOFEM_ERROR("Not implemented in subclass.");
45}
46
47IntArray FEInterpolation3d :: boundaryEdgeGiveNodes(int boundary, Element_Geometry_Type egt, bool includeHierarchical) const
48{
49 return this->computeLocalEdgeMapping(boundary);
50}
51
52void FEInterpolation3d :: boundaryEdgeEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
53{
54 this->edgeEvalN(answer, boundary, lcoords, cellgeo);
55}
56
57double FEInterpolation3d :: boundaryEdgeGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
58{
59 return this->edgeGiveTransformationJacobian(boundary, lcoords, cellgeo);
60}
61
62void FEInterpolation3d :: boundaryEdgeLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
63{
64 this->edgeLocal2global(answer, boundary, lcoords, cellgeo);
65}
66
67IntArray FEInterpolation3d :: boundaryGiveNodes(int boundary, Element_Geometry_Type egt) const
68{
69 return this->computeLocalSurfaceMapping(boundary);
70}
71
72void FEInterpolation3d :: boundaryEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
73{
74 this->surfaceEvalN(answer, boundary, lcoords, cellgeo);
75}
76
77double FEInterpolation3d :: boundaryEvalNormal(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
78{
79 return this->surfaceEvalNormal(answer, boundary, lcoords, cellgeo);
80}
81
82double FEInterpolation3d :: boundaryGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
83{
84 return this->surfaceGiveTransformationJacobian(boundary, lcoords, cellgeo);
85}
86
87void FEInterpolation3d :: boundaryLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
88{
89 return this->surfaceLocal2global(answer, boundary, lcoords, cellgeo);
90}
91
92IntArray FEInterpolation3d :: computeEdgeMapping(const IntArray &elemNodes, int iedge) const
93{
94 const auto &ln = this->computeLocalEdgeMapping(iedge);
95 int size = ln.giveSize();
96 IntArray edgeNodes(size);
97 for ( int i = 1; i <= size; i++ ) {
98 edgeNodes.at(i) = elemNodes.at( ln.at(i) );
99 }
100 return edgeNodes;
101}
102
103IntArray FEInterpolation3d :: computeSurfaceMapping(const IntArray &elemNodes, int isurf) const
104{
105 const auto &ln = this->computeLocalSurfaceMapping(isurf);
106 int size = ln.giveSize();
107 IntArray surfNodes(size);
108 for ( int i = 1; i <= size; i++ ) {
109 surfNodes.at(i) = elemNodes.at( ln.at(i) );
110 }
111 return surfNodes;
112}
113
114std::unique_ptr<IntegrationRule> FEInterpolation3d :: giveBoundaryEdgeIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const
115{
116 auto iRule = std::make_unique<GaussIntegrationRule>(1, nullptr);
117 int points = iRule->getRequiredNumberOfIntegrationPoints(_Line, order + this->order);
118 iRule->SetUpPointsOnLine(points, _Unknown);
119 return iRule;
120}
121
122void FEInterpolation3d :: edgeEvaldNdxi(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
123{
124 OOFEM_ERROR("Not implemented");
125}
126
127void FEInterpolation3d :: surfaceEvaldNdx(FloatMatrix &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
128{
129 OOFEM_ERROR("Not implemented");
130}
131
132double FEInterpolation3d :: edgeEvalNormal(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
133{
134 OOFEM_ERROR("Not implemented");
135}
136
137IntArray FEInterpolation3d::boundarySurfaceGiveNodes(int boundary, Element_Geometry_Type egt, bool includeHierarchical) const
138{
139 return this->computeLocalSurfaceMapping(boundary);
140}
141
142
143double FEInterpolation3d::surfaceEvalNormal(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
144{
145 auto [G1, G2] = this->surfaceEvalBaseVectorsAt(isurf, lcoords, cellgeo);
146 auto normal = cross(G1, G2);
147 double J = norm(normal);
148 answer = normal;
149 return J;
150}
151
152std::tuple<double, FloatArrayF<3>>
153FEInterpolation3d :: surfaceEvalUnitNormal(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
154{
155 auto [G1, G2] = this->surfaceEvalBaseVectorsAt(isurf, lcoords, cellgeo);
156 auto normal = cross(G1, G2);
157 double J = norm(normal);
158 return std::make_tuple(J, normal/J);
159}
160
161
162void FEInterpolation3d::surfaceEvaldNdxi(FloatMatrix & answer, const FloatArray & lcoords) const
163{
164 OOFEM_ERROR("Not implemented");
165}
166
168{
169 OOFEM_ERROR("Not implemented");
170}
171
172
173
174 std::tuple<FloatArrayF<3>, FloatArrayF<3>> FEInterpolation3d::surfaceEvalBaseVectorsAt(int isurf, const FloatArray & lcoords, const FEICellGeometry & cellgeo) const
175{
176 //Adapted from FEI3dQuadLin
177 // Note: These are not normalized. Returns the two tangent vectors to the surface.
178 FloatMatrix dNdxi;
179 this->surfaceEvaldNdxi(dNdxi, lcoords);
180 //Get nodes which correspond to the surface in question
181 auto nodeIndices = this->computeLocalSurfaceMapping(isurf);
182 FloatArrayF<3> G1, G2;
183 for (int i = 0; i < nodeIndices.giveSize(); ++i) {
184 G1 += dNdxi(i, 0) * FloatArrayF<3>(cellgeo.giveVertexCoordinates(nodeIndices(i)));
185 G2 += dNdxi(i, 1) * FloatArrayF<3>(cellgeo.giveVertexCoordinates(nodeIndices(i)));
186 }
187 return std::make_tuple(G1, G2);
188}
189
191FEInterpolation3d :: surfaceGiveJacobianMatrixAt(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
192{
193 // Jacobian matrix consists of the three curvilinear base vectors. The third is taken as the normal to the surface.
194 // Note! The base vectors are not normalized except the third (normal)
195 auto [G1, G2] = this->surfaceEvalBaseVectorsAt(isurf, lcoords, cellgeo);
196 auto G3 = cross(G1, G2);
197 FloatMatrixF<3,3> jacobianMatrix;
198 jacobianMatrix.setColumn(G1,0);
199 jacobianMatrix.setColumn(G2,1);
200 jacobianMatrix.setColumn(G3,2);
201 return jacobianMatrix;
202}
203
204
205
206double
207FEInterpolation3d :: surfaceGiveTransformationJacobian(int isurf, const FloatArray &lcoords,
208 const FEICellGeometry &cellgeo) const
209{
210 auto [J, N] = surfaceEvalUnitNormal(isurf, lcoords, cellgeo);
211 return J;
212}
213
214
215
216
217
218double FEInterpolation3d:: boundarySurfaceEvalNormal(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
219{
220 auto [J, N] = surfaceEvalUnitNormal(isurf, lcoords, cellgeo);
221 answer = N;
222 return J;
223}
224
225
226} // end namespace oofem
#define N(a, b)
virtual const FloatArray giveVertexCoordinates(int i) const =0
virtual void edgeEvalN(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
double boundarySurfaceEvalNormal(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override
virtual IntArray computeLocalEdgeMapping(int iedge) const =0
IntArray boundarySurfaceGiveNodes(int boundary, Element_Geometry_Type, bool includeHierarchical=false) const override
virtual void surfaceEvalN(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
virtual std::tuple< double, FloatArrayF< 3 > > surfaceEvalUnitNormal(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
virtual double edgeGiveTransformationJacobian(int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
virtual double surfaceGiveTransformationJacobian(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
virtual double giveVolume(const FEICellGeometry &cellgeo) const
virtual std::tuple< FloatArrayF< 3 >, FloatArrayF< 3 > > surfaceEvalBaseVectorsAt(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
void surfaceEvald2Ndxi2(FloatMatrix &answer, const FloatArray &lcoords) const override
virtual void surfaceLocal2global(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
virtual double surfaceEvalNormal(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
void surfaceEvaldNdxi(FloatMatrix &answer, const FloatArray &lcoords) const override
virtual IntArray computeLocalSurfaceMapping(int isurf) const =0
virtual void edgeLocal2global(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
void setColumn(const FloatArrayF< N > &src, std::size_t c)
int & at(std::size_t i)
Definition intarray.h:104
#define OOFEM_ERROR(...)
Definition error.h:79
double norm(const FloatArray &x)
FloatArrayF< 3 > cross(const FloatArrayF< 3 > &x, const FloatArrayF< 3 > &y)
Computes $ x \cross y $.

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011