OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
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 - 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 "fei2dquadconst.h"
36 #include "mathfem.h"
37 #include "floatmatrix.h"
38 #include "floatarray.h"
39 #include "gaussintegrationrule.h"
40 
41 namespace oofem {
42 void
43 FEI2dQuadConst :: evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
44 {
45  answer.resize(1);
46  answer.at(1) = 1.;
47 }
48 
49 double
50 FEI2dQuadConst :: evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
51 {
52  answer.resize(1, 2);
53  answer.at(1, 1) = 0.;
54  answer.at(1, 2) = 0.;
55  return 0.;
56 }
57 
58 void
59 FEI2dQuadConst :: local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
60 {
61  answer.resize(2);
62 
63  answer.at(1) = 0.25 * ( cellgeo.giveVertexCoordinates(1)->at(xind) +
64  cellgeo.giveVertexCoordinates(2)->at(xind) +
65  cellgeo.giveVertexCoordinates(3)->at(xind) +
66  cellgeo.giveVertexCoordinates(4)->at(xind) );
67  answer.at(2) = 0.25 * ( cellgeo.giveVertexCoordinates(1)->at(yind) +
68  cellgeo.giveVertexCoordinates(2)->at(yind) +
69  cellgeo.giveVertexCoordinates(3)->at(yind) +
70  cellgeo.giveVertexCoordinates(4)->at(yind) );
71 }
72 
73 
74 bool FEI2dQuadConst :: inside(const FloatArray &lcoords) const
75 {
76  const double point_tol = 1.0e-3;
77  bool inside = true;
78  for ( int i = 1; i <= 2; i++ ) {
79  if ( lcoords.at(i) < ( -1. - point_tol ) ) {
80  inside = false;
81  } else if ( lcoords.at(i) > ( 1. + point_tol ) ) {
82  inside = false;
83  }
84  }
85 
86  return inside;
87 }
88 
89 
90 void
91 FEI2dQuadConst :: edgeEvalN(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
92 {
93  answer = FloatArray{1.};
94 }
95 
96 
97 double FEI2dQuadConst :: edgeEvalNormal(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
98 {
99  OOFEM_ERROR("not implemented");
100  return 0.;
101 }
102 
103 void
105  const FloatArray &lcoords, const FEICellGeometry &cellgeo)
106 {
107  OOFEM_ERROR("not implemented");
108 }
109 
110 void
112  const FloatArray &lcoords, const FEICellGeometry &cellgeo)
113 {
114  OOFEM_ERROR("not implemented");
115 }
116 
117 void
119 {
120  int aNode = 0, bNode = 0;
121  edgeNodes.resize(2);
122 
123  if ( iedge == 1 ) { // edge between nodes 1 2
124  aNode = 1;
125  bNode = 2;
126  } else if ( iedge == 2 ) { // edge between nodes 2 3
127  aNode = 2;
128  bNode = 3;
129  } else if ( iedge == 3 ) { // edge between nodes 2 3
130  aNode = 3;
131  bNode = 1;
132  } else {
133  OOFEM_ERROR("wrong egde number (%d)", iedge);
134  }
135 
136  edgeNodes.at(1) = aNode;
137  edgeNodes.at(2) = bNode;
138 }
139 
140 double
142 {
143  double dx, dy;
144  int nodeA, nodeB;
145 
146  nodeA = edgeNodes.at(1);
147  nodeB = edgeNodes.at(2);
148 
149  dx = cellgeo.giveVertexCoordinates(nodeB)->at(xind) - cellgeo.giveVertexCoordinates(nodeA)->at(xind);
150  dy = cellgeo.giveVertexCoordinates(nodeB)->at(yind) - cellgeo.giveVertexCoordinates(nodeA)->at(yind);
151  return sqrt(dx * dx + dy * dy);
152 }
153 
156 {
157  IntegrationRule *iRule = new GaussIntegrationRule(1, NULL);
158  int points = iRule->getRequiredNumberOfIntegrationPoints(_Square, order + 0);
159  iRule->SetUpPointsOnSquare(points, _Unknown);
160  return iRule;
161 }
162 } // end namespace oofem
virtual void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the array of interpolation functions (shape functions) at given point.
virtual void edgeLocal2global(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates edge global coordinates from given local ones.
double edgeComputeLength(IntArray &edgeNodes, const FEICellGeometry &cellgeo)
Computes the length of a given edge.
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
virtual const FloatArray * giveVertexCoordinates(int i) const =0
virtual void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates global coordinates from given local ones.
Class representing a general abstraction for cell geometry.
Definition: feinterpol.h:62
virtual double evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the matrix of derivatives of interpolation functions (shape functions) at given point...
virtual int SetUpPointsOnSquare(int, MaterialMode mode)
Sets up receiver&#39;s integration points on unit square integration domain.
virtual void computeLocalEdgeMapping(IntArray &edgeNodes, int iedge)
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
Abstract base class representing integration rule.
virtual double edgeEvalNormal(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the normal on the given edge.
#define OOFEM_ERROR(...)
Definition: error.h:61
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
void resize(int n)
Checks size of receiver towards requested bounds.
Definition: intarray.C:124
virtual IntegrationRule * giveIntegrationRule(int order)
Sets up a suitable integration rule for numerical integrating over volume.
Class representing vector of real numbers.
Definition: floatarray.h:82
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
virtual void edgeEvaldNds(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the matrix of derivatives of edge interpolation functions (shape functions) at given point...
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 void edgeEvalN(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the array of edge interpolation functions (shape functions) at given point.
the oofem namespace is to define a context or scope in which all oofem names are defined.
Class representing Gaussian-quadrature integration rule.
virtual bool inside(const FloatArray &lcoords) const
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