OOFEM 3.0
Loading...
Searching...
No Matches
listbasedei.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/listbasedei.h"
36#include "xfemmanager.h"
37#include "domain.h"
38#include "classfactory.h"
39#include "engngm.h"
40#include "timestep.h"
41#include "xfem/propagationlaw.h"
42
43#include <string>
44#include <algorithm>
45
46namespace oofem {
47//REGISTER_EnrichmentItem(ListBasedEI)
48
49ListBasedEI :: ListBasedEI(int n, XfemManager *xm, Domain *aDomain) :
50 EnrichmentItem(n, xm, aDomain)
51{}
52
53ListBasedEI :: ~ListBasedEI()
54{}
55
56void ListBasedEI :: updateGeometry()
57{
58 // Update enrichments ...
59 XfemManager *xMan = this->giveDomain()->giveXfemManager();
60 // mpEnrichmentDomain->CallNodeEnrMarkerUpdate(* this, * xMan);
61
62 this->updateNodeEnrMarker(* xMan);
63 // ... and create new dofs if necessary.
65}
66
67void ListBasedEI :: propagateFronts(bool &oFrontsHavePropagated)
68{
69 oFrontsHavePropagated = false;
70
71 TipPropagation tipProp;
72 if ( mpPropagationLaw->propagateInterface(* giveDomain(), * mpEnrichmentFrontStart, tipProp) ) {
73 // TODO: Generalize
74 // Propagate front
75
76 for ( int i = 1; i <= tipProp.mPropagationDofManNumbers.giveSize(); i++ ) {
77 //std::list< int > :: iterator p;
78 std :: vector< int > :: iterator p;
79 p = std :: find( this->dofManList.begin(), this->dofManList.end(), tipProp.mPropagationDofManNumbers.at(i) );
80 if ( p == this->dofManList.end() ) { // if new node
81 this->dofManList.push_back( tipProp.mPropagationDofManNumbers.at(i) );
82 }
83 }
84
85 std :: sort( dofManList.begin(), this->dofManList.end() );
86
87 oFrontsHavePropagated = true;
88 }
89
90 this->updateGeometry();
91
92
93}
94
95void
96ListBasedEI :: initiateFronts(bool &oFrontsHavePropagated, IntArray &initiateDofMans)
97{
98 oFrontsHavePropagated = false;
99
100 printf("\n Enrichment %i - The following nodes have been initiated: ",this->giveNumber());
101 for ( int i = 1; i <= initiateDofMans.giveSize(); i++ ) {
102 //std::list< int > :: iterator p;
103 std :: vector< int > :: iterator p;
104 p = std :: find( this->dofManList.begin(), this->dofManList.end(), initiateDofMans.at(i) );
105 if ( p == this->dofManList.end() ) { // if new node
106 printf(" %i", initiateDofMans.at(i) );
107 this->dofManList.push_back( initiateDofMans.at(i) );
108 }
109 }
110 printf(" \n");
111
112 std :: sort( dofManList.begin(), this->dofManList.end() );
113
114 oFrontsHavePropagated = true;
115
116 this->updateGeometry();
117
118}
119
120void ListBasedEI :: updateNodeEnrMarker(XfemManager &ixFemMan)
121{
122 mNodeEnrMarkerMap.clear();
123 TipInfo tipInfo;
124 //TipInfo *tipInfo = mpEnrichmentFrontStart->giveTipInfo();
125 //tipInfo->mTipDofManNumbers.clear();
126 //this->mpEnrichmentFrontStart->giveTipInfo().mTipDofManNumbers.clear();
127
128 // Update the dofManList and the enrichment boundaries.
129 // For now let all nodes in dofManList be the boundary
130
131 // Loop over nodes in the DofManList and mark nodes as enriched.
132 bool printed = false;
133 for ( auto &dman : dofManList ) {
135 if ( !printed ) {
136 printf("\n Enrichment %i - The following nodes are enriched:",this->giveNumber());
137 printed = true;
138 }
139 printf(" %i", dman );
140 //TODO change this so only the boundaries are added to tipInfo, now all nodes are added
141 tipInfo.mTipDofManNumbers.insertSorted(dman);
142 //this->mpEnrichmentFrontStart->giveTipInfo().mTipDofManNumbers.insertSorted(dman);
143 }
144 printf(" \n");
145 //tipInfo.mTipDofManNumbers.printYourself("tip dofManNumbers (updateNodeEnrMarker)");
146 //this->mpEnrichmentFrontStart->giveTipInfo().mTipDofManNumbers.printYourself("tip dofManNumbers (updateNodeEnrMarker)");
147
148
149 // Update tipInfo
150 mpEnrichmentFrontStart->setTipInfo( tipInfo );
151
152 // Set level set fields to zero
153 //mLevelSetSurfaceNormalDir.resize(nNodes, 0.0); // New /JB
154}
155
156bool ListBasedEI :: giveElementTipCoord(FloatArray &oCoord, double &oArcPos, Element &iEl, const FloatArray &iElCenter) const
157{
158 // No tips can be defined for list based enrichment items.
159 // Hence, we return false.
160 return false;
161}
162} /* namespace oofem */
std ::unordered_map< int, NodeEnrichmentType > mNodeEnrMarkerMap
std::unique_ptr< EnrichmentFront > mpEnrichmentFrontStart
std::unique_ptr< PropagationLaw > mpPropagationLaw
EnrichmentItem(int n, XfemManager *xm, Domain *aDomain)
Constructor / destructor.
virtual void createEnrichedDofs()
Domain * giveDomain() const
Definition femcmpnn.h:97
int giveNumber() const
Definition femcmpnn.h:104
void insertSorted(int value, int allocChunk=0)
Definition intarray.C:299
int & at(std::size_t i)
Definition intarray.h:104
int giveSize() const
Definition intarray.h:211
void updateNodeEnrMarker(XfemManager &ixFemMan) override
std ::vector< int > dofManList
Definition listbasedei.h:73
void updateGeometry() override
Definition listbasedei.C:56
IntArray mTipDofManNumbers
Local number of which edge the crack enters the element (2d).
Definition tipinfo.h:36
IntArray mPropagationDofManNumbers
Definition tipinfo.h:46

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