OOFEM 3.0
Loading...
Searching...
No Matches
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 - 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 "nodalrecoverymodel.h"
36#include "domain.h"
37#include "element.h"
38#include "dofmanager.h"
39
40#ifdef __MPI_PARALLEL_MODE
41 #include "problemcomm.h"
42#endif
43
44
45namespace oofem {
46NodalRecoveryModel :: NodalRecoveryModel(Domain *d) : nodalValList()
47{
48 stateCounter = 0;
49 domain = d;
50 this->valType = IST_Undefined;
51
52#ifdef __MPI_PARALLEL_MODE
53 communicator = NULL;
54 commBuff = NULL;
55 initCommMap = true;
56#endif
57}
58
59
60NodalRecoveryModel :: ~NodalRecoveryModel()
61{
62#ifdef __MPI_PARALLEL_MODE
63 delete communicator;
64 delete commBuff;
65#endif
66}
67
68
69int
70NodalRecoveryModel :: clear()
71{
72 this->nodalValList.clear();
73 return 1;
74}
75
76int
77NodalRecoveryModel :: giveNodalVector(const FloatArray * &answer, int node)
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
92int
93NodalRecoveryModel :: updateRegionRecoveredValues(const IntArray &regionNodalNumbers,
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
113int
114NodalRecoveryModel :: 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
141int
142NodalRecoveryModel :: giveRegionRecordSize()
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
virtual int giveNumberOfDofManagers() const
Definition element.h:695
DofManager * giveDofManager(int i) const
Definition element.C:553
int giveNumber() const
Definition femcmpnn.h:104
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 resize(int n)
Definition intarray.C:73
void zero()
Sets all component to zero.
Definition intarray.C:52
int & at(std::size_t i)
Definition intarray.h:104
int giveSize() const
Definition intarray.h:211
bool initCommMap
Communication init flag.
CommunicatorBuff * commBuff
Common Communicator buffer.
StateCounterType stateCounter
Time stamp of recovered values.
InternalStateType valType
Determines the type of recovered values.
ProblemCommunicator * communicator
Communicator.
std ::map< int, FloatArray > nodalValList
const IntArray & giveElementList()
Definition set.C:158
#define OOFEM_WARNING(...)
Definition error.h:80

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