OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
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 - 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/PlaneStrain/qtrplanestrain.h"
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 "Materials/rcm2.h"
47 #endif
48 
49 
50 namespace oofem {
51 REGISTER_Element(QTrPlaneStrain);
52 
53 FEI2dTrQuad QTrPlaneStrain :: interpolation(1, 2);
54 
57 {
58  numberOfDofMans = 6;
60 }
61 
62 
65 
66 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 
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 
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 
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 
259 void
261 { }
262 
263 #endif
264 
265 
266 void
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 
275 void
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 
296 int
298 {
299  return numberOfGaussPoints;
300 }
301 
302 
305 {
307 }
308 
309 } // end namespace oofem
int testElementGraphicActivity(Element *)
Test if particular element passed fulfills various filtering criteria for its graphics output...
virtual Interface * giveInterface(InterfaceType it)
Interface requesting service.
The element interface required by ZZNodalRecoveryModel.
Class and object Domain.
Definition: domain.h:115
virtual SPRPatchType SPRNodalRecoveryMI_givePatchType()
ScalarAlgorithmType getScalarAlgo()
virtual void SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap)
The element interface required by ZZNodalRecoveryModel.
virtual int SPRNodalRecoveryMI_giveNumberOfIP()
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
virtual double giveCoordinate(int i)
Definition: node.C:82
QTrPlaneStrain(int n, Domain *d)
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 drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
#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 drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType)
Class representing vector of real numbers.
Definition: floatarray.h:82
virtual void drawSpecial(oofegGraphicContext &gc, TimeStep *tStep)
Class Interface.
Definition: interface.h:82
#define OOFEG_DEFORMED_GEOMETRY_WIDTH
The spatial localizer element interface associated to spatial localizer.
InterfaceType
Enumerative type, used to identify interface type.
Definition: interfacetype.h:43
void updateFringeTableMinMax(double *s, int size)
static FEI2dTrQuad interpolation
the oofem namespace is to define a context or scope in which all oofem names are defined.
int giveNumber() const
Definition: femcmpnn.h:107
Node * giveNode(int i) const
Returns reference to the i-th node of element.
Definition: element.h:610
virtual void SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
#define OOFEG_VARPLOT_PATTERN_LAYER
Class representing solution step.
Definition: timestep.h:80
int numberOfDofMans
Number of dofmanagers.
Definition: element.h:149
virtual void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)

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