OOFEM 3.0
Loading...
Searching...
No Matches
fei2dquadconst.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 "fei2dquadconst.h"
36#include "mathfem.h"
37#include "floatmatrix.h"
38#include "floatarray.h"
40#include <stdexcept>
41
42namespace oofem {
43void
44FEI2dQuadConst :: evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
45{
46 answer.resize(1);
47 answer.at(1) = 1.;
48}
49
50double
51FEI2dQuadConst :: evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
52{
53 answer.resize(1, 2);
54 answer.at(1, 1) = 0.;
55 answer.at(1, 2) = 0.;
56 return 0.;
57}
58
59void
60FEI2dQuadConst :: local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
61{
62 answer.resize(2);
63
64 answer.at(1) = 0.25 * ( cellgeo.giveVertexCoordinates(1).at(xind) +
65 cellgeo.giveVertexCoordinates(2).at(xind) +
66 cellgeo.giveVertexCoordinates(3).at(xind) +
67 cellgeo.giveVertexCoordinates(4).at(xind) );
68 answer.at(2) = 0.25 * ( cellgeo.giveVertexCoordinates(1).at(yind) +
69 cellgeo.giveVertexCoordinates(2).at(yind) +
70 cellgeo.giveVertexCoordinates(3).at(yind) +
71 cellgeo.giveVertexCoordinates(4).at(yind) );
72}
73
74
75bool FEI2dQuadConst :: inside(const FloatArray &lcoords) const
76{
77 const double point_tol = 1.0e-3;
78 bool inside = true;
79 for ( int i = 1; i <= 2; i++ ) {
80 if ( lcoords.at(i) < ( -1. - point_tol ) ) {
81 inside = false;
82 } else if ( lcoords.at(i) > ( 1. + point_tol ) ) {
83 inside = false;
84 }
85 }
86
87 return inside;
88}
89
90
91void
92FEI2dQuadConst :: edgeEvalN(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
93{
94 answer = Vec1(1.);
95}
96
97
98double FEI2dQuadConst :: edgeEvalNormal(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
99{
100 OOFEM_ERROR("not implemented");
101 //return 0.;
102}
103
104void
105FEI2dQuadConst :: edgeEvaldNds(FloatArray &answer, int iedge,
106 const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
107{
108 OOFEM_ERROR("not implemented");
109}
110
111void
112FEI2dQuadConst :: edgeLocal2global(FloatArray &answer, int iedge,
113 const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
114{
115 OOFEM_ERROR("not implemented");
116}
117
119FEI2dQuadConst :: computeLocalEdgeMapping(int iedge) const
120{
121 if ( iedge == 1 ) { // edge between nodes 1 2
122 return {1, 2};
123 } else if ( iedge == 2 ) { // edge between nodes 2 3
124 return {2, 3};
125 } else if ( iedge == 3 ) { // edge between nodes 2 3
126 return {3, 1};
127 } else {
128 throw std::range_error("invalid egde number");
129 //return {};
130 }
131}
132
133double
134FEI2dQuadConst :: edgeComputeLength(const IntArray &edgeNodes, const FEICellGeometry &cellgeo) const
135{
136 int nodeA = edgeNodes.at(1);
137 int nodeB = edgeNodes.at(2);
138
139 double dx = cellgeo.giveVertexCoordinates(nodeB).at(xind) - cellgeo.giveVertexCoordinates(nodeA).at(xind);
140 double dy = cellgeo.giveVertexCoordinates(nodeB).at(yind) - cellgeo.giveVertexCoordinates(nodeA).at(yind);
141 return sqrt(dx * dx + dy * dy);
142}
143
144std::unique_ptr<IntegrationRule>
145FEI2dQuadConst :: giveIntegrationRule(int order, Element_Geometry_Type egt) const
146{
147 auto iRule = std::make_unique<GaussIntegrationRule>(1, nullptr);
148 int points = iRule->getRequiredNumberOfIntegrationPoints(_Square, order + 0);
149 iRule->SetUpPointsOnSquare(points, _Unknown);
150 return std::move(iRule);
151}
152} // end namespace oofem
bool inside(const FloatArray &lcoords) const override
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
int & at(std::size_t i)
Definition intarray.h:104
#define OOFEM_ERROR(...)
Definition error.h:79
static FloatArray Vec1(const double &a)
Definition floatarray.h:605

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