OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
fei1dlin.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 "fei1dlin.h"
36 #include "mathfem.h"
37 #include "floatmatrix.h"
38 #include "floatarray.h"
39 
40 namespace oofem {
41 double
43 {
44  return fabs( cellgeo.giveVertexCoordinates(2)->at(cindx) - cellgeo.giveVertexCoordinates(1)->at(cindx) );
45 }
46 
47 void
48 FEI1dLin :: evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
49 {
50  double ksi = lcoords.at(1);
51  answer.resize(2);
52 
53  answer.at(1) = ( 1. - ksi ) * 0.5;
54  answer.at(2) = ( 1. + ksi ) * 0.5;
55 }
56 
57 double
58 FEI1dLin :: evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
59 {
60  double l = cellgeo.giveVertexCoordinates(2)->at(cindx) - cellgeo.giveVertexCoordinates(1)->at(cindx);
61  answer.resize(2, 1);
62 
63  answer.at(1, 1) = -1.0 / l;
64  answer.at(2, 1) = 1.0 / l;
65  return 0.5 * l;
66 }
67 
68 void
69 FEI1dLin :: local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
70 {
71  FloatArray n;
72  answer.resize(1);
73 
74  this->evalN(n, lcoords, cellgeo);
75  answer.at(1) = ( n.at(1) * cellgeo.giveVertexCoordinates(1)->at(cindx) +
76  n.at(2) * cellgeo.giveVertexCoordinates(2)->at(cindx) );
77 }
78 
79 int
80 FEI1dLin :: global2local(FloatArray &answer, const FloatArray &coords, const FEICellGeometry &cellgeo)
81 {
82  double ksi, x1, x2;
83  answer.resize(1);
84 
85  x1 = cellgeo.giveVertexCoordinates(1)->at(cindx);
86  x2 = cellgeo.giveVertexCoordinates(2)->at(cindx);
87 
88  ksi = ( 2.0 * coords.at(1) - ( x1 + x2 ) ) / ( x2 - x1 );
89  answer.at(1) = clamp(ksi, -1., 1.);
90  return fabs(ksi) <= 1.0;
91 }
92 
93 double
95 {
96  return 0.5 * ( cellgeo.giveVertexCoordinates(2)->at(cindx) - cellgeo.giveVertexCoordinates(1)->at(cindx) );
97 }
98 
99 void FEI1dLin :: boundaryEdgeGiveNodes(IntArray &answer, int boundary)
100 {
101  answer = {1, 2};
102 }
103 
104 void FEI1dLin :: boundaryEdgeEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
105 {
106  this->evalN(answer, lcoords, cellgeo);
107 }
108 
109 double FEI1dLin :: boundaryEdgeGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
110 {
111  return this->giveTransformationJacobian(lcoords, cellgeo);
112 }
113 
114 void FEI1dLin :: boundaryEdgeLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
115 {
116  this->local2global(answer, lcoords, cellgeo);
117 }
118 
119 
120 
121 } // end namespace oofem
virtual void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates global coordinates from given local ones.
Definition: fei1dlin.C:69
virtual void boundaryEdgeEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the basis functions on the requested boundary.
Definition: fei1dlin.C:104
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
virtual const FloatArray * giveVertexCoordinates(int i) const =0
virtual double giveLength(const FEICellGeometry &cellgeo) const
Computes the exact length.
Definition: fei1dlin.C:42
Class representing a general abstraction for cell geometry.
Definition: feinterpol.h:62
virtual void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the array of interpolation functions (shape functions) at given point.
Definition: fei1dlin.C:48
Class implementing an array of integers.
Definition: intarray.h:61
virtual void boundaryEdgeLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Maps the local boundary coordinates to global.
Definition: fei1dlin.C:114
virtual double giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the determinant of the transformation.
Definition: fei1dlin.C:94
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: fei1dlin.C:58
virtual double boundaryEdgeGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the determinant of the transformation Jacobian on the requested boundary.
Definition: fei1dlin.C:109
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 void boundaryEdgeGiveNodes(IntArray &answer, int boundary)
Gives the boundary nodes for requested boundary number.
Definition: fei1dlin.C:99
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual int global2local(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates local coordinates from given global ones.
Definition: fei1dlin.C:80
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