OOFEM 3.0
Loading...
Searching...
No Matches
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 - 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
36
37#include "gausspoint.h"
38#include "fei1dlin.h"
39
40namespace oofem {
41DiscontinuousSegmentIntegrationRule :: DiscontinuousSegmentIntegrationRule(int n, Element *e, const std :: vector< Line > &iSegments) :
43 mSegments(iSegments)
44{}
45
46DiscontinuousSegmentIntegrationRule :: ~DiscontinuousSegmentIntegrationRule() {}
47
48int DiscontinuousSegmentIntegrationRule :: SetUpPointsOnLine(int iNumPointsPerSeg, MaterialMode mode)
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 * ( distance(global, 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 */
void resize(Index s)
Definition floatarray.C:94
double & at(Index i)
Definition floatarray.h:202
Index giveSize() const
Returns the size of receiver.
Definition floatarray.h:261
GaussIntegrationRule(int n, Element *e, int startIndx, int endIndx, bool dynamic=false)
static void giveLineCoordsAndWeights(int nPoints, FloatArray &coords_xi, FloatArray &weights)
void setNaturalCoordinates(const FloatArray &c)
Definition gausspoint.h:139
const FloatArray & giveNaturalCoordinates() const
Returns coordinate array of receiver.
Definition gausspoint.h:138
void setSubPatchCoordinates(const FloatArray &c)
Definition gausspoint.h:150
void setWeight(double w)
Definition gausspoint.h:181
double giveWeight()
Returns integration weight of receiver.
Definition gausspoint.h:180
void setGlobalCoordinates(const FloatArray &iCoord)
Definition gausspoint.h:170
int giveNumberOfIntegrationPoints() const
std::vector< GaussPoint * > gaussPoints
Array containing integration points.
double distance(const FloatArray &x, const FloatArray &y)

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