OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
enrichmentfrontextend.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 "enrichmentfrontextend.h"
36 #include "dynamicinputrecord.h"
37 #include "classfactory.h"
38 #include "xfem/xfemmanager.h"
39 #include "domain.h"
40 #include "connectivitytable.h"
41 #include "element.h"
42 
43 namespace oofem {
45 
46 void EnrFrontExtend :: MarkNodesAsFront(std :: unordered_map< int, NodeEnrichmentType > &ioNodeEnrMarkerMap, XfemManager &ixFemMan, const std :: unordered_map< int, double > &iLevelSetNormalDirMap, const std :: unordered_map< int, double > &iLevelSetTangDirMap, const TipInfo &iTipInfo)
47 {
48  mTipInfo = iTipInfo;
49  // Extend the set of enriched nodes as follows:
50  // If any node of the neighboring elements is enriched, the current node is also enriched.
51 
52  Domain &d = * ( ixFemMan.giveDomain() );
53 
54  // Loop over all nodes
55  int nNodes = d.giveNumberOfDofManagers();
56 
57  std :: vector< int >newEnrNodes;
58  for ( int i = 1; i <= nNodes; i++ ) {
59  // Check if the node is already enriched
60  bool alreadyEnr = false;
61  auto resMarker = ioNodeEnrMarkerMap.find(i);
62  if ( resMarker != ioNodeEnrMarkerMap.end() ) {
63  alreadyEnr = true;
64  }
65 
66 #if defined ( ENABLE_XFEM_CPP11 )
67  auto begin = newEnrNodes.begin();
68  auto end = newEnrNodes.end();
69 #else
70  std :: vector< int > :: const_iterator begin = newEnrNodes.begin();
71  std :: vector< int > :: const_iterator end = newEnrNodes.end();
72 #endif
73  if ( std :: binary_search(begin, end, i) ) {
74  alreadyEnr = true;
75  }
76 
77 
78  if ( !alreadyEnr ) {
79  bool goOn = true;
80 
81  // Loop over neighbors
82  const IntArray &neigh = * ( d.giveConnectivityTable()->giveDofManConnectivityArray(i) );
83  for ( int j = 1; j <= neigh.giveSize(); j++ ) {
84  if ( !goOn ) {
85  break;
86  }
87 
88  Element &el = * ( d.giveElement( neigh.at(j) ) );
89 
90  // Loop over neighbor element nodes
91  for ( int k = 1; k <= el.giveNumberOfDofManagers(); k++ ) {
92  int kGlob = el.giveDofManager(k)->giveGlobalNumber();
93  auto res = iLevelSetNormalDirMap.find(kGlob);
94  if ( res != iLevelSetNormalDirMap.end() && res->second < 0.0 ) {
95  newEnrNodes.push_back(i);
96  goOn = false;
97  break;
98  }
99  }
100  }
101  }
102  }
103 
104 
105  // Mark the new nodes to be enriched
106  for ( int i = 0; i < int ( newEnrNodes.size() ); i++ ) {
107  ioNodeEnrMarkerMap [ newEnrNodes [ i ] ] = NodeEnr_BULK;
108  }
109 }
110 
112 {
113  int number = 1;
114  input.setRecordKeywordField(this->giveInputRecordName(), number);
115 }
116 } // end namespace oofem
Class and object Domain.
Definition: domain.h:115
int giveGlobalNumber() const
Definition: dofmanager.h:501
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
Definition: domain.h:432
TipInfo gathers useful information about a crack tip, like its position and tangent direction...
Definition: tipinfo.h:24
ConnectivityTable * giveConnectivityTable()
Returns receiver&#39;s associated connectivity table.
Definition: domain.C:1170
virtual const char * giveInputRecordName() const
Abstract base class for all finite elements.
Definition: element.h:145
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
virtual int giveNumberOfDofManagers() const
Definition: element.h:656
Element * giveElement(int n)
Service for accessing particular domain fe element.
Definition: domain.C:160
NodeEnrichmentType
const IntArray * giveDofManConnectivityArray(int dofman)
This class manages the xfem part.
Definition: xfemmanager.h:109
Class representing the a dynamic Input Record.
void setRecordKeywordField(std::string keyword, int number)
REGISTER_EnrichmentFront(EnrFrontCohesiveBranchFuncOneEl)
int giveSize() const
Definition: intarray.h:203
the oofem namespace is to define a context or scope in which all oofem names are defined.
DofManager * giveDofManager(int i) const
Definition: element.C:514
virtual void giveInputRecord(DynamicInputRecord &input)

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:28 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011