OOFEM 3.0
Loading...
Searching...
No Matches
qtrplanestrain.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
36#include "fei2dtrquad.h"
37#include "floatmatrix.h"
38#include "floatarray.h"
39#include "intarray.h"
40#include "classfactory.h"
41
42#ifdef __OOFEG
43 #include "oofeggraphiccontext.h"
44 #include "connectivitytable.h"
45 #include "oofegutils.h"
46 #include "sm/Materials/rcm2.h"
47#endif
48
49
50namespace oofem {
52
53FEI2dTrQuad QTrPlaneStrain :: interpolation(1, 2);
54
55QTrPlaneStrain :: QTrPlaneStrain(int n, Domain *aDomain) :
57{
60}
61
62
64QTrPlaneStrain :: giveInterpolation() const { return & interpolation; }
65
67QTrPlaneStrain :: giveInterface(InterfaceType interface)
68{
69 //if (interface == NodalAveragingRecoveryModelInterfaceType) return (NodalAveragingRecoveryModelInterface*) this;
70 if ( interface == ZZNodalRecoveryModelInterfaceType ) {
71 return static_cast< ZZNodalRecoveryModelInterface * >(this);
72 } else if ( interface == SPRNodalRecoveryModelInterfaceType ) {
73 return static_cast< SPRNodalRecoveryModelInterface * >(this);
74 } else if ( interface == SpatialLocalizerInterfaceType ) {
75 return static_cast< SpatialLocalizerInterface * >(this);
76 }
77
78 return NULL;
79}
80
81#ifdef __OOFEG
82 #define TR_LENGHT_REDUCT 0.3333
83
84void QTrPlaneStrain :: drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
85{
86 WCRec p [ 3 ];
87 GraphicObj *go;
88
89 if ( !gc.testElementGraphicActivity(this) ) {
90 return;
91 }
92
93 EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
94 EASValsSetColor( gc.getElementColor() );
95 EASValsSetEdgeColor( gc.getElementEdgeColor() );
96 EASValsSetEdgeFlag(true);
97 EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
98 p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
99 p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
100 p [ 0 ].z = 0.;
101 p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(1);
102 p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(2);
103 p [ 1 ].z = 0.;
104 p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1);
105 p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2);
106 p [ 2 ].z = 0.;
107
108 go = CreateTriangle3D(p);
109 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
110 EGAttachObject(go, ( EObjectP ) this);
111 EMAddGraphicsToModel(ESIModel(), go);
112}
113
114
115void QTrPlaneStrain :: drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType type)
116{
117 WCRec p [ 3 ];
118 GraphicObj *go;
119 double defScale = gc.getDefScale();
120
121 if ( !gc.testElementGraphicActivity(this) ) {
122 return;
123 }
124
125 EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
126 EASValsSetColor( gc.getDeformedElementColor() );
127 EASValsSetEdgeColor( gc.getElementEdgeColor() );
128 EASValsSetEdgeFlag(true);
129 EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER);
130 p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale);
131 p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale);
132 p [ 0 ].z = 0.;
133 p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale);
134 p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale);
135 p [ 1 ].z = 0.;
136 p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(1, tStep, defScale);
137 p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(2, tStep, defScale);
138 p [ 2 ].z = 0.;
139
140 go = CreateTriangle3D(p);
141 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
142 EMAddGraphicsToModel(ESIModel(), go);
143}
144
145
146void QTrPlaneStrain :: drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
147{
148 int t, n [ 3 ], i, indx, result = 0;
149 WCRec p [ 3 ];
150 GraphicObj *tr;
151 FloatArray v [ 6 ];
152 double s [ 6 ], ss [ 3 ], defScale;
153
154 if ( !gc.testElementGraphicActivity(this) ) {
155 return;
156 }
157
158 if ( gc.giveIntVarMode() == ISM_recovered ) {
159 for ( i = 1; i <= 6; i++ ) {
160 result += this->giveInternalStateAtNode(v [ i - 1 ], gc.giveIntVarType(), gc.giveIntVarMode(), i, tStep);
161 }
162 } else if ( gc.giveIntVarMode() == ISM_local ) {
163 return;
164 }
165
166 if ( result != 6 ) {
167 return;
168 }
169
170 indx = gc.giveIntVarIndx();
171
172 for ( i = 1; i <= 6; i++ ) {
173 s [ i - 1 ] = v [ i - 1 ].at(indx);
174 }
175
176 EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
177
178 if ( gc.getScalarAlgo() == SA_ISO_SURF ) {
179 for ( t = 1; t <= 4; t++ ) {
180 if ( t == 1 ) {
181 n [ 0 ] = 1;
182 n [ 1 ] = 4;
183 n [ 2 ] = 6;
184 } else if ( t == 2 ) {
185 n [ 0 ] = 2;
186 n [ 1 ] = 5;
187 n [ 2 ] = 4;
188 } else if ( t == 3 ) {
189 n [ 0 ] = 3;
190 n [ 1 ] = 6;
191 n [ 2 ] = 5;
192 } else {
193 n [ 0 ] = 4;
194 n [ 1 ] = 5;
195 n [ 2 ] = 6;
196 }
197
198
199 for ( i = 0; i < 3; i++ ) {
200 if ( gc.getInternalVarsDefGeoFlag() ) {
201 // use deformed geometry
202 defScale = gc.getDefScale();
203 p [ i ].x = ( FPNum ) this->giveNode(n [ i ])->giveUpdatedCoordinate(1, tStep, defScale);
204 p [ i ].y = ( FPNum ) this->giveNode(n [ i ])->giveUpdatedCoordinate(2, tStep, defScale);
205 p [ i ].z = 0.;
206 } else {
207 p [ i ].x = ( FPNum ) this->giveNode(n [ i ])->giveCoordinate(1);
208 p [ i ].y = ( FPNum ) this->giveNode(n [ i ])->giveCoordinate(2);
209 p [ i ].z = 0.;
210 }
211 }
212
213 //EASValsSetColor(gc.getYieldPlotColor(ratio));
214 ss [ 0 ] = s [ n [ 0 ] - 1 ];
215 ss [ 1 ] = s [ n [ 1 ] - 1 ];
216 ss [ 2 ] = s [ n [ 2 ] - 1 ];
217 gc.updateFringeTableMinMax(ss, 3);
218 tr = CreateTriangleWD3D(p, ss [ 0 ], ss [ 1 ], ss [ 2 ]);
219 EGWithMaskChangeAttributes(LAYER_MASK, tr);
220 EMAddGraphicsToModel(ESIModel(), tr);
221 }
222
223 /* } else if (gc.getScalarAlgo() == SA_ISO_LINE) {
224 *
225 * EASValsSetColor(context.getActiveCrackColor());
226 * EASValsSetLineWidth(OOFEG_ISO_LINE_WIDTH);
227 *
228 * for (t=1; t<=4; t++) {
229 * if (t==1) {n[0] = 1; n[1]=4; n[2]=6;}
230 * else if (t==2) {n[0]=2; n[1]=5; n[2]=4;}
231 * else if (t==3) {n[0]=3; n[1]=6; n[2]=5;}
232 * else {n[0]=4; n[1]=5; n[2]=6;}
233 *
234 *
235 * for (i=0; i< 3; i++) {
236 * if (gc.getInternalVarsDefGeoFlag()) {
237 * // use deformed geometry
238 * defScale = gc.getDefScale();
239 * p[i].x = (FPNum) this->giveNode(n[i])->giveUpdatedCoordinate(1,tStep,defScale);
240 * p[i].y = (FPNum) this->giveNode(n[i])->giveUpdatedCoordinate(2,tStep,defScale);
241 * p[i].z = 0.;
242 *
243 * } else {
244 * p[i].x = (FPNum) this->giveNode(n[i])->giveCoordinate(1);
245 * p[i].y = (FPNum) this->giveNode(n[i])->giveCoordinate(2);
246 * p[i].z = 0.;
247 * }
248 * }
249 * sv[0]=s[n[0]-1];
250 * sv[1]=s[n[1]-1];
251 * sv[2]=s[n[2]-1];
252 *
253 * // isoline implementation
254 * oofeg_drawIsoLinesOnTriangle (p, sv);
255 * } */
256 }
257}
258
259void
260QTrPlaneStrain :: drawSpecial(oofegGraphicContext &gc, TimeStep *tStep)
261{ }
262
263#endif
264
265
266void
267QTrPlaneStrain :: SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap)
268{
269 pap.resize(3);
270 pap.at(1) = this->giveNode(1)->giveNumber();
271 pap.at(2) = this->giveNode(2)->giveNumber();
272 pap.at(3) = this->giveNode(3)->giveNumber();
273}
274
275void
276QTrPlaneStrain :: SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
277{
278 answer.resize(3);
279 if ( pap == this->giveNode(1)->giveNumber() ) {
280 answer.at(1) = pap;
281 answer.at(2) = this->giveNode(4)->giveNumber();
282 answer.at(3) = this->giveNode(6)->giveNumber();
283 } else if ( pap == this->giveNode(2)->giveNumber() ) {
284 answer.at(1) = pap;
285 answer.at(2) = this->giveNode(5)->giveNumber();
286 answer.at(3) = this->giveNode(4)->giveNumber();
287 } else if ( pap == this->giveNode(3)->giveNumber() ) {
288 answer.at(1) = pap;
289 answer.at(2) = this->giveNode(6)->giveNumber();
290 answer.at(3) = this->giveNode(5)->giveNumber();
291 } else {
292 OOFEM_ERROR("node unknown");
293 }
294}
295
296int
297QTrPlaneStrain :: SPRNodalRecoveryMI_giveNumberOfIP()
298{
299 return numberOfGaussPoints;
300}
301
302
304QTrPlaneStrain :: SPRNodalRecoveryMI_givePatchType()
305{
307}
308
309} // end namespace oofem
#define REGISTER_Element(class)
Node * giveNode(int i) const
Definition element.h:629
int numberOfDofMans
Number of dofmanagers.
Definition element.h:136
int numberOfGaussPoints
Definition element.h:175
int giveNumber() const
Definition femcmpnn.h:104
double & at(Index i)
Definition floatarray.h:202
void resize(int n)
Definition intarray.C:73
int & at(std::size_t i)
Definition intarray.h:104
PlaneStrainElement(int n, Domain *d)
static FEI2dTrQuad interpolation
SpatialLocalizerInterface(Element *element)
int giveInternalStateAtNode(FloatArray &answer, InternalStateType type, InternalStateMode mode, int node, TimeStep *tStep) override
ZZNodalRecoveryModelInterface(Element *element)
Constructor.
#define OOFEM_ERROR(...)
Definition error.h:79
@ SPRNodalRecoveryModelInterfaceType
@ ZZNodalRecoveryModelInterfaceType
@ SpatialLocalizerInterfaceType
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
#define OOFEG_VARPLOT_PATTERN_LAYER
#define OOFEG_DEFORMED_GEOMETRY_LAYER
#define OOFEG_DEFORMED_GEOMETRY_WIDTH
#define OOFEG_RAW_GEOMETRY_WIDTH
#define OOFEG_RAW_GEOMETRY_LAYER

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