OOFEM 3.0
Loading...
Searching...
No Matches
qtrplstr.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 "node.h"
38#include "gausspoint.h"
39#include "floatmatrix.h"
40#include "floatarray.h"
41#include "intarray.h"
42#include "crosssection.h"
44#include "mathfem.h"
45#include "classfactory.h"
46
47#ifdef __OOFEG
48 #include "oofeggraphiccontext.h"
49 #include "oofegutils.h"
50 #include "sm/Materials/rcm2.h"
51#endif
52
53namespace oofem {
55
56FEI2dTrQuad QTrPlaneStress2d :: interpolation(1, 2);
57
58QTrPlaneStress2d :: QTrPlaneStress2d(int n, Domain *aDomain) :
60{
63}
64
65
66FEInterpolation *QTrPlaneStress2d :: giveInterpolation() const { return & interpolation; }
67
68
70QTrPlaneStress2d :: giveInterface(InterfaceType interface)
71{
72 /*
73 * Note ZZNodalRecoveryModelInterface disabled, as the
74 * sum of row entries is zero for (N^T)N matrix for vertices,
75 * yielding zero entries in lumped form.
76 *
77 * if ( interface == ZZNodalRecoveryModelInterfaceType ) {
78 * return static_cast< ZZNodalRecoveryModelInterface * >( this );
79 */
80 if ( interface == SPRNodalRecoveryModelInterfaceType ) {
81 return static_cast< SPRNodalRecoveryModelInterface * >(this);
82 } else if ( interface == SpatialLocalizerInterfaceType ) {
83 return static_cast< SpatialLocalizerInterface * >(this);
84 }
85
86 return NULL;
87}
88
89
90#ifdef __OOFEG
91 #define TR_LENGHT_REDUCT 0.3333
92
93void QTrPlaneStress2d :: drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
94{
95 WCRec p [ 3 ];
96 GraphicObj *go;
97
98 if ( !gc.testElementGraphicActivity(this) ) {
99 return;
100 }
101
102 EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
103 EASValsSetColor( gc.getElementColor() );
104 EASValsSetEdgeColor( gc.getElementEdgeColor() );
105 EASValsSetEdgeFlag(true);
106 EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
107 p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
108 p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
109 p [ 0 ].z = 0.;
110 p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(1);
111 p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(2);
112 p [ 1 ].z = 0.;
113 p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1);
114 p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2);
115 p [ 2 ].z = 0.;
116
117 go = CreateTriangle3D(p);
118 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
119 EGAttachObject(go, ( EObjectP ) this);
120 EMAddGraphicsToModel(ESIModel(), go);
121}
122
123
124void QTrPlaneStress2d :: drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType type)
125{
126 WCRec p [ 3 ];
127 GraphicObj *go;
128 double defScale = gc.getDefScale();
129
130 if ( !gc.testElementGraphicActivity(this) ) {
131 return;
132 }
133
134 EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
135 EASValsSetColor( gc.getDeformedElementColor() );
136 EASValsSetEdgeColor( gc.getElementEdgeColor() );
137 EASValsSetEdgeFlag(true);
138 EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER);
139 p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale);
140 p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale);
141 p [ 0 ].z = 0.;
142 p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale);
143 p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale);
144 p [ 1 ].z = 0.;
145 p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(1, tStep, defScale);
146 p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(2, tStep, defScale);
147 p [ 2 ].z = 0.;
148
149 go = CreateTriangle3D(p);
150 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
151 EMAddGraphicsToModel(ESIModel(), go);
152}
153
154
155void QTrPlaneStress2d :: drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
156{
157 int t, n [ 3 ], i, indx, result = 0;
158 WCRec p [ 3 ];
159 GraphicObj *tr;
160 FloatArray v [ 6 ];
161 double s [ 6 ], ss [ 3 ], defScale;
162
163 if ( !gc.testElementGraphicActivity(this) ) {
164 return;
165 }
166
167 if ( gc.giveIntVarMode() == ISM_recovered ) {
168 // ========= plot recovered values =========
169 for ( i = 1; i <= 6; i++ ) {
170 result += this->giveInternalStateAtNode(v [ i - 1 ], gc.giveIntVarType(), gc.giveIntVarMode(), i, tStep);
171 }
172
173 if ( result != 6 ) {
174 return;
175 }
176
177 indx = gc.giveIntVarIndx();
178
179 for ( i = 1; i <= 6; i++ ) {
180 s [ i - 1 ] = v [ i - 1 ].at(indx);
181 }
182
183 EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
184
185 if ( gc.getScalarAlgo() == SA_ISO_SURF ) {
186 for ( t = 1; t <= 4; t++ ) {
187 if ( t == 1 ) {
188 n [ 0 ] = 1;
189 n [ 1 ] = 4;
190 n [ 2 ] = 6;
191 } else if ( t == 2 ) {
192 n [ 0 ] = 2;
193 n [ 1 ] = 5;
194 n [ 2 ] = 4;
195 } else if ( t == 3 ) {
196 n [ 0 ] = 3;
197 n [ 1 ] = 6;
198 n [ 2 ] = 5;
199 } else {
200 n [ 0 ] = 4;
201 n [ 1 ] = 5;
202 n [ 2 ] = 6;
203 }
204
205
206 for ( i = 0; i < 3; i++ ) {
207 if ( gc.getInternalVarsDefGeoFlag() ) {
208 // use deformed geometry
209 defScale = gc.getDefScale();
210 p [ i ].x = ( FPNum ) this->giveNode(n [ i ])->giveUpdatedCoordinate(1, tStep, defScale);
211 p [ i ].y = ( FPNum ) this->giveNode(n [ i ])->giveUpdatedCoordinate(2, tStep, defScale);
212 p [ i ].z = 0.;
213 } else {
214 // use initial geometry
215 p [ i ].x = ( FPNum ) this->giveNode(n [ i ])->giveCoordinate(1);
216 p [ i ].y = ( FPNum ) this->giveNode(n [ i ])->giveCoordinate(2);
217 p [ i ].z = 0.;
218 }
219 }
220
221 //EASValsSetColor(gc.getYieldPlotColor(ratio));
222 ss [ 0 ] = s [ n [ 0 ] - 1 ];
223 ss [ 1 ] = s [ n [ 1 ] - 1 ];
224 ss [ 2 ] = s [ n [ 2 ] - 1 ];
225 gc.updateFringeTableMinMax(ss, 3);
226 tr = CreateTriangleWD3D(p, ss [ 0 ], ss [ 1 ], ss [ 2 ]);
227 EGWithMaskChangeAttributes(LAYER_MASK, tr);
228 EMAddGraphicsToModel(ESIModel(), tr);
229 }
230
231 /* } else if (gc.getScalarAlgo() == SA_ISO_LINE) {
232 *
233 * EASValsSetColor(context.getActiveCrackColor());
234 * EASValsSetLineWidth(OOFEG_ISO_LINE_WIDTH);
235 *
236 * for (t=1; t<=4; t++) {
237 * if (t==1) {n[0] = 1; n[1]=4; n[2]=6;}
238 * else if (t==2) {n[0]=2; n[1]=5; n[2]=4;}
239 * else if (t==3) {n[0]=3; n[1]=6; n[2]=5;}
240 * else {n[0]=4; n[1]=5; n[2]=6;}
241 *
242 *
243 * for (i=0; i< 3; i++) {
244 * if (gc.getInternalVarsDefGeoFlag()) {
245 * // use deformed geometry
246 * defScale = gc.getDefScale();
247 * p[i].x = (FPNum) this->giveNode(n[i])->giveUpdatedCoordinate(1,tStep,defScale);
248 * p[i].y = (FPNum) this->giveNode(n[i])->giveUpdatedCoordinate(2,tStep,defScale);
249 * p[i].z = 0.;
250 *
251 * } else {
252 * p[i].x = (FPNum) this->giveNode(n[i])->giveCoordinate(1);
253 * p[i].y = (FPNum) this->giveNode(n[i])->giveCoordinate(2);
254 * p[i].z = 0.;
255 * }
256 * }
257 * sv[0]=s[n[0]-1];
258 * sv[1]=s[n[1]-1];
259 * sv[2]=s[n[2]-1];
260 *
261 * // isoline implementation
262 * oofeg_drawIsoLinesOnTriangle (p, sv);
263 * } */
264 }
265 } else if ( gc.giveIntVarMode() == ISM_local ) {
266 // ========= plot local values =========
267 // (so far implemented for 4 Gauss points only)
268 if ( numberOfGaussPoints != 4 ) {
269 return;
270 }
271
272 IntArray ind(3);
273 WCRec pp [ 6 ];
274
275 for ( i = 0; i < 6; i++ ) {
276 if ( gc.getInternalVarsDefGeoFlag() ) {
277 // use deformed geometry
278 defScale = gc.getDefScale();
279 pp [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
280 pp [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
281 pp [ i ].z = 0.;
282 } else {
283 // use initial geometry
284 pp [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
285 pp [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
286 pp [ i ].z = 0.;
287 }
288 }
289
290 for ( GaussPoint *gp: *integrationRulesArray [ 0 ] ) {
291 //gpCoords = gp->giveNaturalCoordinates();
292 switch ( gp->giveNumber() ) {
293 case 3:
294 ind.at(1) = 0;
295 ind.at(2) = 3;
296 ind.at(3) = 5;
297 break;
298 case 4:
299 ind.at(1) = 1;
300 ind.at(2) = 4;
301 ind.at(3) = 3;
302 break;
303 case 2:
304 ind.at(1) = 2;
305 ind.at(2) = 5;
306 ind.at(3) = 4;
307 break;
308 case 5:
309 default:
310 ind.at(1) = 3;
311 ind.at(2) = 4;
312 ind.at(3) = 5;
313 }
314
315 if ( giveIPValue(v [ 0 ], gp, gc.giveIntVarType(), tStep) == 0 ) {
316 return;
317 }
318
319 indx = gc.giveIntVarIndx();
320
321 for ( i = 1; i <= 3; i++ ) {
322 s [ i - 1 ] = v [ 0 ].at(indx);
323 }
324
325 for ( i = 0; i < 3; i++ ) {
326 p [ i ].x = pp [ ind.at(i + 1) ].x;
327 p [ i ].y = pp [ ind.at(i + 1) ].y;
328 p [ i ].z = pp [ ind.at(i + 1) ].z;
329 }
330
331 gc.updateFringeTableMinMax(s, 3);
332 EASValsSetFillStyle(FILL_SOLID);
333 tr = CreateTriangleWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ]);
334 EGWithMaskChangeAttributes(FILL_MASK | LAYER_MASK, tr);
335 EMAddGraphicsToModel(ESIModel(), tr);
336 }
337 }
338}
339
340void
341QTrPlaneStress2d :: drawSpecial(oofegGraphicContext &gc, TimeStep *tStep)
342{ }
343
344#endif
345
346
347void
348QTrPlaneStress2d :: SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap)
349{
350 pap.resize(3);
351 pap.at(1) = this->giveNode(1)->giveNumber();
352 pap.at(2) = this->giveNode(2)->giveNumber();
353 pap.at(3) = this->giveNode(3)->giveNumber();
354}
355
356
357void
358QTrPlaneStress2d :: SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
359{
360 answer.resize(3);
361 if ( pap == this->giveNode(1)->giveNumber() ) {
362 answer.at(1) = pap;
363 answer.at(2) = this->giveNode(4)->giveNumber();
364 answer.at(3) = this->giveNode(6)->giveNumber();
365 } else if ( pap == this->giveNode(2)->giveNumber() ) {
366 answer.at(1) = pap;
367 answer.at(2) = this->giveNode(5)->giveNumber();
368 answer.at(3) = this->giveNode(4)->giveNumber();
369 } else if ( pap == this->giveNode(3)->giveNumber() ) {
370 answer.at(1) = pap;
371 answer.at(2) = this->giveNode(6)->giveNumber();
372 answer.at(3) = this->giveNode(5)->giveNumber();
373 } else {
374 OOFEM_ERROR("node unknown");
375 }
376}
377
378
379int
380QTrPlaneStress2d :: SPRNodalRecoveryMI_giveNumberOfIP()
381{
382 return numberOfGaussPoints;
383}
384
385
387QTrPlaneStress2d :: SPRNodalRecoveryMI_givePatchType()
388{
390}
391
392} // 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
std::vector< std ::unique_ptr< IntegrationRule > > integrationRulesArray
Definition element.h:157
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
PlaneStressElement(int n, Domain *d)
static FEI2dTrQuad interpolation
Definition qtrplstr.h:57
SpatialLocalizerInterface(Element *element)
int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) override
int giveInternalStateAtNode(FloatArray &answer, InternalStateType type, InternalStateMode mode, int node, TimeStep *tStep) override
#define OOFEM_ERROR(...)
Definition error.h:79
@ SPRNodalRecoveryModelInterfaceType
@ 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