OOFEM 3.0
Loading...
Searching...
No Matches
exportregion.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 "exportregion.h"
36#include "element.h"
37#include "gausspoint.h"
38#include "timestep.h"
39#include "engngm.h"
40#include "node.h"
41#include "dof.h"
42#include "materialinterface.h"
43#include "mathfem.h"
44#include "cltypes.h"
45#include "material.h"
46#include "classfactory.h"
47#include "crosssection.h"
49
50#include <string>
51#include <sstream>
52#include <ctime>
53
54namespace oofem {
55
56void
58{
59 this->numNodes = numNodes;
60 this->nodeCoords.resize(numNodes);
61}
62
63void
65{
66 this->numCells = numCells;
67 this->connectivity.resize(numCells);
68 this->elCellTypes.resize(numCells);
69 this->elOffsets.resize(numCells);
70}
71
72void
74{
75 this->connectivity [ cellNum - 1 ] = nodes;
76}
77
78void
79ExportRegion::setNodeCoords(int nodeNum, const FloatArray &coords)
80{
81 this->nodeCoords [ nodeNum - 1 ] = coords;
82}
83
84void
86{
87 for (int it=1; it<= primVars.giveSize(); it++) {
88 UnknownType type = (UnknownType) primVars.at(it);
89 this->nodeVars [type].resize(numNodes);
90 }
91}
92
93void
95{
96 this->nodeLoads.resize(numVars);
97 for ( int i = 1; i <= numVars; i++ ) {
98 this->nodeLoads [ i - 1 ].resize(numNodes);
99 }
100}
101
102void
104{
105 for ( int i = 1; i <= ists.giveSize(); i++ ) {
106 InternalStateType itype = (InternalStateType) ists.at(i);
107 this->nodeVarsFromIS [ itype ].resize(numNodes);
108 }
109}
110
111void
112ExportRegion::setNumberOfInternalXFEMVarsToExport(int numVars, int numEnrichmentItems, int numNodes)
113{
114 this->nodeVarsFromXFEMIS.resize(numVars);
115 for ( int i = 1; i <= numVars; i++ ) {
116 this->nodeVarsFromXFEMIS [ i - 1 ].resize(numEnrichmentItems);
117 for ( int j = 1; j <= numEnrichmentItems; j++ ) {
118 this->nodeVarsFromXFEMIS [ i - 1 ] [ j - 1 ].resize(numNodes);
119 }
120 }
121}
122
123void
125{
126 for ( int i = 1; i <= cellVars.giveSize(); i++ ) {
128 this->cellVars [ type ].resize(numCells);
129 }
130}
131
132void
134{
135 this->nodeVars [ type ] [ nodeNum - 1 ] = std::move(valueArray);
136}
137
138void
139ExportRegion::setLoadInNode(int varNum, int nodeNum, FloatArray valueArray)
140{
141 this->nodeLoads [ varNum - 1 ] [ nodeNum - 1 ] = std::move(valueArray);
142}
143
144void
146{
147 this->nodeVarsFromIS [ type ] [ nodeNum - 1 ] = std::move(valueArray);
148}
149
150void
151ExportRegion::setInternalXFEMVarInNode(int varNum, int eiNum, int nodeNum, FloatArray valueArray)
152{
153 this->nodeVarsFromXFEMIS [ varNum - 1 ] [ eiNum - 1 ] [ nodeNum - 1 ] = std::move(valueArray);
154}
155
156
157void
159{
160 this->cellVars [ type ] [ cellNum - 1 ] = std::move(valueArray);
161}
162
163void
165{
167 numCells = 0;
168 numNodes = 0;
169 this->connectivity.clear();
170 this->elCellTypes.clear();
171 this->elOffsets.clear();
172 this->cellVars.clear();
173 this->nodeCoords.clear();
174 this->nodeVars.clear();
175 this->nodeVarsFromIS.clear();
176 this->nodeVarsFromXFEMIS.clear();
177}
178
179
182 FloatMatrix result(this->numNodes,3);
183 for (int i=0; i<this->numNodes; i++) {
184 FloatArray &c = this->giveNodeCoords(i+1);
185 for (int j=0; j<c.giveSize(); j++) {
186 result(i,j)=c[j];
187 }
188 for (int j=c.giveSize(); j<3; j++) {
189 result(i,j) = 0.0;
190 }
191 }
192 return result;
193}
194
195
198 int reqSize = 0;
199 for (int i=0; i<this->numCells; i++) {
200 reqSize++;
201 reqSize+=this->giveCellConnectivity(i+1).giveSize();
202 }
203 IntArray result(reqSize);
204 int pos=0;
205 for (int i=0; i<this->numCells; i++) {
206 IntArray &c = this->giveCellConnectivity(i+1);
207 int csize = c.giveSize();
208 result[pos++]=csize;
209 for (int i = 0; i<csize; i++) {
210 result[pos++]=c[i]-1;
211 }
212 }
213 return result;
214}
215
218 IntArray result(this->numCells);
219 for (int i=0; i<this->numCells; i++) {
220 result[i]=this->giveCellType(i+1); // m.giveCellType(this->regionElInd.at(i+1));
221 }
222 return result;
223}
224
225
226
229 if (this->nodeVars.find(u) != this->nodeVars.end()) {
230 // key exists
231 std::vector<FloatArray>& nodalVars = this->nodeVars[u];
232 // get size of nodal record
233 int recSize = nodalVars[0].giveSize();
234 FloatMatrix result(this->numNodes,recSize);
235 for (int i=0;i<this->numNodes; i++) {
236 FloatArray& v = nodalVars[i];
237 for (int j=0; j<recSize; j++) {
238 result(i,j)=v[j];
239 }
240 }
241 return result;
242 } else {
243 return FloatMatrix(0,0);
244 }
245}
246
249 if (this->nodeVarsFromIS.find(u)!=this->nodeVarsFromIS.end()) {
250 // key exists
251 std::vector<FloatArray>& nodalVars = this->nodeVarsFromIS[u];
252 // get size of nodal record
253 int recSize = nodalVars[0].giveSize();
254 FloatMatrix result(this->numNodes,recSize);
255 for (int i=0;i<this->numNodes; i++) {
256 FloatArray& v = nodalVars[i];
257 for (int j=0; j<recSize; j++) {
258 result(i,j)=v[j];
259 }
260 }
261 return result;
262 } else {
263 return FloatMatrix(0,0);
264 }
265}
266
269 if (this->cellVars.find(u)!=this->cellVars.end()) {
270 // key exists
271 std::vector<FloatArray>& cv = this->cellVars[u];
272 // get size of nodal record
273 int recSize = cv[0].giveSize();
274 FloatMatrix result(this->numCells,recSize);
275 for (int i=0;i<this->numCells; i++) {
276 FloatArray& v = cv[i];
277 for (int j=0; j<recSize; j++) {
278 result(i,j)=v[j];
279 }
280 }
281 return result;
282 } else {
283 return FloatMatrix(0,0);
284 }
285}
286
287
288} // end namespace oofem
void setCellVar(InternalStateType type, int cellNum, FloatArray valueArray)
void setInternalVarInNode(InternalStateType type, int nodeNum, FloatArray valueArray)
void setInternalXFEMVarInNode(int varNum, int eiNum, int nodeNum, FloatArray valueArray)
void setNumberOfLoadsToExport(int numVars, int numNodes)
std::vector< std::vector< FloatArray > > nodeLoads
std::map< UnknownType, std::vector< FloatArray > > nodeVars
IntArray getCellTypes()
FloatMatrix getCellValues(InternalStateType u)
void setNumberOfCellVarsToExport(const IntArray &cellVars, int numCells)
FloatMatrix getPrimaryVertexValues(UnknownType u)
std::vector< FloatArray > nodeCoords
void setNumberOfInternalVarsToExport(const IntArray &ists, int numNodes)
std::map< InternalStateType, std::vector< FloatArray > > cellVars
void setNumberOfInternalXFEMVarsToExport(int numVars, int numEnrichmentItems, int numNodes)
void setLoadInNode(int varNum, int nodeNum, FloatArray valueArray)
FloatArray & giveNodeCoords(int nodeNum)
void setNumberOfPrimaryVarsToExport(const IntArray &primVars, int numNodes)
void setConnectivity(int cellNum, IntArray &nodes)
void setPrimaryVarInNode(UnknownType type, int nodeNum, FloatArray valueArray)
IntArray getCellConnectivity()
IntArray & giveCellConnectivity(int cellNum)
void setNumberOfCells(int numCells)
int giveCellType(int cellNum)
std::vector< std::vector< std::vector< FloatArray > > > nodeVarsFromXFEMIS
std::map< InternalStateType, std::vector< FloatArray > > nodeVarsFromIS
FloatMatrix getVertices()
std::vector< IntArray > connectivity
FloatMatrix getInternalVertexValues(InternalStateType u)
void setNodeCoords(int nodeNum, const FloatArray &coords)
void setNumberOfNodes(int numNodes)
Index giveSize() const
Returns the size of receiver.
Definition floatarray.h:261
void resize(int n)
Definition intarray.C:73
int & at(std::size_t i)
Definition intarray.h:104
int giveSize() const
Definition intarray.h:211

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