OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
intelpoint.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/Interfaces/intelpoint.h"
36 #include "../sm/CrossSections/structuralinterfacecrosssection.h"
37 #include "domain.h"
38 #include "node.h"
39 #include "gaussintegrationrule.h"
40 #include "floatmatrix.h"
41 #include "floatarray.h"
42 #include "intarray.h"
43 #include "mathfem.h"
44 #include "classfactory.h"
45 
46 #ifdef __OOFEG
47  #include "oofeggraphiccontext.h"
48 
49  #include <Emarkwd3d.h>
50 #endif
51 
52 namespace oofem {
53 REGISTER_Element(IntElPoint);
54 
55 IntElPoint :: IntElPoint(int n, Domain *aDomain) :
56  StructuralInterfaceElement(n, aDomain)
57 {
58  numberOfDofMans = 2;
59  referenceNode = 0;
60  normal.resize(3);
61  normal.zero();
62  area = 1.0;
63 }
64 
65 
66 void
68 {
70  case 1:
71  this->mode = ie1d_1d;
72  break;
73  case 2:
74  this->mode = ie1d_2d;
75  break;
76  case 3:
77  this->mode = ie1d_3d;
78  break;
79  default:
80  OOFEM_ERROR("Unsupported domain type")
81  }
82 }
83 
84 
87 {
88  setCoordMode();
89  switch ( mode ) {
90  case ie1d_1d: return _1dInterface;
91 
92  case ie1d_2d: return _2dInterface;
93 
94  case ie1d_3d: return _3dInterface;
95 
96  default: OOFEM_ERROR("Unsupported coord mode");
97  }
98  return _1dInterface; // to make the compiler happy
99 }
100 
101 
102 void
104 //
105 // Returns linear part of geometrical equations of the receiver at gp.
106 // Returns the linear part of the B matrix
107 //
108 {
109  setCoordMode();
110 
111 
112  switch ( mode ) {
113  case ie1d_1d:
114  answer.resize(1, 2);
115  answer.at(1, 1) = -1.0;
116  answer.at(1, 2) = +1.0;
117  break;
118  case ie1d_2d:
119  answer.resize(2, 4);
120  answer.zero();
121  answer.at(1, 1) = -1.0;
122  answer.at(1, 3) = +1.0;
123  answer.at(2, 2) = -1.0;
124  answer.at(2, 4) = +1.0;
125  break;
126  case ie1d_3d:
127  answer.resize(3, 6);
128  answer.zero();
129  answer.at(1, 1) = -1.0;
130  answer.at(1, 4) = +1.0;
131  answer.at(2, 2) = -1.0;
132  answer.at(2, 5) = +1.0;
133  answer.at(3, 3) = -1.0;
134  answer.at(3, 6) = +1.0;
135  break;
136  default:
137  OOFEM_ERROR("Unsupported mode");
138  }
139 
140 }
141 
142 
143 void
145 {
146  // Computes transformation matrix to local coordinate system.
147  setCoordMode();
148  switch ( mode ) {
149  case ie1d_1d:
150  answer.resize(1, 1);
151  answer.at(1, 1) = 1.;
152  return;
153 
154  case ie1d_2d:
155  answer.resize(2, 2);
156  answer.at(1, 1) = normal.at(1);
157  answer.at(1, 2) = normal.at(2);
158  answer.at(2, 1) = -normal.at(2);
159  answer.at(2, 2) = normal.at(1);
160  return;
161 
162  case ie1d_3d:
163  {
164  //FloatMatrix test;
165  //test.beLocalCoordSys(normal.normalize());
166 
167  FloatArray ly(3), lz(3);
168  normal.normalize();
169  ly.zero();
170  if ( fabs( normal.at(1) ) > fabs( normal.at(2) ) ) {
171  ly.at(2) = 1.;
172  } else {
173  ly.at(1) = 1.;
174  }
175 
176  lz.beVectorProductOf(normal, ly);
177  lz.normalize();
178  ly.beVectorProductOf(lz, normal);
179  ly.normalize();
180 
181  answer.resize(3, 3);
182  for ( int i = 1; i <= 3; i++ ) {
183  answer.at(1, i) = normal.at(i);
184  answer.at(2, i) = ly.at(i);
185  answer.at(3, i) = lz.at(i);
186  }
187 
188  return;
189  }
190 
191  default:
192  OOFEM_ERROR("Unsupported mode");
193  }
194 }
195 
196 
197 void
199 // Sets up the array of Gauss Points of the receiver.
200 {
201  if ( integrationRulesArray.size() == 0 ) {
202  integrationRulesArray.resize(1);
203  integrationRulesArray [ 0 ].reset( new GaussIntegrationRule(1, this, 1, 2) );
204  integrationRulesArray [ 0 ]->setUpIntegrationPoints( _Line, 1, this->giveMaterialMode() );
205  }
206 }
207 
208 
209 int
211 {
212  answer = *this->giveNode(1)->giveCoordinates();
213  answer.add(*this->giveNode(2)->giveCoordinates());
214  answer.times(0.5);
215  return 1;
216 }
217 
218 
219 
220 double
222 {
223  // The modeled area/extension around the connected nodes.
224  // Compare with the cs area of a bar. ///@todo replace with cs-property? /JB
225  return this->area;
226 }
227 
228 
231 {
232  IRResultType result; // Required by IR_GIVE_FIELD macro
233 
235  if ( result != IRRT_OK ) {
236  return result;
237  }
238 
240  OOFEM_WARNING("Ambiguous input: 'refnode' and 'normal' cannot both be specified");
241  return IRRT_BAD_FORMAT;
242  }
245 
246  this->area = 1.0; // Default area ///@todo Make non-optional? /JB
248 
249  this->computeLocalSlipDir(normal);
250  return IRRT_OK;
251 }
252 
253 
254 int
256 {
257  setCoordMode();
258  switch ( mode ) {
259  case ie1d_1d:
260  return 2;
261 
262  case ie1d_2d:
263  return 4;
264 
265  case ie1d_3d:
266  return 6;
267 
268  default:
269  OOFEM_ERROR("Unsupported mode");
270  }
271 
272  return 0; // to suppress compiler warning
273 }
274 
275 
276 void
278 {
279 
280  switch ( domain->giveNumberOfSpatialDimensions() ) {
281  case 1:
282  answer = IntArray{ D_u };
283  break;
284  case 2:
285  answer = { D_u, D_v };
286  break;
287  case 3:
288  answer = { D_u, D_v, D_w };
289  break;
290  default:
291  OOFEM_ERROR("Unsupported mode");
292  }
293 
294 }
295 
296 
297 void
299 {
300  normal.resizeWithValues(3);
301  if ( this->referenceNode ) {
302  // normal
303  normal.beDifferenceOf(*domain->giveNode(this->referenceNode)->giveCoordinates(), *this->giveNode(1)->giveCoordinates());
304  } else {
305  if ( normal.at(1) == 0 && normal.at(2) == 0 && normal.at(3) == 0 ) {
306  OOFEM_ERROR("Normal is not defined (referenceNode=0,normal=(0,0,0))");
307  }
308  }
309 
310  normal.normalize();
311 }
312 
313 
314 
315 #ifdef __OOFEG
317 {
318  GraphicObj *go;
319  // if (!go) { // create new one
320  WCRec p [ 1 ]; /* poin */
321  if ( !gc.testElementGraphicActivity(this) ) {
322  return;
323  }
324 
325  EASValsSetColor( gc.getElementColor() );
326  EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
327  EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
328  EASValsSetColor( gc.getDeformedElementColor() );
329  p [ 0 ].x = ( FPNum ) ( this->giveNode(1)->giveCoordinate(1) );
330  p [ 0 ].y = ( FPNum ) ( this->giveNode(1)->giveCoordinate(2) );
331  p [ 0 ].z = ( FPNum ) ( this->giveNode(1)->giveCoordinate(3) );
332 
333  EASValsSetMType(CIRCLE_MARKER);
334  go = CreateMarker3D(p);
335  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
336  EMAddGraphicsToModel(ESIModel(), go);
337 }
338 
339 
341 {
342  GraphicObj *go;
343  // if (!go) { // create new one
344  WCRec p [ 1 ]; /* poin */
345  if ( !gc.testElementGraphicActivity(this) ) {
346  return;
347  }
348 
349  double defScale = gc.getDefScale();
350 
351  EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
352  EASValsSetColor( gc.getDeformedElementColor() );
353  EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER);
354  p [ 0 ].x = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale) +
355  this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale) );
356  p [ 0 ].y = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale) +
357  this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale) );
358  p [ 0 ].z = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(3, tStep, defScale) +
359  this->giveNode(2)->giveUpdatedCoordinate(3, tStep, defScale) );
360 
361  EASValsSetMType(CIRCLE_MARKER);
362  go = CreateMarker3D(p);
363  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
364  EMAddGraphicsToModel(ESIModel(), go);
365 }
366 
367 
369 {
370  int indx, result = 0;
372  FloatArray gcoord(3), v1;
373  WCRec p [ 1 ];
374  GraphicObj *go;
375  double val [ 1 ];
376 
377  if ( !gc.testElementGraphicActivity(this) ) {
378  return;
379  }
380 
381  if ( gc.getInternalVarsDefGeoFlag() ) {
382  double defScale = gc.getDefScale();
383  p [ 0 ].x = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale) +
384  this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale) );
385  p [ 0 ].y = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale) +
386  this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale) );
387  p [ 0 ].z = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(3, tStep, defScale) +
388  this->giveNode(2)->giveUpdatedCoordinate(3, tStep, defScale) );
389  } else {
390  p [ 0 ].x = ( FPNum ) ( this->giveNode(1)->giveCoordinate(1) );
391  p [ 0 ].y = ( FPNum ) ( this->giveNode(1)->giveCoordinate(2) );
392  p [ 0 ].z = ( FPNum ) ( this->giveNode(1)->giveCoordinate(3) );
393  }
394 
395  result += giveIPValue(v1, iRule->getIntegrationPoint(0), gc.giveIntVarType(), tStep);
396 
397 
398  for ( GaussPoint *gp: *iRule ) {
399  result = 0;
400  result += giveIPValue(v1, gp, gc.giveIntVarType(), tStep);
401  if ( result != 1 ) {
402  continue;
403  }
404 
405  indx = gc.giveIntVarIndx();
406 
407  val [ 0 ] = v1.at(indx);
408  gc.updateFringeTableMinMax(val, 1);
409 
410  EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
411  EASValsSetMType(FILLED_CIRCLE_MARKER);
412  go = CreateMarkerWD3D(p, val [ 0 ]);
413  EGWithMaskChangeAttributes(LAYER_MASK | FILL_MASK | MTYPE_MASK, go);
414  EMAddGraphicsToModel(ESIModel(), go);
415  //}
416  }
417 }
418 #endif
419 
420 } // end namespace oofem
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: intelpoint.C:230
int testElementGraphicActivity(Element *)
Test if particular element passed fulfills various filtering criteria for its graphics output...
void beVectorProductOf(const FloatArray &v1, const FloatArray &v2)
Computes vector product (or cross product) of vectors given as parameters, , and stores the result in...
Definition: floatarray.C:415
Class and object Domain.
Definition: domain.h:115
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Access method for default integration rule.
Definition: element.h:822
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition: femcmpnn.h:82
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
void computeLocalSlipDir(FloatArray &normal)
Definition: intelpoint.C:298
virtual void drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType)
Definition: intelpoint.C:340
#define OOFEG_RAW_GEOMETRY_LAYER
virtual MaterialMode giveMaterialMode()
Returns material mode for receiver integration points.
Definition: intelpoint.C:86
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
virtual int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords)
Computes the global coordinates from given element&#39;s local coordinates.
Definition: intelpoint.C:210
virtual bool hasField(InputFieldType id)=0
Returns true if record contains field identified by idString keyword.
enum oofem::IntElPoint::cmode mode
virtual double giveCoordinate(int i)
Definition: node.C:82
int giveNumberOfSpatialDimensions()
Returns number of spatial dimensions.
Definition: domain.C:1067
MaterialMode
Type representing material mode of integration point.
Definition: materialmode.h:89
Class implementing an array of integers.
Definition: intarray.h:61
#define OOFEG_DEFORMED_GEOMETRY_LAYER
Abstract base class representing integration rule.
#define _IFT_IntElPoint_area
Definition: intelpoint.h:46
void beDifferenceOf(const FloatArray &a, const FloatArray &b)
Sets receiver to be a - b.
Definition: floatarray.C:341
virtual double computeAreaAround(GaussPoint *gp)
Definition: intelpoint.C:221
InternalStateType giveIntVarType()
virtual void computeTransformationMatrixAt(GaussPoint *gp, FloatMatrix &answer)
Definition: intelpoint.C:144
#define OOFEM_ERROR(...)
Definition: error.h:61
REGISTER_Element(LSpace)
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 resizeWithValues(int s, int allocChunk=0)
Checks size of receiver towards requested bounds.
Definition: floatarray.C:615
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
virtual void computeNmatrixAt(GaussPoint *gp, FloatMatrix &answer)
Computes modified interpolation matrix (N) for the element which multiplied with the unknowns vector ...
Definition: intelpoint.C:103
void setCoordMode()
Definition: intelpoint.C:67
virtual void computeGaussPoints()
Initializes the array of integration rules member variable.
Definition: intelpoint.C:198
virtual void giveDofManDofIDMask(int inode, IntArray &answer) const
Returns dofmanager dof mask for node.
Definition: intelpoint.C:277
Class representing vector of real numbers.
Definition: floatarray.h:82
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
virtual void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
Definition: intelpoint.C:316
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
GaussPoint * getIntegrationPoint(int n)
Access particular integration point of receiver.
#define _IFT_IntElPoint_refnode
Definition: intelpoint.h:44
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
Definition: floatmatrix.C:1358
Class representing the general Input Record.
Definition: inputrecord.h:101
void zero()
Zeroes all coefficients of receiver.
Definition: floatarray.C:658
#define _IFT_IntElPoint_normal
Definition: intelpoint.h:45
#define OOFEG_DEFORMED_GEOMETRY_WIDTH
void times(double s)
Multiplies receiver with scalar.
Definition: floatarray.C:818
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
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 FloatArray * giveCoordinates()
Definition: node.h:114
void zero()
Zeroes all coefficient of receiver.
Definition: floatmatrix.C:1326
void updateFringeTableMinMax(double *s, int size)
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:78
Abstract base class for all structural interface elements.
Node * giveNode(int n)
Service for accessing particular domain node.
Definition: domain.h:371
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in full form.
double normalize()
Normalizes receiver.
Definition: floatarray.C:828
Node * giveNode(int i) const
Returns reference to the i-th node of element.
Definition: element.h:610
FloatArray normal
Definition: intelpoint.h:63
#define OOFEG_VARPLOT_PATTERN_LAYER
Class representing integration point in finite element program.
Definition: gausspoint.h:93
#define OOFEM_WARNING(...)
Definition: error.h:62
IntElPoint(int n, Domain *d)
Definition: intelpoint.C:55
Class representing solution step.
Definition: timestep.h:80
int numberOfDofMans
Number of dofmanagers.
Definition: element.h:149
void add(const FloatArray &src)
Adds array src to receiver.
Definition: floatarray.C:156
virtual int computeNumberOfDofs()
Computes or simply returns total number of element&#39;s local DOFs.
Definition: intelpoint.C:255
Class representing Gaussian-quadrature integration rule.
virtual void drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
Definition: intelpoint.C:368
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631

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:29 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011