OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
discsegintegrationrule.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 "discsegintegrationrule.h"
36 
37 #include "gausspoint.h"
38 #include "fei1dlin.h"
39 
40 namespace oofem {
41 DiscontinuousSegmentIntegrationRule :: DiscontinuousSegmentIntegrationRule(int n, Element *e, const std :: vector< Line > &iSegments) :
43  mSegments(iSegments)
44 {}
45 
47 
49 {
50  int numPointsTot = iNumPointsPerSeg * mSegments.size();
51  int pointsPassed = 0;
52 
54  // Allocate Gauss point array
55  FloatArray coords_xi, weights;
56  this->giveLineCoordsAndWeights(iNumPointsPerSeg, coords_xi, weights);
57  this->gaussPoints.resize(numPointsTot);
59 
60  double totalLength = 0.0;
61  for( Line &line : mSegments ) {
62  totalLength += line.giveLength();
63  }
64 
65  const FloatArray &xS = mSegments[0].giveVertex(1);
66 
67  std :: vector< FloatArray >newGPCoord;
68 
69  // Loop over line segments
70  for ( size_t i = 0; i < mSegments.size(); i++ ) {
71  for ( int j = 0; j < iNumPointsPerSeg; j++ ) {
72  FloatArray global;
73  GaussPoint * &gp = this->gaussPoints [ pointsPassed ];
74 
75  gp = new GaussPoint(this, pointsPassed + 1, {coords_xi.at(j + 1)}, weights.at(j + 1), mode);
76 
77  const FloatArray &coord = gp->giveNaturalCoordinates();
78 
79  global.resize( xS.giveSize() );
80  for ( int m = 1; m <= xS.giveSize(); m++ ) {
81 
82 // if( mSegments [ i ].giveNrVertices() < 2 ) {
83 // printf("mSegments [ i ].giveNrVertices(): %d\n", mSegments [ i ].giveNrVertices() );
84 // }
85 
86  global.at(m) = 0.5 * ( ( 1.0 - coord.at(1) ) * mSegments [ i ].giveVertex(1).at(m) + ( 1.0 + coord.at(1) ) * mSegments [ i ].giveVertex(2).at(m) );
87  }
88 
89  newGPCoord.push_back(global);
90 
91 
92  // Local coordinate along the line segment
93  double xi = 2.0 * ( global.distance(xS) / totalLength - 0.5 );
94  gp->setNaturalCoordinates({ xi });
95 
96  gp->setSubPatchCoordinates({ xi });
97  gp->setGlobalCoordinates(global);
98 
99  gp->setWeight(1.0 * gp->giveWeight() * mSegments [ i ].giveLength() / totalLength); // update integration weight
100 
101  pointsPassed++;
102  }
103  }
104 
105  return this->giveNumberOfIntegrationPoints();
106 }
107 } /* namespace oofem */
static void giveLineCoordsAndWeights(int nPoints, FloatArray &coords_xi, FloatArray &weights)
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
DiscontinuousSegmentIntegrationRule(int n, Element *e, const std::vector< Line > &iSegments)
Start and end points of the boundary segment.
void setGlobalCoordinates(const FloatArray &iCoord)
Definition: gausspoint.h:171
Abstract base class for all finite elements.
Definition: element.h:145
void setWeight(double w)
Definition: gausspoint.h:182
MaterialMode
Type representing material mode of integration point.
Definition: materialmode.h:89
void setSubPatchCoordinates(const FloatArray &c)
Definition: gausspoint.h:151
double distance(const FloatArray &x) const
Computes the distance between position represented by receiver and position given as parameter...
Definition: floatarray.C:489
virtual double giveWeight()
Returns integration weight of receiver.
Definition: gausspoint.h:181
virtual int SetUpPointsOnLine(int iNumPointsPerSeg, MaterialMode mode)
Sets up receiver&#39;s integration points on unit line integration domain.
Class representing vector of real numbers.
Definition: floatarray.h:82
void setNaturalCoordinates(const FloatArray &c)
Definition: gausspoint.h:139
int giveNumberOfIntegrationPoints() const
Returns number of integration points of receiver.
int giveSize() const
Returns the size of receiver.
Definition: floatarray.h:218
the oofem namespace is to define a context or scope in which all oofem names are defined.
Class representing integration point in finite element program.
Definition: gausspoint.h:93
std::vector< GaussPoint * > gaussPoints
Array containing integration points.
const FloatArray & giveNaturalCoordinates()
Returns coordinate array of receiver.
Definition: gausspoint.h:138
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