OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
hybridei.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 "xfem/hybridei.h"
36 #include "xfemmanager.h"
37 #include "node.h"
38 #include "domain.h"
39 #include "floatmatrix.h"
40 #include "classfactory.h"
41 
42 #include <string>
43 
44 
45 namespace oofem {
47 
48 HybridEI :: HybridEI(int n, XfemManager *xm, Domain *aDomain) :
49  GeometryBasedEI(n, xm, aDomain)
50 {}
51 
53 {}
54 
55 void HybridEI :: evalLevelSetNormal(double &oLevelSet, const FloatArray &iGlobalCoord, const FloatArray &iN, const IntArray &iNodeInd) const
56 {
57  interpLevelSet(oLevelSet, iN, iNodeInd);
58 }
59 
60 void HybridEI :: evalLevelSetTangential(double &oLevelSet, const FloatArray &iGlobalCoord, const FloatArray &iN, const IntArray &iNodeInd) const
61 {
62  interpLevelSetTangential(oLevelSet, iN, iNodeInd);
63 }
64 
65 void HybridEI :: evalGradLevelSetNormal(FloatArray &oGradLevelSet, const FloatArray &iGlobalCoord, const FloatMatrix &idNdX, const IntArray &iNodeInd) const
66 {
67  interpGradLevelSet(oGradLevelSet, idNdX, iNodeInd);
68 }
69 
70 void HybridEI :: interpLevelSet(double &oLevelSet, const FloatArray &iN, const IntArray &iNodeInd) const
71 {
72  oLevelSet = 0.0;
73  for ( int i = 1; i <= iN.giveSize(); i++ ) {
74  double levelSetNode = 0.0;
75  const FloatArray &nodePos = this->giveDomain()->giveNode(iNodeInd [ i - 1 ])->giveNodeCoordinates();
76  if ( evalLevelSetNormalInNode(levelSetNode, iNodeInd [ i - 1 ], nodePos) ) {
77  oLevelSet += iN.at(i) * levelSetNode;
78  }
79  }
80 }
81 
82 void HybridEI :: interpLevelSetTangential(double &oLevelSet, const FloatArray &iN, const IntArray &iNodeInd) const
83 {
84  oLevelSet = 0.0;
85  for ( int i = 1; i <= iN.giveSize(); i++ ) {
86  double levelSetNode = 0.0;
87  const FloatArray &nodePos = this->giveDomain()->giveNode(iNodeInd [ i - 1 ])->giveNodeCoordinates();
88  if ( evalLevelSetTangInNode(levelSetNode, iNodeInd [ i - 1 ], nodePos) ) {
89  oLevelSet += iN.at(i) * levelSetNode;
90  }
91  }
92 }
93 
94 void HybridEI :: interpGradLevelSet(FloatArray &oGradLevelSet, const FloatMatrix &idNdX, const IntArray &iNodeInd) const
95 {
96  int dim = idNdX.giveNumberOfColumns();
97 
98  if ( oGradLevelSet.giveSize() != dim ) {
99  oGradLevelSet.resize(dim);
100  }
101 
102  oGradLevelSet.zero();
103 
104  for ( int i = 1; i <= idNdX.giveNumberOfRows(); i++ ) {
105  for ( int j = 1; j <= dim; j++ ) {
106  double levelSetNode = 0.0;
107  const FloatArray &nodePos = this->giveDomain()->giveNode(iNodeInd [ i - 1 ])->giveNodeCoordinates();
108  if ( evalLevelSetNormalInNode(levelSetNode, iNodeInd [ i - 1 ], nodePos) ) {
109  oGradLevelSet.at(j) += idNdX.at(i, j) * levelSetNode;
110  }
111  }
112  }
113 }
114 } /* namespace oofem */
int giveNumberOfColumns() const
Returns number of columns of receiver.
Definition: floatmatrix.h:158
Class and object Domain.
Definition: domain.h:115
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
EnrichmentItem with hybrid geometry description in the following sense: We have a BasicGeometry to de...
Definition: hybridei.h:54
virtual ~HybridEI()
Definition: hybridei.C:52
Class implementing an array of integers.
Definition: intarray.h:61
virtual void evalLevelSetTangential(double &oLevelSet, const FloatArray &iGlobalCoord, const FloatArray &iN, const IntArray &iNodeInd) const
Evaluate the tangential direction level set in the point iGlobalCoord.
Definition: hybridei.C:60
void interpGradLevelSet(FloatArray &oGradLevelSet, const FloatMatrix &idNdX, const IntArray &iNodeInd) const
Definition: hybridei.C:94
REGISTER_EnrichmentItem(HybridEI)
Definition: hybridei.C:46
bool evalLevelSetNormalInNode(double &oLevelSet, int iNodeInd, const FloatArray &iGlobalCoord) const
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
virtual void evalGradLevelSetNormal(FloatArray &oGradLevelSet, const FloatArray &iGlobalCoord, const FloatMatrix &idNdX, const IntArray &iNodeInd) const
Evaluate the gradient of the normal direction level set in the point iGlobalCoord.
Definition: hybridei.C:65
void interpLevelSetTangential(double &oLevelSet, const FloatArray &iN, const IntArray &iNodeInd) const
Definition: hybridei.C:82
bool evalLevelSetTangInNode(double &oLevelSet, int iNodeInd, const FloatArray &iGlobalCoord) const
Class representing vector of real numbers.
Definition: floatarray.h:82
virtual void evalLevelSetNormal(double &oLevelSet, const FloatArray &iGlobalCoord, const FloatArray &iN, const IntArray &iNodeInd) const
Evaluate the normal direction level set in the point iGlobalCoord.
Definition: hybridei.C:55
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
void interpLevelSet(double &oLevelSet, const FloatArray &iN, const IntArray &iNodeInd) const
Definition: hybridei.C:70
This class manages the xfem part.
Definition: xfemmanager.h:109
const FloatArray & giveNodeCoordinates() const
As giveCoordinates, but non-virtual and therefore faster (because it can be inlined).
Definition: node.h:120
void zero()
Zeroes all coefficients of receiver.
Definition: floatarray.C:658
Domain * giveDomain() const
Definition: femcmpnn.h:100
int giveSize() const
Returns the size of receiver.
Definition: floatarray.h:218
Node * giveNode(int n)
Service for accessing particular domain node.
Definition: domain.h:371
the oofem namespace is to define a context or scope in which all oofem names are defined.
int giveNumberOfRows() const
Returns number of rows of receiver.
Definition: floatmatrix.h:156
EnrichmentItem with geometry described by BasicGeometry.
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:29 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011