OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
fei3dlinelin.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 - 2013 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 "fei3dlinelin.h"
36 #include "mathfem.h"
37 #include "floatmatrix.h"
38 #include "floatarray.h"
39 #include "gaussintegrationrule.h"
40 
41 namespace oofem {
42 double
44 {
45  return cellgeo.giveVertexCoordinates(2)->distance( * cellgeo.giveVertexCoordinates(1) );
46 }
47 
48 void
49 FEI3dLineLin :: evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
50 {
51  double ksi = lcoords.at(1);
52  answer.resize(2);
53 
54  answer.at(1) = ( 1. - ksi ) * 0.5;
55  answer.at(2) = ( 1. + ksi ) * 0.5;
56 }
57 
58 double
59 FEI3dLineLin :: evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
60 {
62  FloatArray vec;
63  vec.beDifferenceOf( * cellgeo.giveVertexCoordinates(2), * cellgeo.giveVertexCoordinates(1) );
64 
65  double detJ = vec.computeSquaredNorm() * 0.5;
66  double l2_inv = 0.5 / detJ;
67  answer.resize(2, 3);
68 
69  answer.at(1, 1) = -vec.at(1) * l2_inv;
70  answer.at(2, 1) = vec.at(1) * l2_inv;
71  answer.at(1, 2) = -vec.at(2) * l2_inv;
72  answer.at(2, 2) = vec.at(2) * l2_inv;
73  answer.at(1, 3) = -vec.at(3) * l2_inv;
74  answer.at(2, 3) = vec.at(3) * l2_inv;
75 
76  return detJ;
77 }
78 
79 void
80 FEI3dLineLin :: evald2Ndx2(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
81 {
82  answer.resize(2, 3);
83  answer.zero();
84 }
85 
86 void
87 FEI3dLineLin :: local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
88 {
89  double ksi = lcoords.at(1);
90 
91  answer.beScaled( ( 1. - ksi ) * 0.5, * cellgeo.giveVertexCoordinates(1) );
92  answer.add( ( 1. + ksi ) * 0.5, * cellgeo.giveVertexCoordinates(2) );
93 }
94 
95 
96 int
97 FEI3dLineLin :: global2local(FloatArray &answer, const FloatArray &coords, const FEICellGeometry &cellgeo)
98 {
99  FloatArray vec, x;
100  vec.beDifferenceOf( * cellgeo.giveVertexCoordinates(2), * cellgeo.giveVertexCoordinates(1) );
101  x.beDifferenceOf( coords, * cellgeo.giveVertexCoordinates(1) );
102  double l2 = vec.computeSquaredNorm();
103  double xvec = x.dotProduct(vec);
104 
105  answer = FloatArray{2.0 * xvec / l2 - 1.0};
106  answer.at(1) = clamp(answer.at(1), -1.0, 1.0);
107  return false; // No point to check if point is "inside".
108 }
109 
110 
111 double
113 {
114  return 0.5 * this->giveLength(cellgeo);
115 }
116 
117 
118 void
119 FEI3dLineLin :: edgeEvalN(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
120 {
121  this->evalN(answer, lcoords, cellgeo);
122 }
123 
124 void
126  const FloatArray &lcoords, const FEICellGeometry &cellgeo)
127 {
128  double l_inv = 1.0 / this->giveLength(cellgeo);
129 
130  answer.resize(2, 1);
131  answer.at(1, 1) = -l_inv;
132  answer.at(2, 1) = l_inv;
133 }
134 
135 void
137  const FloatArray &lcoords, const FEICellGeometry &cellgeo)
138 {
139  return this->local2global(answer, lcoords, cellgeo);
140 }
141 
142 
143 double
145 {
146  return this->giveTransformationJacobian(lcoords, cellgeo);
147 }
148 
149 
150 void
152 {
153  if ( iedge != 1 ) {
154  OOFEM_ERROR("wrong edge number (%d)", iedge);
155  }
156  edgeNodes = {1, 2};
157 }
158 
159 void
160 FEI3dLineLin :: surfaceEvalN(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
161 {
162  OOFEM_ERROR("no surfaces available");
163 }
164 
165 double
166 FEI3dLineLin :: surfaceEvalNormal(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
167 {
168  OOFEM_ERROR("no surfaces available");
169  return 0.0;
170 }
171 
172 void
174  const FloatArray &lcoords, const FEICellGeometry &cellgeo)
175 {
176  OOFEM_ERROR("no surfaces available");
177 }
178 
179 double
181  const FEICellGeometry &cellgeo)
182 {
183  OOFEM_ERROR("no surfaces available");
184  return 0.0;
185 }
186 
187 void
189 {
190  OOFEM_ERROR("no surfaces available");
191 }
192 
193 
194 void
195 FEI3dLineLin :: giveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
196 // Returns the jacobian matrix J (x,y,z)/(ksi,eta,dzeta) of the receiver.
197 {
199  jacobianMatrix.resize(1, 1);
200  jacobianMatrix.at(1, 1) = 1.0;
201 }
202 
205 {
206  IntegrationRule *iRule = new GaussIntegrationRule(1, NULL);
207  int points = iRule->getRequiredNumberOfIntegrationPoints(_Line, order + 0);
208  iRule->SetUpPointsOnLine(points, _Unknown);
209  return iRule;
210 }
211 
214 {
216  OOFEM_ERROR("Not supported");
217  return NULL;
218 }
219 } // end namespace oofem
virtual void computeLocalSurfaceMapping(IntArray &surfNodes, int isurf)
Definition: fei3dlinelin.C:188
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
virtual const FloatArray * giveVertexCoordinates(int i) const =0
virtual void computeLocalEdgeMapping(IntArray &edgeNodes, int iedge)
Definition: fei3dlinelin.C:151
virtual double surfaceEvalNormal(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the normal out of the surface at given point.
Definition: fei3dlinelin.C:166
Class representing a general abstraction for cell geometry.
Definition: feinterpol.h:62
virtual IntegrationRule * giveIntegrationRule(int order)
Sets up a suitable integration rule for numerical integrating over volume.
Definition: fei3dlinelin.C:204
virtual double surfaceGiveTransformationJacobian(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the edge jacobian of transformation between local and global coordinates.
Definition: fei3dlinelin.C:180
virtual double giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the determinant of the transformation.
Definition: fei3dlinelin.C:112
virtual void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates global coordinates from given local ones.
Definition: fei3dlinelin.C:87
virtual void evald2Ndx2(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the matrix of second derivatives of interpolation functions (shape functions) at given poin...
Definition: fei3dlinelin.C:80
Class implementing an array of integers.
Definition: intarray.h:61
virtual double evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the matrix of derivatives of interpolation functions (shape functions) at given point...
Definition: fei3dlinelin.C:59
Abstract base class representing integration rule.
void beDifferenceOf(const FloatArray &a, const FloatArray &b)
Sets receiver to be a - b.
Definition: floatarray.C:341
virtual void surfaceEvalN(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the array of edge interpolation functions (shape functions) at given point.
Definition: fei3dlinelin.C:160
double distance(const FloatArray &x) const
Computes the distance between position represented by receiver and position given as parameter...
Definition: floatarray.C:489
void beScaled(double s, const FloatArray &b)
Sets receiver to be .
Definition: floatarray.C:146
virtual void surfaceLocal2global(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates edge global coordinates from given local ones.
Definition: fei3dlinelin.C:173
virtual void edgeEvalN(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the array of edge interpolation functions (shape functions) at given point.
Definition: fei3dlinelin.C:119
double dotProduct(const FloatArray &x) const
Computes the dot product (or inner product) of receiver and argument.
Definition: floatarray.C:463
virtual void edgeLocal2global(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates edge global coordinates from given local ones.
Definition: fei3dlinelin.C:136
virtual IntegrationRule * giveBoundaryIntegrationRule(int order, int boundary)
Sets up a suitable integration rule for integrating over the requested boundary.
Definition: fei3dlinelin.C:213
#define OOFEM_ERROR(...)
Definition: error.h:61
double computeSquaredNorm() const
Computes the square of the norm.
Definition: floatarray.C:846
virtual void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the array of interpolation functions (shape functions) at given point.
Definition: fei3dlinelin.C:49
virtual double edgeGiveTransformationJacobian(int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the edge jacobian of transformation between local and global coordinates.
Definition: fei3dlinelin.C:144
virtual void giveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Gives the jacobian matrix at the local coordinates.
Definition: fei3dlinelin.C:195
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
Class representing vector of real numbers.
Definition: floatarray.h:82
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
double clamp(int a, int lower, int upper)
Returns the clamped value of a between upper and lower.
Definition: mathfem.h:75
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
Definition: floatmatrix.C:1358
virtual int getRequiredNumberOfIntegrationPoints(integrationDomain dType, int approxOrder)
Abstract service.
virtual int SetUpPointsOnLine(int, MaterialMode mode)
Sets up receiver's integration points on unit line integration domain.
virtual double giveLength(const FEICellGeometry &cellgeo) const
Definition: fei3dlinelin.C:43
void zero()
Zeroes all coefficient of receiver.
Definition: floatmatrix.C:1326
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual void edgeEvaldNdx(FloatMatrix &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the matrix of derivatives of edge interpolation functions (shape functions) at given point...
Definition: fei3dlinelin.C:125
void add(const FloatArray &src)
Adds array src to receiver.
Definition: floatarray.C:156
virtual int global2local(FloatArray &answer, const FloatArray &gcoords, const FEICellGeometry &cellgeo)
Evaluates local coordinates from given global ones.
Definition: fei3dlinelin.C:97
Class representing Gaussian-quadrature integration rule.
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:28 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011