OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
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 - 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 "../sm/Elements/PlaneStress/qtrplstr.h"
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"
43 #include "gaussintegrationrule.h"
44 #include "mathfem.h"
45 #include "classfactory.h"
46 
47 #ifdef __OOFEG
48  #include "oofeggraphiccontext.h"
49  #include "oofegutils.h"
50  #include "Materials/rcm2.h"
51 #endif
52 
53 namespace oofem {
54 REGISTER_Element(QTrPlaneStress2d);
55 
56 FEI2dTrQuad QTrPlaneStress2d :: interpolation(1, 2);
57 
60 {
61  numberOfDofMans = 6;
63 }
64 
65 
67 
68 
69 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 
92 {
95 }
96 
97 
98 #ifdef __OOFEG
99  #define TR_LENGHT_REDUCT 0.3333
100 
102 {
103  WCRec p [ 3 ];
104  GraphicObj *go;
105 
106  if ( !gc.testElementGraphicActivity(this) ) {
107  return;
108  }
109 
110  EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
111  EASValsSetColor( gc.getElementColor() );
112  EASValsSetEdgeColor( gc.getElementEdgeColor() );
113  EASValsSetEdgeFlag(true);
114  EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
115  p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
116  p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
117  p [ 0 ].z = 0.;
118  p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(1);
119  p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(2);
120  p [ 1 ].z = 0.;
121  p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1);
122  p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2);
123  p [ 2 ].z = 0.;
124 
125  go = CreateTriangle3D(p);
126  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
127  EGAttachObject(go, ( EObjectP ) this);
128  EMAddGraphicsToModel(ESIModel(), go);
129 }
130 
131 
133 {
134  WCRec p [ 3 ];
135  GraphicObj *go;
136  double defScale = gc.getDefScale();
137 
138  if ( !gc.testElementGraphicActivity(this) ) {
139  return;
140  }
141 
142  EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
143  EASValsSetColor( gc.getDeformedElementColor() );
144  EASValsSetEdgeColor( gc.getElementEdgeColor() );
145  EASValsSetEdgeFlag(true);
146  EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER);
147  p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale);
148  p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale);
149  p [ 0 ].z = 0.;
150  p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale);
151  p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale);
152  p [ 1 ].z = 0.;
153  p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(1, tStep, defScale);
154  p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(2, tStep, defScale);
155  p [ 2 ].z = 0.;
156 
157  go = CreateTriangle3D(p);
158  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
159  EMAddGraphicsToModel(ESIModel(), go);
160 }
161 
162 
164 {
165  int t, n [ 3 ], i, indx, result = 0;
166  WCRec p [ 3 ];
167  GraphicObj *tr;
168  FloatArray v [ 6 ];
169  double s [ 6 ], ss [ 3 ], defScale;
170 
171  if ( !gc.testElementGraphicActivity(this) ) {
172  return;
173  }
174 
175  if ( gc.giveIntVarMode() == ISM_recovered ) {
176  // ========= plot recovered values =========
177  for ( i = 1; i <= 6; i++ ) {
178  result += this->giveInternalStateAtNode(v [ i - 1 ], gc.giveIntVarType(), gc.giveIntVarMode(), i, tStep);
179  }
180 
181  if ( result != 6 ) {
182  return;
183  }
184 
185  indx = gc.giveIntVarIndx();
186 
187  for ( i = 1; i <= 6; i++ ) {
188  s [ i - 1 ] = v [ i - 1 ].at(indx);
189  }
190 
191  EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
192 
193  if ( gc.getScalarAlgo() == SA_ISO_SURF ) {
194  for ( t = 1; t <= 4; t++ ) {
195  if ( t == 1 ) {
196  n [ 0 ] = 1;
197  n [ 1 ] = 4;
198  n [ 2 ] = 6;
199  } else if ( t == 2 ) {
200  n [ 0 ] = 2;
201  n [ 1 ] = 5;
202  n [ 2 ] = 4;
203  } else if ( t == 3 ) {
204  n [ 0 ] = 3;
205  n [ 1 ] = 6;
206  n [ 2 ] = 5;
207  } else {
208  n [ 0 ] = 4;
209  n [ 1 ] = 5;
210  n [ 2 ] = 6;
211  }
212 
213 
214  for ( i = 0; i < 3; i++ ) {
215  if ( gc.getInternalVarsDefGeoFlag() ) {
216  // use deformed geometry
217  defScale = gc.getDefScale();
218  p [ i ].x = ( FPNum ) this->giveNode(n [ i ])->giveUpdatedCoordinate(1, tStep, defScale);
219  p [ i ].y = ( FPNum ) this->giveNode(n [ i ])->giveUpdatedCoordinate(2, tStep, defScale);
220  p [ i ].z = 0.;
221  } else {
222  // use initial geometry
223  p [ i ].x = ( FPNum ) this->giveNode(n [ i ])->giveCoordinate(1);
224  p [ i ].y = ( FPNum ) this->giveNode(n [ i ])->giveCoordinate(2);
225  p [ i ].z = 0.;
226  }
227  }
228 
229  //EASValsSetColor(gc.getYieldPlotColor(ratio));
230  ss [ 0 ] = s [ n [ 0 ] - 1 ];
231  ss [ 1 ] = s [ n [ 1 ] - 1 ];
232  ss [ 2 ] = s [ n [ 2 ] - 1 ];
233  gc.updateFringeTableMinMax(ss, 3);
234  tr = CreateTriangleWD3D(p, ss [ 0 ], ss [ 1 ], ss [ 2 ]);
235  EGWithMaskChangeAttributes(LAYER_MASK, tr);
236  EMAddGraphicsToModel(ESIModel(), tr);
237  }
238 
239  /* } else if (gc.getScalarAlgo() == SA_ISO_LINE) {
240  *
241  * EASValsSetColor(context.getActiveCrackColor());
242  * EASValsSetLineWidth(OOFEG_ISO_LINE_WIDTH);
243  *
244  * for (t=1; t<=4; t++) {
245  * if (t==1) {n[0] = 1; n[1]=4; n[2]=6;}
246  * else if (t==2) {n[0]=2; n[1]=5; n[2]=4;}
247  * else if (t==3) {n[0]=3; n[1]=6; n[2]=5;}
248  * else {n[0]=4; n[1]=5; n[2]=6;}
249  *
250  *
251  * for (i=0; i< 3; i++) {
252  * if (gc.getInternalVarsDefGeoFlag()) {
253  * // use deformed geometry
254  * defScale = gc.getDefScale();
255  * p[i].x = (FPNum) this->giveNode(n[i])->giveUpdatedCoordinate(1,tStep,defScale);
256  * p[i].y = (FPNum) this->giveNode(n[i])->giveUpdatedCoordinate(2,tStep,defScale);
257  * p[i].z = 0.;
258  *
259  * } else {
260  * p[i].x = (FPNum) this->giveNode(n[i])->giveCoordinate(1);
261  * p[i].y = (FPNum) this->giveNode(n[i])->giveCoordinate(2);
262  * p[i].z = 0.;
263  * }
264  * }
265  * sv[0]=s[n[0]-1];
266  * sv[1]=s[n[1]-1];
267  * sv[2]=s[n[2]-1];
268  *
269  * // isoline implementation
270  * oofeg_drawIsoLinesOnTriangle (p, sv);
271  * } */
272  }
273  } else if ( gc.giveIntVarMode() == ISM_local ) {
274  // ========= plot local values =========
275  // (so far implemented for 4 Gauss points only)
276  if ( numberOfGaussPoints != 4 ) {
277  return;
278  }
279 
280  IntArray ind(3);
281  WCRec pp [ 6 ];
282 
283  for ( i = 0; i < 6; i++ ) {
284  if ( gc.getInternalVarsDefGeoFlag() ) {
285  // use deformed geometry
286  defScale = gc.getDefScale();
287  pp [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
288  pp [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
289  pp [ i ].z = 0.;
290  } else {
291  // use initial geometry
292  pp [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
293  pp [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
294  pp [ i ].z = 0.;
295  }
296  }
297 
298  for ( GaussPoint *gp: *integrationRulesArray [ 0 ] ) {
299  //gpCoords = gp->giveNaturalCoordinates();
300  switch ( gp->giveNumber() ) {
301  case 3:
302  ind.at(1) = 0;
303  ind.at(2) = 3;
304  ind.at(3) = 5;
305  break;
306  case 4:
307  ind.at(1) = 1;
308  ind.at(2) = 4;
309  ind.at(3) = 3;
310  break;
311  case 2:
312  ind.at(1) = 2;
313  ind.at(2) = 5;
314  ind.at(3) = 4;
315  break;
316  case 5:
317  default:
318  ind.at(1) = 3;
319  ind.at(2) = 4;
320  ind.at(3) = 5;
321  }
322 
323  if ( giveIPValue(v [ 0 ], gp, gc.giveIntVarType(), tStep) == 0 ) {
324  return;
325  }
326 
327  indx = gc.giveIntVarIndx();
328 
329  for ( i = 1; i <= 3; i++ ) {
330  s [ i - 1 ] = v [ 0 ].at(indx);
331  }
332 
333  for ( i = 0; i < 3; i++ ) {
334  p [ i ].x = pp [ ind.at(i + 1) ].x;
335  p [ i ].y = pp [ ind.at(i + 1) ].y;
336  p [ i ].z = pp [ ind.at(i + 1) ].z;
337  }
338 
339  gc.updateFringeTableMinMax(s, 3);
340  EASValsSetFillStyle(FILL_SOLID);
341  tr = CreateTriangleWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ]);
342  EGWithMaskChangeAttributes(FILL_MASK | LAYER_MASK, tr);
343  EMAddGraphicsToModel(ESIModel(), tr);
344  }
345  }
346 }
347 
348 void
350 { }
351 
352 #endif
353 
354 
355 void
357 {
358  pap.resize(3);
359  pap.at(1) = this->giveNode(1)->giveNumber();
360  pap.at(2) = this->giveNode(2)->giveNumber();
361  pap.at(3) = this->giveNode(3)->giveNumber();
362 }
363 
364 
365 void
367 {
368  answer.resize(3);
369  if ( pap == this->giveNode(1)->giveNumber() ) {
370  answer.at(1) = pap;
371  answer.at(2) = this->giveNode(4)->giveNumber();
372  answer.at(3) = this->giveNode(6)->giveNumber();
373  } else if ( pap == this->giveNode(2)->giveNumber() ) {
374  answer.at(1) = pap;
375  answer.at(2) = this->giveNode(5)->giveNumber();
376  answer.at(3) = this->giveNode(4)->giveNumber();
377  } else if ( pap == this->giveNode(3)->giveNumber() ) {
378  answer.at(1) = pap;
379  answer.at(2) = this->giveNode(6)->giveNumber();
380  answer.at(3) = this->giveNode(5)->giveNumber();
381  } else {
382  OOFEM_ERROR("node unknown");
383  }
384 }
385 
386 
387 int
389 {
390  return numberOfGaussPoints;
391 }
392 
393 
396 {
398 }
399 
400 } // end namespace oofem
int testElementGraphicActivity(Element *)
Test if particular element passed fulfills various filtering criteria for its graphics output...
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: qtrplstr.C:91
The element interface required by ZZNodalRecoveryModel.
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in full form.
Class and object Domain.
Definition: domain.h:115
ScalarAlgorithmType getScalarAlgo()
virtual SPRPatchType SPRNodalRecoveryMI_givePatchType()
Definition: qtrplstr.C:395
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
virtual int giveInternalStateAtNode(FloatArray &answer, InternalStateType type, InternalStateMode mode, int node, TimeStep *tStep)
Returns internal state variable (like stress,strain) at node of element in Reduced form...
#define OOFEG_RAW_GEOMETRY_LAYER
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
virtual FEInterpolation * giveInterpolation() const
Definition: qtrplstr.C:66
virtual void SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap)
Definition: qtrplstr.C:356
virtual double giveCoordinate(int i)
Definition: node.C:82
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
#define OOFEG_DEFORMED_GEOMETRY_LAYER
Class representing a general abstraction for finite element interpolation class.
Definition: feinterpol.h:132
InternalStateType giveIntVarType()
virtual void SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
Definition: qtrplstr.C:366
#define OOFEM_ERROR(...)
Definition: error.h:61
REGISTER_Element(LSpace)
#define OOFEG_RAW_GEOMETRY_WIDTH
UnknownType
Type representing particular unknown (its physical meaning).
Definition: unknowntype.h:55
virtual double giveUpdatedCoordinate(int ic, TimeStep *tStep, double scale=1.)
Returns updated ic-th coordinate of receiver.
Definition: node.C:245
void resize(int n)
Checks size of receiver towards requested bounds.
Definition: intarray.C:124
int numberOfGaussPoints
Number of integration points as specified by nip.
Definition: element.h:188
InternalStateMode giveIntVarMode()
virtual void drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
Definition: qtrplstr.C:163
Class representing vector of real numbers.
Definition: floatarray.h:82
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
QTrPlaneStress2d(int n, Domain *d)
Definition: qtrplstr.C:58
Class representing the general Input Record.
Definition: inputrecord.h:101
Class Interface.
Definition: interface.h:82
#define OOFEG_DEFORMED_GEOMETRY_WIDTH
The spatial localizer element interface associated to spatial localizer.
static FEI2dTrQuad interpolation
Definition: qtrplstr.h:57
std::vector< std::unique_ptr< IntegrationRule > > integrationRulesArray
List of integration rules of receiver (each integration rule contains associated integration points a...
Definition: element.h:170
virtual void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
Definition: qtrplstr.C:101
virtual void drawSpecial(oofegGraphicContext &gc, TimeStep *tStep)
Definition: qtrplstr.C:349
InterfaceType
Enumerative type, used to identify interface type.
Definition: interfacetype.h:43
void updateFringeTableMinMax(double *s, int size)
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
int giveNumber() const
Definition: femcmpnn.h:107
virtual int SPRNodalRecoveryMI_giveNumberOfIP()
Definition: qtrplstr.C:388
Node * giveNode(int i) const
Returns reference to the i-th node of element.
Definition: element.h:610
#define OOFEG_VARPLOT_PATTERN_LAYER
Class representing integration point in finite element program.
Definition: gausspoint.h:93
virtual Interface * giveInterface(InterfaceType it)
Interface requesting service.
Definition: qtrplstr.C:70
Class representing solution step.
Definition: timestep.h:80
int numberOfDofMans
Number of dofmanagers.
Definition: element.h:149
virtual void drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType)
Definition: qtrplstr.C:132

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