OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
qplanestrain.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 
36 #include "fei2dquadquad.h"
37 #include "classfactory.h"
38 
39 #ifdef __OOFEG
40  #include "oofeggraphiccontext.h"
41  #include "gausspoint.h"
42 #endif
43 
44 namespace oofem {
45 REGISTER_Element(QPlaneStrain);
46 
47 FEI2dQuadQuad QPlaneStrain :: interpolation(1, 2);
48 
51 {
52  numberOfDofMans = 8;
54 }
55 
58 
59 Interface *
61 {
62  if ( interface == ZZNodalRecoveryModelInterfaceType ) {
63  return static_cast< ZZNodalRecoveryModelInterface * >(this);
64  }
65 
66  return NULL;
67 }
68 
69 
70 #ifdef __OOFEG
72 {
73  WCRec p [ 4 ];
74  GraphicObj *go;
75 
76  if ( !gc.testElementGraphicActivity(this) ) {
77  return;
78  }
79 
80  EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
81  EASValsSetColor( gc.getElementColor() );
82  EASValsSetEdgeColor( gc.getElementEdgeColor() );
83  EASValsSetEdgeFlag(true);
84  EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
85  EASValsSetFillStyle(FILL_HOLLOW);
86  p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
87  p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
88  p [ 0 ].z = 0.;
89  p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(1);
90  p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(2);
91  p [ 1 ].z = 0.;
92  p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1);
93  p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2);
94  p [ 2 ].z = 0.;
95  p [ 3 ].x = ( FPNum ) this->giveNode(4)->giveCoordinate(1);
96  p [ 3 ].y = ( FPNum ) this->giveNode(4)->giveCoordinate(2);
97  p [ 3 ].z = 0.;
98 
99  go = CreateQuad3D(p);
100  EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
101  EGAttachObject(go, ( EObjectP ) this);
102  EMAddGraphicsToModel(ESIModel(), go);
103 }
104 
105 
107 {
108  WCRec p [ 4 ];
109  GraphicObj *go;
110  double defScale = gc.getDefScale();
111 
112  if ( !gc.testElementGraphicActivity(this) ) {
113  return;
114  }
115 
116  EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
117  EASValsSetColor( gc.getDeformedElementColor() );
118  EASValsSetEdgeColor( gc.getElementEdgeColor() );
119  EASValsSetEdgeFlag(true);
120  EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER);
121  EASValsSetFillStyle(FILL_HOLLOW);
122  p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale);
123  p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale);
124  p [ 0 ].z = 0.;
125  p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale);
126  p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale);
127  p [ 1 ].z = 0.;
128  p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(1, tStep, defScale);
129  p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(2, tStep, defScale);
130  p [ 2 ].z = 0.;
131  p [ 3 ].x = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(1, tStep, defScale);
132  p [ 3 ].y = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(2, tStep, defScale);
133  p [ 3 ].z = 0.;
134 
135  go = CreateQuad3D(p);
136  EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
137  EMAddGraphicsToModel(ESIModel(), go);
138 }
139 
140 
142 {
143  int i, indx;
144  WCRec p [ 4 ];
145  GraphicObj *tr;
146  FloatArray v [ 4 ];
147  double s [ 4 ], defScale;
148 
149  if ( !gc.testElementGraphicActivity(this) ) {
150  return;
151  }
152 
153  EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
154  if ( gc.giveIntVarMode() == ISM_recovered ) {
155  // ============ plot the recovered values (smoothed data) ===============
156  /*
157  * for ( i = 1; i <= 4; i++ ) {
158  * result += this->giveInternalStateAtNode(v [ i - 1 ], gc.giveIntVarType(), gc.giveIntVarMode(), i, tStep);
159  * }
160  *
161  * if ( result != 4 ) {
162  * return;
163  * }
164  *
165  * indx = gc.giveIntVarIndx();
166  *
167  * for ( i = 1; i <= 4; i++ ) {
168  * s [ i - 1 ] = v [ i - 1 ].at(indx);
169  * }
170  *
171  * if ( gc.getScalarAlgo() == SA_ISO_SURF ) {
172  * for ( i = 0; i < 4; i++ ) {
173  * if ( gc.getInternalVarsDefGeoFlag() ) {
174  * // use deformed geometry
175  * defScale = gc.getDefScale();
176  * p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
177  * p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
178  * p [ i ].z = 0.;
179  * } else {
180  * p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
181  * p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
182  * p [ i ].z = 0.;
183  * }
184  * }
185  *
186  * //EASValsSetColor(gc.getYieldPlotColor(ratio));
187  * gc.updateFringeTableMinMax(s, 4);
188  * tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
189  * EGWithMaskChangeAttributes(LAYER_MASK, tr);
190  * EMAddGraphicsToModel(ESIModel(), tr);
191  * } else if ( ( gc.getScalarAlgo() == SA_ZPROFILE ) || ( gc.getScalarAlgo() == SA_COLORZPROFILE ) ) {
192  * double landScale = gc.getLandScale();
193  *
194  * for ( i = 0; i < 4; i++ ) {
195  * if ( gc.getInternalVarsDefGeoFlag() ) {
196  * // use deformed geometry
197  * defScale = gc.getDefScale();
198  * p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
199  * p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
200  * p [ i ].z = s [ i ] * landScale;
201  * } else {
202  * p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
203  * p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
204  * p [ i ].z = s [ i ] * landScale;
205  * }
206  *
207  * // this fixes a bug in ELIXIR
208  * if ( fabs(s [ i ]) < 1.0e-6 ) {
209  * s [ i ] = 1.0e-6;
210  * }
211  * }
212  *
213  * if ( gc.getScalarAlgo() == SA_ZPROFILE ) {
214  * EASValsSetColor( gc.getDeformedElementColor() );
215  * EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
216  * tr = CreateQuad3D(p);
217  * EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, tr);
218  * } else {
219  * gc.updateFringeTableMinMax(s, 4);
220  * tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
221  * EGWithMaskChangeAttributes(LAYER_MASK, tr);
222  * }
223  *
224  * EMAddGraphicsToModel(ESIModel(), tr);
225  * }
226  */
227  } else if ( gc.giveIntVarMode() == ISM_local ) {
228  // ========== plot the local values (raw data) =====================
229  if ( numberOfGaussPoints != 4 ) {
230  return;
231  }
232 
233  IntArray ind(4);
234  WCRec pp [ 9 ];
235 
236  for ( i = 0; i < 8; i++ ) {
237  if ( gc.getInternalVarsDefGeoFlag() ) {
238  // use deformed geometry
239  defScale = gc.getDefScale();
240  pp [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
241  pp [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
242  pp [ i ].z = 0.;
243  } else {
244  pp [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
245  pp [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
246  pp [ i ].z = 0.;
247  }
248  }
249 
250  pp [ 8 ].x = 0.25 * ( pp [ 0 ].x + pp [ 1 ].x + pp [ 2 ].x + pp [ 3 ].x );
251  pp [ 8 ].y = 0.25 * ( pp [ 0 ].y + pp [ 1 ].y + pp [ 2 ].y + pp [ 3 ].y );
252  pp [ 8 ].z = 0.;
253 
254  for ( auto &gp: *this->giveDefaultIntegrationRulePtr() ) {
255  const FloatArray& gpCoords = gp->giveNaturalCoordinates();
256  if ( ( gpCoords.at(1) > 0. ) && ( gpCoords.at(2) > 0. ) ) {
257  ind.at(1) = 0;
258  ind.at(2) = 4;
259  ind.at(3) = 8;
260  ind.at(4) = 7;
261  } else if ( ( gpCoords.at(1) < 0. ) && ( gpCoords.at(2) > 0. ) ) {
262  ind.at(1) = 4;
263  ind.at(2) = 1;
264  ind.at(3) = 5;
265  ind.at(4) = 8;
266  } else if ( ( gpCoords.at(1) < 0. ) && ( gpCoords.at(2) < 0. ) ) {
267  ind.at(1) = 5;
268  ind.at(2) = 2;
269  ind.at(3) = 6;
270  ind.at(4) = 8;
271  } else {
272  ind.at(1) = 6;
273  ind.at(2) = 3;
274  ind.at(3) = 7;
275  ind.at(4) = 8;
276  }
277 
278  if ( giveIPValue(v [ 0 ], gp, gc.giveIntVarType(), tStep) == 0 ) {
279  return;
280  }
281 
282  indx = gc.giveIntVarIndx();
283 
284  for ( i = 1; i <= 4; i++ ) {
285  s [ i - 1 ] = v [ 0 ].at(indx);
286  }
287 
288  for ( i = 0; i < 4; i++ ) {
289  p [ i ].x = pp [ ind.at(i + 1) ].x;
290  p [ i ].y = pp [ ind.at(i + 1) ].y;
291  p [ i ].z = pp [ ind.at(i + 1) ].z;
292  }
293 
294  gc.updateFringeTableMinMax(s, 4);
295  tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
296  EGWithMaskChangeAttributes(LAYER_MASK, tr);
297  EMAddGraphicsToModel(ESIModel(), tr);
298  }
299  }
300 }
301 
302 #endif
303 } // end namespace oofem
int testElementGraphicActivity(Element *)
Test if particular element passed fulfills various filtering criteria for its graphics output...
virtual Interface * giveInterface(InterfaceType it)
Definition: qplanestrain.C:60
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
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Access method for default integration rule.
Definition: element.h:822
The element interface required by ZZNodalRecoveryModel.
virtual void drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType)
Definition: qplanestrain.C:106
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
virtual void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
Definition: qplanestrain.C:71
#define OOFEG_RAW_GEOMETRY_LAYER
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
static FEI2dQuadQuad interpolation
Definition: qplanestrain.h:53
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 FEInterpolation * giveInterpolation() const
Definition: qplanestrain.C:57
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
int numberOfGaussPoints
Number of integration points as specified by nip.
Definition: element.h:188
InternalStateMode giveIntVarMode()
Class representing vector of real numbers.
Definition: floatarray.h:82
Class Interface.
Definition: interface.h:82
#define OOFEG_DEFORMED_GEOMETRY_WIDTH
QPlaneStrain(int N, Domain *d)
Definition: qplanestrain.C:49
InterfaceType
Enumerative type, used to identify interface type.
Definition: interfacetype.h:43
void updateFringeTableMinMax(double *s, int size)
virtual void drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
Definition: qplanestrain.C:141
the oofem namespace is to define a context or scope in which all oofem names are defined.
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 solution step.
Definition: timestep.h:80
int numberOfDofMans
Number of dofmanagers.
Definition: element.h:149

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