OOFEM 3.0
Loading...
Searching...
No Matches
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 - 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 "fei1dlin.h"
36#include "mathfem.h"
37#include "floatmatrix.h"
38#include "floatarray.h"
39#include "floatmatrixf.h"
40#include "floatarrayf.h"
41
42namespace oofem {
43double
44FEI1dLin :: giveLength(const FEICellGeometry &cellgeo) const
45{
46 return fabs( cellgeo.giveVertexCoordinates(2).at(cindx) - cellgeo.giveVertexCoordinates(1).at(cindx) );
47}
48
50FEI1dLin :: evalN(double ksi)
51{
52 return {( 1. - ksi ) * 0.5, ( 1. + ksi ) * 0.5};
53}
54
55void
56FEI1dLin :: evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
57{
58 double ksi = lcoords.at(1);
59 answer.resize(2);
60
61 answer.at(1) = ( 1. - ksi ) * 0.5;
62 answer.at(2) = ( 1. + ksi ) * 0.5;
63}
64
65std::pair<double, FloatMatrixF<1,2>>
66FEI1dLin :: evaldNdx(const FEICellGeometry &cellgeo) const
67{
68 double l = cellgeo.giveVertexCoordinates(2).at(cindx) - cellgeo.giveVertexCoordinates(1).at(cindx);
69 return {0.5 * l, {-1.0 / l, 1.0 / l}};
70}
71
72double
73FEI1dLin :: evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
74{
75 double l = cellgeo.giveVertexCoordinates(2).at(cindx) - cellgeo.giveVertexCoordinates(1).at(cindx);
76 answer.resize(2, 1);
77
78 answer.at(1, 1) = -1.0 / l;
79 answer.at(2, 1) = 1.0 / l;
80 return 0.5 * l;
81}
82
83void
84FEI1dLin :: local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
85{
86 FloatArray n;
87 answer.resize(1);
88
89 this->evalN(n, lcoords, cellgeo);
90 answer.at(1) = n.at(1) * cellgeo.giveVertexCoordinates(1).at(cindx) +
91 n.at(2) * cellgeo.giveVertexCoordinates(2).at(cindx);
92}
93
94int
95FEI1dLin :: global2local(FloatArray &answer, const FloatArray &coords, const FEICellGeometry &cellgeo) const
96{
97 double x1 = cellgeo.giveVertexCoordinates(1).at(cindx);
98 double x2 = cellgeo.giveVertexCoordinates(2).at(cindx);
99 double ksi = ( 2.0 * coords.at(1) - ( x1 + x2 ) ) / ( x2 - x1 );
100 answer.resize(1);
101 answer.at(1) = clamp(ksi, -1., 1.);
102 return fabs(ksi) <= 1.0;
103}
104
105double
106FEI1dLin :: giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
107{
108 return 0.5 * ( cellgeo.giveVertexCoordinates(2).at(cindx) - cellgeo.giveVertexCoordinates(1).at(cindx) );
109}
110
111IntArray FEI1dLin :: boundaryEdgeGiveNodes(int boundary, Element_Geometry_Type egt, bool includeHierarchical) const
112{
113 return {1, 2};
114}
115
116void FEI1dLin :: boundaryEdgeEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
117{
118 this->evalN(answer, lcoords, cellgeo);
119}
120
121double FEI1dLin :: boundaryEdgeGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
122{
123 return this->giveTransformationJacobian(lcoords, cellgeo);
124}
125
126void FEI1dLin :: boundaryEdgeLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
127{
128 this->local2global(answer, lcoords, cellgeo);
129}
130
131
132
133} // end namespace oofem
void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override
Definition fei1dlin.C:84
static FloatArrayF< 2 > evalN(double ksi)
Definition fei1dlin.C:50
double giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override
Definition fei1dlin.C:106
virtual const FloatArray giveVertexCoordinates(int i) const =0
void resize(Index s)
Definition floatarray.C:94
double & at(Index i)
Definition floatarray.h:202
void resize(Index rows, Index cols)
Definition floatmatrix.C:79
double at(std::size_t i, std::size_t j) const
double clamp(int a, int lower, int upper)
Returns the clamped value of a between upper and lower.
Definition mathfem.h:88

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