OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
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 - 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/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 
46 namespace oofem {
47 //REGISTER_EnrichmentItem(ListBasedEI)
48 
50  EnrichmentItem(n, xm, aDomain)
51 {}
52 
54 {}
55 
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 
67 void ListBasedEI :: propagateFronts(bool &oFrontsHavePropagated)
68 {
69  oFrontsHavePropagated = false;
70 
71  TipPropagation 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 
95 void
96 ListBasedEI :: 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 
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 ) {
134  mNodeEnrMarkerMap [ dman ] = NodeEnr_BULK;
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
151 
152  // Set level set fields to zero
153  //mLevelSetSurfaceNormalDir.resize(nNodes, 0.0); // New /JB
154 }
155 
156 bool 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 */
virtual ~ListBasedEI()
Definition: listbasedei.C:53
Abstract class representing entity, which is included in the FE model using one (or more) global func...
Class and object Domain.
Definition: domain.h:115
std::unordered_map< int, NodeEnrichmentType > mNodeEnrMarkerMap
virtual void updateGeometry()
Definition: listbasedei.C:56
TipInfo gathers useful information about a crack tip, like its position and tangent direction...
Definition: tipinfo.h:24
IntArray mPropagationDofManNumbers
Definition: tipinfo.h:46
Abstract base class for all finite elements.
Definition: element.h:145
virtual void updateNodeEnrMarker(XfemManager &ixFemMan)
Definition: listbasedei.C:120
virtual void initiateFronts(bool &oFrontsHavePropagated, IntArray &initiateDofMans)
Definition: listbasedei.C:96
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
IntArray mTipDofManNumbers
Local number of which edge the crack enters the element (2d)
Definition: tipinfo.h:36
XfemManager * giveXfemManager()
Definition: domain.C:375
void sort(IntArray &arry, operation op)
Sorts the receiver using quicksort algorithm.
Definition: intarray.h:416
virtual void createEnrichedDofs()
virtual void propagateFronts(bool &oFrontsHavePropagated)
Definition: listbasedei.C:67
virtual void setTipInfo(const TipInfo &iTipInfo)
virtual bool giveElementTipCoord(FloatArray &oCoord, double &oArcPos, Element &iEl, const FloatArray &iElCenter) const
Definition: listbasedei.C:156
void insertSorted(int value, int allocChunk=0)
Inserts given value into a receiver, which is assumed to be sorted.
Definition: intarray.C:350
virtual bool propagateInterface(Domain &iDomain, EnrichmentFront &iEnrFront, TipPropagation &oTipProp)=0
ListBasedEI(int n, XfemManager *xm, Domain *aDomain)
Definition: listbasedei.C:49
std::vector< int > dofManList
Definition: listbasedei.h:73
Class representing vector of real numbers.
Definition: floatarray.h:82
PropagationLaw * mpPropagationLaw
This class manages the xfem part.
Definition: xfemmanager.h:109
EnrichmentFront * mpEnrichmentFrontStart
Domain * giveDomain() const
Definition: femcmpnn.h:100
int giveSize() const
Definition: intarray.h:203
the oofem namespace is to define a context or scope in which all oofem names are defined.
int giveNumber() const
Definition: femcmpnn.h:107

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