OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
nodalrecoverymodel.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 "nodalrecoverymodel.h"
36 #include "domain.h"
37 #include "element.h"
38 #include "dofmanager.h"
39 
40 #ifdef __PARALLEL_MODE
41  #include "problemcomm.h"
42 #endif
43 
44 
45 namespace oofem {
47 {
48  stateCounter = 0;
49  domain = d;
50  this->valType = IST_Undefined;
51 
52 #ifdef __PARALLEL_MODE
53  communicator = NULL;
54  commBuff = NULL;
55  initCommMap = true;
56 #endif
57 }
58 
59 
61 {
62 #ifdef __PARALLEL_MODE
63  delete communicator;
64  delete commBuff;
65 #endif
66 }
67 
68 
69 int
71 {
72  this->nodalValList.clear();
73  return 1;
74 }
75 
76 int
78 {
79  std :: map< int, FloatArray > :: iterator it = this->nodalValList.find(node);
80  if ( it != this->nodalValList.end() ) {
81  answer = & it->second;
82  if ( answer->giveSize() ) {
83  return 1;
84  }
85  } else {
86  answer = NULL;
87  }
88 
89  return 0;
90 }
91 
92 int
94  int regionValSize, const FloatArray &rhs)
95 {
96  int nnodes = domain->giveNumberOfDofManagers();
97 
98  // update recovered values
99  for ( int node = 1; node <= nnodes; node++ ) {
100  // find nodes in region
101  if ( regionNodalNumbers.at(node) ) {
102  FloatArray &nodalVal = this->nodalValList [ node ];
103  nodalVal.resize(regionValSize);
104  for ( int i = 1; i <= regionValSize; i++ ) {
105  nodalVal.at(i) = rhs.at( ( regionNodalNumbers.at(node) - 1 ) * regionValSize + i );
106  }
107  }
108  } // end update recovered values
109 
110  return 1;
111 }
112 
113 int
114 NodalRecoveryModel :: initRegionNodeNumbering(IntArray &regionNodalNumbers, int &regionDofMans, Set &region)
115 {
116  int nnodes = domain->giveNumberOfDofManagers();
117  IntArray elementRegion = region.giveElementList();
118 
119  regionNodalNumbers.resize(nnodes);
120  regionNodalNumbers.zero();
121  regionDofMans = 0;
122 
123  for ( int i = 1; i <= elementRegion.giveSize(); i++ ) {
124  int ielem = elementRegion.at(i);
125  Element *element = domain->giveElement(ielem);
126 
127  int elemNodes = element->giveNumberOfDofManagers();
128 
129  // determine local region node numbering
130  for ( int elementNode = 1; elementNode <= elemNodes; elementNode++ ) {
131  int node = element->giveDofManager(elementNode)->giveNumber();
132  if ( regionNodalNumbers.at(node) == 0 ) { // assign new number
133  regionNodalNumbers.at(node) = ++regionDofMans;
134  }
135  }
136  }
137 
138  return 1;
139 }
140 
141 int
143 {
144  if ( this->nodalValList.begin() != this->nodalValList.end() ) {
145  // the container is not empty
146  return this->nodalValList.begin()->second.giveSize();
147  } else {
148  OOFEM_WARNING("data not yet initialized");
149  return 0;
150  }
151 }
152 } // end namespace oofem
Class and object Domain.
Definition: domain.h:115
int initRegionNodeNumbering(IntArray &regionNodalNumbers, int &regionDofMans, Set &region)
Determine local region node numbering and determine and check nodal values size.
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
Definition: domain.h:432
void zero()
Sets all component to zero.
Definition: intarray.C:52
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
Abstract base class for all finite elements.
Definition: element.h:145
int updateRegionRecoveredValues(const IntArray &regionNodalNumbers, int regionValSize, const FloatArray &rhs)
Update the nodal table according to recovered solution for given region.
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
int giveNodalVector(const FloatArray *&ptr, int node)
Returns vector of recovered values for given node and region.
Set of elements, boundaries, edges and/or nodes.
Definition: set.h:66
CommunicatorBuff * commBuff
Common Communicator buffer.
virtual ~NodalRecoveryModel()
Destructor.
void resize(int n)
Checks size of receiver towards requested bounds.
Definition: intarray.C:124
ProblemCommunicator * communicator
Communicator.
StateCounterType stateCounter
Time stamp of recovered values.
virtual int clear()
Clears the receiver&#39;s nodal table.
Class representing vector of real numbers.
Definition: floatarray.h:82
std::map< int, FloatArray > nodalValList
Map of nodal values.
int giveSize() const
Definition: intarray.h:203
int giveSize() const
Returns the size of receiver.
Definition: floatarray.h:218
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
bool initCommMap
Communication init flag.
int giveNumber() const
Definition: femcmpnn.h:107
NodalRecoveryModel(Domain *d)
Constructor.
virtual int giveRegionRecordSize()
Returns the region record size.
#define OOFEM_WARNING(...)
Definition: error.h:62
InternalStateType valType
Determines the type of recovered values.
const IntArray & giveElementList()
Returns list of elements within set.
Definition: set.C:138
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:30 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011