OOFEM 3.0
Loading...
Searching...
No Matches
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 - 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 "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
45namespace oofem {
47
48HybridEI :: HybridEI(int n, XfemManager *xm, Domain *aDomain) :
49 GeometryBasedEI(n, xm, aDomain)
50{}
51
52HybridEI :: ~HybridEI()
53{}
54
55void HybridEI :: evalLevelSetNormal(double &oLevelSet, const FloatArray &iGlobalCoord, const FloatArray &iN, const IntArray &iNodeInd) const
56{
57 interpLevelSet(oLevelSet, iN, iNodeInd);
58}
59
60void HybridEI :: evalLevelSetTangential(double &oLevelSet, const FloatArray &iGlobalCoord, const FloatArray &iN, const IntArray &iNodeInd) const
61{
62 interpLevelSetTangential(oLevelSet, iN, iNodeInd);
63}
64
65void HybridEI :: evalGradLevelSetNormal(FloatArray &oGradLevelSet, const FloatArray &iGlobalCoord, const FloatMatrix &idNdX, const IntArray &iNodeInd) const
66{
67 interpGradLevelSet(oGradLevelSet, idNdX, iNodeInd);
68}
69
70void 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 auto &nodePos = this->giveDomain()->giveNode(iNodeInd [ i - 1 ])->giveCoordinates();
76 if ( evalLevelSetNormalInNode(levelSetNode, iNodeInd [ i - 1 ], nodePos) ) {
77 oLevelSet += iN.at(i) * levelSetNode;
78 }
79 }
80}
81
82void 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 auto &nodePos = this->giveDomain()->giveNode(iNodeInd [ i - 1 ])->giveCoordinates();
88 if ( evalLevelSetTangInNode(levelSetNode, iNodeInd [ i - 1 ], nodePos) ) {
89 oLevelSet += iN.at(i) * levelSetNode;
90 }
91 }
92}
93
94void 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 auto &nodePos = this->giveDomain()->giveNode(iNodeInd [ i - 1 ])->giveCoordinates();
108 if ( evalLevelSetNormalInNode(levelSetNode, iNodeInd [ i - 1 ], nodePos) ) {
109 oGradLevelSet.at(j) += idNdX.at(i, j) * levelSetNode;
110 }
111 }
112 }
113}
114} /* namespace oofem */
#define REGISTER_EnrichmentItem(class)
bool evalLevelSetTangInNode(double &oLevelSet, int iNodeInd, const FloatArray &iGlobalCoord) const
bool evalLevelSetNormalInNode(double &oLevelSet, int iNodeInd, const FloatArray &iGlobalCoord) const
Domain * giveDomain() const
Definition femcmpnn.h:97
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
void zero()
Zeroes all coefficients of receiver.
Definition floatarray.C:683
int giveNumberOfColumns() const
Returns number of columns of receiver.
int giveNumberOfRows() const
Returns number of rows of receiver.
double at(std::size_t i, std::size_t j) const
void interpLevelSetTangential(double &oLevelSet, const FloatArray &iN, const IntArray &iNodeInd) const
Definition hybridei.C:82
void interpGradLevelSet(FloatArray &oGradLevelSet, const FloatMatrix &idNdX, const IntArray &iNodeInd) const
Definition hybridei.C:94
void interpLevelSet(double &oLevelSet, const FloatArray &iN, const IntArray &iNodeInd) const
Definition hybridei.C:70

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