OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
lspace.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 "Elements/3D/lspace.h"
36 #include "fei3dhexalin.h"
37 #include "node.h"
38 #include "gausspoint.h"
39 #include "gaussintegrationrule.h"
40 #include "floatmatrix.h"
41 #include "floatarray.h"
42 #include "intarray.h"
43 #include "domain.h"
44 #include "mathfem.h"
45 #include "crosssection.h"
46 #include "classfactory.h"
47 
48 #ifdef __OOFEG
49  #include "oofeggraphiccontext.h"
50  #include "oofegutils.h"
51  #include "Materials/rcm2.h"
52 #endif
53 
54 namespace oofem {
55 REGISTER_Element(LSpace);
56 
57 FEI3dHexaLin LSpace :: interpolation;
58 
62  // Constructor.
63 {
64  numberOfDofMans = 8;
66 }
67 
68 
70 
71 Interface *
73 {
74  if ( interface == ZZNodalRecoveryModelInterfaceType ) {
75  return static_cast< ZZNodalRecoveryModelInterface * >(this);
76  } else if ( interface == SPRNodalRecoveryModelInterfaceType ) {
77  return static_cast< SPRNodalRecoveryModelInterface * >(this);
78  } else if ( interface == NodalAveragingRecoveryModelInterfaceType ) {
79  return static_cast< NodalAveragingRecoveryModelInterface * >(this);
80  } else if ( interface == SpatialLocalizerInterfaceType ) {
81  return static_cast< SpatialLocalizerInterface * >(this);
82  } else if ( interface == HuertaErrorEstimatorInterfaceType ) {
83  return static_cast< HuertaErrorEstimatorInterface * >(this);
84  }
85 
86  return NULL;
87 }
88 
89 
92 {
95 }
96 
97 
98 void
100 {
101  pap.resize(numberOfDofMans);
102  for ( int i = 1; i <= numberOfDofMans; i++ ) {
103  pap.at(i) = this->giveNode(i)->giveNumber();
104  }
105 }
106 
107 
108 void
110 {
111  int found = 0;
112  answer.resize(1);
113 
114  for ( int i = 1; i <= numberOfDofMans; i++ ) {
115  if ( this->giveNode(i)->giveNumber() == pap ) {
116  found = 1;
117  }
118  }
119 
120  if ( found ) {
121  answer.at(1) = pap;
122  } else {
123  OOFEM_ERROR("unknown node number %d", pap);
124  }
125 }
126 
127 
128 int
130 {
132 }
133 
134 
137 {
138  return SPRPatchType_3dBiLin;
139 }
140 
141 
142 void
144  InternalStateType type, TimeStep *tStep)
145 {
146  double x1 = 0.0, x2 = 0.0, x3 = 0.0, y = 0.0;
147  FloatMatrix A(4, 4);
148  FloatMatrix b, r;
149  FloatArray val;
150  double u, v, w;
151 
152  int size = 0;
153 
154  for ( GaussPoint *gp: *integrationRulesArray [ 0 ] ) {
155  giveIPValue(val, gp, type, tStep);
156  if ( size == 0 ) {
157  size = val.giveSize();
158  b.resize(4, size);
159  r.resize(4, size);
160  A.zero();
161  r.zero();
162  }
163 
164  const FloatArray &coord = gp->giveNaturalCoordinates();
165  u = coord.at(1);
166  v = coord.at(2);
167  w = coord.at(3);
168 
169  A.at(1, 1) += 1;
170  A.at(1, 2) += u;
171  A.at(1, 3) += v;
172  A.at(1, 4) += w;
173  A.at(2, 1) += u;
174  A.at(2, 2) += u * u;
175  A.at(2, 3) += u * v;
176  A.at(2, 4) += u * w;
177  A.at(3, 1) += v;
178  A.at(3, 2) += v * u;
179  A.at(3, 3) += v * v;
180  A.at(3, 4) += v * w;
181  A.at(4, 1) += w;
182  A.at(4, 2) += w * u;
183  A.at(4, 3) += w * v;
184  A.at(4, 4) += w * w;
185 
186  for ( int j = 1; j <= size; j++ ) {
187  y = val.at(j);
188  r.at(1, j) += y;
189  r.at(2, j) += y * u;
190  r.at(3, j) += y * v;
191  r.at(4, j) += y * w;
192  }
193  }
194 
195  A.solveForRhs(r, b);
196 
197  switch ( node ) {
198  case 1:
199  x1 = 1.0;
200  x2 = 1.0;
201  x3 = 1.0;
202  break;
203  case 2:
204  x1 = -1.0;
205  x2 = 1.0;
206  x3 = 1.0;
207  break;
208  case 3:
209  x1 = -1.0;
210  x2 = -1.0;
211  x3 = 1.0;
212  break;
213  case 4:
214  x1 = 1.0;
215  x2 = -1.0;
216  x3 = 1.0;
217  break;
218  case 5:
219  x1 = 1.0;
220  x2 = 1.0;
221  x3 = -1.0;
222  break;
223  case 6:
224  x1 = -1.0;
225  x2 = 1.0;
226  x3 = -1.0;
227  break;
228  case 7:
229  x1 = -1.0;
230  x2 = -1.0;
231  x3 = -1.0;
232  break;
233  case 8:
234  x1 = 1.0;
235  x2 = -1.0;
236  x3 = -1.0;
237  break;
238  default:
239  OOFEM_ERROR("unsupported node");
240  }
241 
242  answer.resize(size);
243  for ( int j = 1; j <= size; j++ ) {
244  answer.at(j) = b.at(1, j) + x1 *b.at(2, j) * x2 * b.at(3, j) * x3 * b.at(4, j);
245  }
246 }
247 
248 
249 void
251  IntArray &localNodeIdArray, IntArray &globalNodeIdArray,
253  int &localNodeId, int &localElemId, int &localBcId,
254  IntArray &controlNode, IntArray &controlDof,
256 {
257  FloatArray *corner [ 8 ], midSide [ 12 ], midFace [ 6 ], midNode;
258  double x = 0.0, y = 0.0, z = 0.0;
259  int inode, nodes = 8, iside, sides = 12, iface, faces = 6, nd, nd1, nd2;
260 
261  static int sideNode [ 12 ] [ 2 ] = { { 1, 2 }, { 2, 3 }, { 3, 4 }, { 4, 1 }, // bottom
262  { 5, 6 }, { 6, 7 }, { 7, 8 }, { 8, 5 }, // top
263  { 1, 5 }, { 2, 6 }, { 3, 7 }, { 4, 8 } }; // vertical
264  static int faceNode [ 6 ] [ 4 ] = { { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, // bottom, top
265  { 1, 2, 6, 5 }, { 2, 3, 7, 6 }, { 3, 4, 8, 7 }, { 4, 1, 5, 8 } }; // side
266 
267  /* ordering of side and face hexa nodes must be compatible with refinedElement connectivity ordering;
268  * generally the ordering is: corner side side face side face face center;
269  * however the concrete ordering is element dependent (see refineMeshGlobally source if in doubts) */
270 
271  static int hexaSideNode [ 8 ] [ 3 ] = { { 1, 4, 9 }, { 2, 1, 10 }, { 3, 2, 11 }, { 4, 3, 12 },
272  { 8, 5, 9 }, { 5, 6, 10 }, { 6, 7, 11 }, { 7, 8, 12 } };
273  static int hexaFaceNode [ 8 ] [ 3 ] = { { 1, 3, 6 }, { 1, 4, 3 }, { 1, 5, 4 }, { 1, 6, 5 },
274  { 2, 6, 3 }, { 2, 3, 4 }, { 2, 4, 5 }, { 2, 5, 6 } };
275 
278  for ( inode = 0; inode < nodes; inode++ ) {
279  corner [ inode ] = this->giveNode(inode + 1)->giveCoordinates();
280 
281  x += corner [ inode ]->at(1);
282  y += corner [ inode ]->at(2);
283  z += corner [ inode ]->at(3);
284  }
285 
286  for ( iside = 0; iside < sides; iside++ ) {
287  midSide [ iside ].resize(3);
288 
289  nd1 = sideNode [ iside ] [ 0 ] - 1;
290  nd2 = sideNode [ iside ] [ 1 ] - 1;
291 
292  midSide [ iside ].at(1) = ( corner [ nd1 ]->at(1) + corner [ nd2 ]->at(1) ) / 2.0;
293  midSide [ iside ].at(2) = ( corner [ nd1 ]->at(2) + corner [ nd2 ]->at(2) ) / 2.0;
294  midSide [ iside ].at(3) = ( corner [ nd1 ]->at(3) + corner [ nd2 ]->at(3) ) / 2.0;
295  }
296 
297  midNode.resize(3);
298 
299  midNode.at(1) = x / nodes;
300  midNode.at(2) = y / nodes;
301  midNode.at(3) = z / nodes;
302 
303  for ( iface = 0; iface < faces; iface++ ) {
304  x = y = z = 0.0;
305  for ( inode = 0; inode < 4; inode++ ) {
306  nd = faceNode [ iface ] [ inode ] - 1;
307  x += corner [ nd ]->at(1);
308  y += corner [ nd ]->at(2);
309  z += corner [ nd ]->at(3);
310  }
311 
312  midFace [ iface ].resize(3);
313 
314  midFace [ iface ].at(1) = x / 4;
315  midFace [ iface ].at(2) = y / 4;
316  midFace [ iface ].at(3) = z / 4;
317  }
318  }
319 
320  this->setupRefinedElementProblem3D(this, refinedElement, level, nodeId, localNodeIdArray, globalNodeIdArray,
321  sMode, tStep, nodes, corner, midSide, midFace, midNode,
322  localNodeId, localElemId, localBcId, hexaSideNode, hexaFaceNode,
323  controlNode, controlDof, aMode, "LSpace");
324 }
325 
326 
328 {
330 }
331 
332 
333 #ifdef __OOFEG
334  #define TR_LENGHT_REDUCT 0.3333
335 
337 {
338  WCRec p [ 8 ];
339  GraphicObj *go;
340 
341  if ( !gc.testElementGraphicActivity(this) ) {
342  return;
343  }
344 
345  EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
346  EASValsSetColor( gc.getElementColor() );
347  EASValsSetEdgeColor( gc.getElementEdgeColor() );
348  EASValsSetEdgeFlag(true);
349  EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
350  EASValsSetFillStyle(FILL_SOLID);
351  for ( int i = 0; i < 8; i++ ) {
352  p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
353  p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
354  p [ i ].z = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(3);
355  }
356 
357  go = CreateHexahedron(p);
358  EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
359  EGAttachObject(go, ( EObjectP ) this);
360  EMAddGraphicsToModel(ESIModel(), go);
361 
362  /*
363  * FloatArray c(3);
364  * c.at(1) = -1.0; c.at(2) = 0.0; c.at(3) = 0.0;
365  * this->drawTriad (c,4);
366  * c.at(1) = 1.0; c.at(2) = 0.0; c.at(3) = 0.0;
367  * this->drawTriad (c,6);
368  * c.at(1) = 0.0; c.at(2) = -1.0; c.at(3) = 0.0;
369  * this->drawTriad (c,5);
370  * c.at(1) = 0.0; c.at(2) = 1.0; c.at(3) = 0.0;
371  * this->drawTriad (c,3);
372  * c.at(1) = 0.0; c.at(2) = 0.0; c.at(3) = -1.0;
373  * this->drawTriad (c,2);
374  * c.at(1) = 0.0; c.at(2) = 0.0; c.at(3) = 1.0;
375  * this->drawTriad (c,1);
376  */
377 }
378 
379 
380 void LSpace :: drawTriad(FloatArray &coords, int isurf)
381 {
382  FloatMatrix jm(3, 3);
383  FloatArray gc(3);
384  GraphicObj *go;
385 
386  WCRec p [ 2 ]; // point
387  double coeff = 1.0;
388  int i, succ;
389  /*
390  * // version I
391  * this->interpolation.giveJacobianMatrixAt (jm, domain, nodeArray, coords);
392  * // determine origin
393  * this->interpolation.local2global (gc, domain, nodeArray, coords, 0.0);
394  * // draw triad
395  *
396  */
397 
398  // version II
399  // determine surface center
400  IntArray snodes(4);
401  FloatArray h1(3), h2(3), nn(3), n(3);
402  int j;
403  const char *colors[] = {
404  "red", "green", "blue"
405  };
406 
407 
408  this->interpolation.computeSurfaceMapping(snodes, dofManArray, isurf);
409  for ( i = 1; i <= 4; i++ ) {
410  gc.add( * ( domain->giveNode( snodes.at(i) )->giveCoordinates() ) );
411  }
412 
413  gc.times(1. / 4.);
414  // determine "average normal"
415  nn.zero();
416  for ( i = 1; i <= 4; i++ ) {
417  j = ( i ) % 4 + 1;
418  h1 = * domain->giveNode( snodes.at(i) )->giveCoordinates();
419  h1.subtract(gc);
420  h2 = * domain->giveNode( snodes.at(j) )->giveCoordinates();
421  h2.subtract(gc);
422  n.beVectorProductOf(h1, h2);
423  if ( n.dotProduct(n, 3) > 1.e-6 ) {
424  n.normalize();
425  }
426 
427  nn.add(n);
428  }
429 
430  nn.times(1. / 4.);
431  if ( nn.dotProduct(nn, 3) < 1.e-6 ) {
432  return;
433  }
434 
435  nn.normalize();
436  for ( i = 1; i <= 3; i++ ) {
437  jm.at(i, 3) = nn.at(i);
438  }
439 
440  // determine lcs of surface
441  // local x axis in xy plane
442  double test = fabs(fabs( nn.at(3) ) - 1.0);
443  if ( test < 1.e-5 ) {
444  h1.at(1) = jm.at(1, 1) = 1.0;
445  h1.at(2) = jm.at(2, 1) = 0.0;
446  } else {
447  h1.at(1) = jm.at(1, 1) = jm.at(2, 3);
448  h1.at(2) = jm.at(2, 1) = -jm.at(1, 3);
449  }
450 
451  h1.at(3) = jm.at(3, 1) = 0.0;
452  // local y axis perpendicular to local x,z axes
453  h2.beVectorProductOf(nn, h1);
454  for ( i = 1; i <= 3; i++ ) {
455  jm.at(i, 2) = h2.at(i);
456  }
457 
458 
459  p [ 0 ].x = gc.at(1);
460  p [ 0 ].y = gc.at(2);
461  p [ 0 ].z = gc.at(3);
462  for ( i = 1; i <= 3; i++ ) {
463  p [ 1 ].x = p [ 0 ].x + coeff *jm.at(1, i);
464  p [ 1 ].y = p [ 0 ].y + coeff *jm.at(2, i);
465  p [ 1 ].z = p [ 0 ].z + coeff *jm.at(3, i);
466 
467  EASValsSetColor( ColorGetPixelFromString(const_cast< char * >(colors [ i - 1 ]), & succ) );
468 
469  go = CreateLine3D(p);
470  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
471  EMAddGraphicsToModel(ESIModel(), go);
472  }
473 }
474 
475 
477 {
478  int i;
479  WCRec p [ 8 ];
480  GraphicObj *go;
481  double defScale = gc.getDefScale();
482 
483  if ( !gc.testElementGraphicActivity(this) ) {
484  return;
485  }
486 
487  EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
488  EASValsSetColor( gc.getDeformedElementColor() );
489  EASValsSetEdgeColor( gc.getElementEdgeColor() );
490  EASValsSetEdgeFlag(true);
491  EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER);
492  EASValsSetFillStyle(FILL_SOLID);
493  for ( i = 0; i < 8; i++ ) {
494  p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
495  p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
496  p [ i ].z = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(3, tStep, defScale);
497  }
498 
499  go = CreateHexahedron(p);
500  EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
501  EMAddGraphicsToModel(ESIModel(), go);
502 }
503 
504 
506 {
507  int i, indx, result = 0;
508  WCRec p [ 8 ];
509  GraphicObj *tr;
510  FloatArray v [ 8 ];
511  double s [ 8 ], defScale = 0.0;
512 
513  if ( !gc.testElementGraphicActivity(this) ) {
514  return;
515  }
516 
517  if ( gc.giveIntVarMode() == ISM_recovered ) {
518  for ( i = 1; i <= 8; i++ ) {
519  result += this->giveInternalStateAtNode(v [ i - 1 ], gc.giveIntVarType(), gc.giveIntVarMode(), i, tStep);
520  }
521 
522  if ( result != 8 ) {
523  return;
524  }
525  } else if ( gc.giveIntVarMode() == ISM_local ) {
526  return;
527  }
528 
529  indx = gc.giveIntVarIndx();
530 
531  for ( i = 1; i <= 8; i++ ) {
532  s [ i - 1 ] = v [ i - 1 ].at(indx);
533  }
534 
535  EASValsSetEdgeColor( gc.getElementEdgeColor() );
536  EASValsSetEdgeFlag(true);
537  EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
538  if ( gc.getScalarAlgo() == SA_ISO_SURF ) {
539  for ( i = 0; i < 8; i++ ) {
540  if ( gc.getInternalVarsDefGeoFlag() ) {
541  // use deformed geometry
542  defScale = gc.getDefScale();
543  p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
544  p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
545  p [ i ].z = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(3, tStep, defScale);
546  } else {
547  p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
548  p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
549  p [ i ].z = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(3);
550  }
551  }
552 
553  gc.updateFringeTableMinMax(s, 8);
554  tr = CreateHexahedronWD(p, s);
555  EGWithMaskChangeAttributes(LAYER_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK, tr);
556  EMAddGraphicsToModel(ESIModel(), tr);
557  }
558 }
559 
560 void
562 {
563  int i, j, k;
564  WCRec q [ 4 ];
565  GraphicObj *tr;
566  FloatArray crackStatuses, cf;
567 
568  if ( !gc.testElementGraphicActivity(this) ) {
569  return;
570  }
571 
572  if ( gc.giveIntVarType() == IST_CrackState ) {
573  int crackStatus;
574  FloatArray gpc;
575  double length;
576  FloatArray crackDir;
577 
578  for ( GaussPoint *gp: *this->giveDefaultIntegrationRulePtr() ) {
579  if ( this->giveIPValue(cf, gp, IST_CrackedFlag, tStep) == 0 ) {
580  return;
581  }
582 
583  if ( ( int ) cf.at(1) == 0 ) {
584  return;
585  }
586 
587  //
588  // obtain gp global coordinates
589  this->computeGlobalCoordinates( gpc, gp->giveNaturalCoordinates() );
590  length = 0.3333 * cbrt(this->computeVolumeAround(gp));
591  if ( this->giveIPValue(crackDir, gp, IST_CrackDirs, tStep) ) {
592  this->giveIPValue(crackStatuses, gp, IST_CrackStatuses, tStep);
593 
594 
595  for ( i = 1; i <= 3; i++ ) {
596  crackStatus = ( int ) crackStatuses.at(i);
597  if ( ( crackStatus != pscm_NONE ) && ( crackStatus != pscm_CLOSED ) ) {
598  // draw a crack
599  // this element is 3d element
600 
601  if ( i == 1 ) {
602  j = 2;
603  k = 3;
604  } else if ( i == 2 ) {
605  j = 3;
606  k = 1;
607  } else {
608  j = 1;
609  k = 2;
610  }
611 
612  q [ 0 ].x = ( FPNum ) gpc.at(1) + 0.5 * crackDir.at(0 + j) * length + 0.5 * crackDir.at(0 + k) * length;
613  q [ 0 ].y = ( FPNum ) gpc.at(2) + 0.5 * crackDir.at(3 + j) * length + 0.5 * crackDir.at(3 + k) * length;
614  q [ 0 ].z = ( FPNum ) gpc.at(3) + 0.5 * crackDir.at(6 + j) * length + 0.5 * crackDir.at(6 + k) * length;
615  q [ 1 ].x = ( FPNum ) gpc.at(1) + 0.5 * crackDir.at(0 + j) * length - 0.5 * crackDir.at(0 + k) * length;
616  q [ 1 ].y = ( FPNum ) gpc.at(2) + 0.5 * crackDir.at(3 + j) * length - 0.5 * crackDir.at(3 + k) * length;
617  q [ 1 ].z = ( FPNum ) gpc.at(3) + 0.5 * crackDir.at(6 + j) * length - 0.5 * crackDir.at(6 + k) * length;
618  q [ 2 ].x = ( FPNum ) gpc.at(1) - 0.5 * crackDir.at(0 + j) * length - 0.5 * crackDir.at(0 + k) * length;
619  q [ 2 ].y = ( FPNum ) gpc.at(2) - 0.5 * crackDir.at(3 + j) * length - 0.5 * crackDir.at(3 + k) * length;
620  q [ 2 ].z = ( FPNum ) gpc.at(3) - 0.5 * crackDir.at(6 + j) * length - 0.5 * crackDir.at(6 + k) * length;
621  q [ 3 ].x = ( FPNum ) gpc.at(1) - 0.5 * crackDir.at(0 + j) * length + 0.5 * crackDir.at(0 + k) * length;
622  q [ 3 ].y = ( FPNum ) gpc.at(2) - 0.5 * crackDir.at(3 + j) * length + 0.5 * crackDir.at(3 + k) * length;
623  q [ 3 ].z = ( FPNum ) gpc.at(3) - 0.5 * crackDir.at(6 + j) * length + 0.5 * crackDir.at(6 + k) * length;
624 
625  EASValsSetLayer(OOFEG_CRACK_PATTERN_LAYER);
626  EASValsSetLineWidth(OOFEG_CRACK_PATTERN_WIDTH);
627  if ( ( crackStatus == pscm_SOFTENING ) || ( crackStatus == pscm_OPEN ) ) {
628  EASValsSetColor( gc.getActiveCrackColor() );
629  } else {
630  EASValsSetColor( gc.getCrackPatternColor() );
631  }
632 
633  // EASValsSetFillStyle (FILL_HOLLOW);
634  tr = CreateQuad3D(q);
635  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, tr);
636  EMAddGraphicsToModel(ESIModel(), tr);
637  }
638  }
639  }
640  } // end loop over gp
641  }
642 }
643 
644 #endif
645 
646 
647 
650 {
651  IntegrationRule *iRule = new GaussIntegrationRule(1, this, 1, 1);
652  int npoints = iRule->getRequiredNumberOfIntegrationPoints(_Square, approxOrder);
653  iRule->SetUpPointsOnSquare(npoints, _Unknown);
654  return iRule;
655 }
656 
657 
658 int
660 {
661  // returns transformation matrix from
662  // surface local coordinate system
663  // to element local c.s
664  // (same as global c.s in this case)
665  //
666  // i.e. f(element local) = T * f(edge local)
667 
668  // definition of local c.s on surface:
669  // local z axis - perpendicular to surface, pointing outwards from element
670  // local x axis - is in global xy plane (perpendicular to global z axis)
671  // local y axis - completes the righ hand side cs.
672 
673  /*
674  * OOFEM_ERROR("surface local coordinate system not supported");
675  * return 1;
676  */
677  FloatArray gc(3);
678  FloatArray h1(3), h2(3), nn(3), n(3);
679  IntArray snodes(4);
680 
681  answer.resize(3, 3);
682 
683  this->interpolation.computeSurfaceMapping(snodes, dofManArray, isurf);
684  for ( int i = 1; i <= 4; i++ ) {
685  gc.add( * domain->giveNode( snodes.at(i) )->giveCoordinates() );
686  }
687 
688  gc.times(1. / 4.);
689  // determine "average normal"
690  for ( int i = 1; i <= 4; i++ ) {
691  int j = ( i ) % 4 + 1;
692  h1 = * domain->giveNode( snodes.at(i) )->giveCoordinates();
693  h1.subtract(gc);
694  h2 = * domain->giveNode( snodes.at(j) )->giveCoordinates();
695  h2.subtract(gc);
696  n.beVectorProductOf(h1, h2);
697  if ( n.computeSquaredNorm() > 1.e-6 ) {
698  n.normalize();
699  }
700 
701  nn.add(n);
702  }
703 
704  nn.times(1. / 4.);
705  if ( nn.computeSquaredNorm() < 1.e-6 ) {
706  answer.zero();
707  return 1;
708  }
709 
710  nn.normalize();
711  for ( int i = 1; i <= 3; i++ ) {
712  answer.at(i, 3) = nn.at(i);
713  }
714 
715  // determine lcs of surface
716  // local x axis in xy plane
717  double test = fabs(fabs( nn.at(3) ) - 1.0);
718  if ( test < 1.e-5 ) {
719  h1.at(1) = answer.at(1, 1) = 1.0;
720  h1.at(2) = answer.at(2, 1) = 0.0;
721  } else {
722  h1.at(1) = answer.at(1, 1) = answer.at(2, 3);
723  h1.at(2) = answer.at(2, 1) = -answer.at(1, 3);
724  }
725 
726  h1.at(3) = answer.at(3, 1) = 0.0;
727  // local y axis perpendicular to local x,z axes
728  h2.beVectorProductOf(nn, h1);
729  for ( int i = 1; i <= 3; i++ ) {
730  answer.at(i, 2) = h2.at(i);
731  }
732 
733  return 1;
734 }
735 } // end namespace oofem
int testElementGraphicActivity(Element *)
Test if particular element passed fulfills various filtering criteria for its graphics output...
InternalStateType
Type representing the physical meaning of element or constitutive model internal variable.
virtual void drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
Definition: lspace.C:505
The element interface required by NodalAvergagingRecoveryModel.
IntArray dofManArray
Array containing dofmanager numbers.
Definition: element.h:151
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.
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
ScalarAlgorithmType getScalarAlgo()
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition: femcmpnn.h:82
bool solveForRhs(const FloatArray &b, FloatArray &answer, bool transpose=false)
Solves the system of linear equations .
Definition: floatmatrix.C:1112
virtual void drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType type)
Definition: lspace.C:476
The element interface required by ZZNodalRecoveryModel.
const FloatArray & giveSubPatchCoordinates()
Returns local sub-patch coordinates of the receiver.
Definition: gausspoint.h:144
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 pscm_CLOSED
Definition: fcm.h:58
void computeSurfaceMapping(IntArray &surfNodes, IntArray &elemNodes, int isurf)
Definition: feinterpol3d.C:103
virtual Interface * giveInterface(InterfaceType it)
Interface requesting service.
Definition: lspace.C:72
#define OOFEG_RAW_GEOMETRY_LAYER
#define pscm_NONE
Definition: fcm.h:54
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
void setupRefinedElementProblem3D(Element *element, RefinedElement *refinedElement, int level, int nodeId, IntArray &localNodeIdArray, IntArray &globalNodeIdArray, HuertaErrorEstimatorInterface::SetupMode mode, TimeStep *tStep, int nodes, FloatArray **corner, FloatArray *midSide, FloatArray *midFace, FloatArray &midNode, int &localNodeId, int &localElemId, int &localBcId, int hexaSideNode[1][3], int hexaFaceNode[1][3], IntArray &controlNode, IntArray &controlDof, HuertaErrorEstimator::AnalysisMode aMode, const char *hexatype)
virtual void drawSpecial(oofegGraphicContext &gc, TimeStep *tStep)
Definition: lspace.C:561
virtual void SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap)
Definition: lspace.C:99
LSpace(int n, Domain *d)
Definition: lspace.C:59
virtual int SetUpPointsOnSquare(int, MaterialMode mode)
Sets up receiver&#39;s integration points on unit square integration domain.
virtual double giveCoordinate(int i)
Definition: node.C:82
virtual void computeNmatrixAt(const FloatArray &iLocCoord, FloatMatrix &answer)
Computes interpolation matrix for element unknowns.
Class implementing an array of integers.
Definition: intarray.h:61
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: lspace.C:91
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
#define OOFEG_DEFORMED_GEOMETRY_LAYER
Abstract base class representing integration rule.
virtual int SPRNodalRecoveryMI_giveNumberOfIP()
Definition: lspace.C:129
Class representing a general abstraction for finite element interpolation class.
Definition: feinterpol.h:132
virtual void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
Definition: lspace.C:336
InternalStateType giveIntVarType()
#define OOFEG_CRACK_PATTERN_LAYER
#define pscm_OPEN
Definition: rcm2.h:61
double dotProduct(const FloatArray &x) const
Computes the dot product (or inner product) of receiver and argument.
Definition: floatarray.C:463
The element interface corresponding to HuertaErrorEstimator.
#define OOFEM_ERROR(...)
Definition: error.h:61
REGISTER_Element(LSpace)
double computeSquaredNorm() const
Computes the square of the norm.
Definition: floatarray.C:846
#define OOFEG_RAW_GEOMETRY_WIDTH
UnknownType
Type representing particular unknown (its physical meaning).
Definition: unknowntype.h:55
#define OOFEG_CRACK_PATTERN_WIDTH
virtual void NodalAveragingRecoveryMI_computeNodalValue(FloatArray &answer, int node, InternalStateType type, TimeStep *tStep)
Computes the element value in given node.
Definition: lspace.C:143
virtual double giveUpdatedCoordinate(int ic, TimeStep *tStep, double scale=1.)
Returns updated ic-th coordinate of receiver.
Definition: node.C:245
virtual int computeLoadLSToLRotationMatrix(FloatMatrix &answer, int iSurf, GaussPoint *gp)
Returns transformation matrix from local surface c.s to element local coordinate system of load vecto...
Definition: lspace.C:659
virtual void HuertaErrorEstimatorI_setupRefinedElementProblem(RefinedElement *refinedElement, int level, int nodeId, IntArray &localNodeIdArray, IntArray &globalNodeIdArray, HuertaErrorEstimatorInterface::SetupMode sMode, TimeStep *tStep, int &localNodeId, int &localElemId, int &localBcId, IntArray &controlNode, IntArray &controlDof, HuertaErrorEstimator::AnalysisMode aMode)
Definition: lspace.C:250
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
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 HuertaErrorEstimatorI_computeNmatrixAt(GaussPoint *gp, FloatMatrix &answer)
Definition: lspace.C:327
Class representing vector of real numbers.
Definition: floatarray.h:82
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
double cbrt(double x)
Returns the cubic root of x.
Definition: mathfem.h:109
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
virtual int getRequiredNumberOfIntegrationPoints(integrationDomain dType, int approxOrder)
Abstract service.
Class Interface.
Definition: interface.h:82
int giveNumberOfIntegrationPoints() const
Returns number of integration points of receiver.
Base class 3D elements.
virtual FEInterpolation * giveInterpolation() const
Definition: lspace.C:69
#define OOFEG_DEFORMED_GEOMETRY_WIDTH
void drawTriad(FloatArray &, int isurf)
Definition: lspace.C:380
void times(double s)
Multiplies receiver with scalar.
Definition: floatarray.C:818
The spatial localizer element interface associated to spatial localizer.
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
static FEI3dHexaLin interpolation
Definition: lspace.h:66
virtual FloatArray * giveCoordinates()
Definition: node.h:114
void zero()
Zeroes all coefficient of receiver.
Definition: floatmatrix.C:1326
InterfaceType
Enumerative type, used to identify interface type.
Definition: interfacetype.h:43
virtual double computeVolumeAround(GaussPoint *gp)
Returns volume related to given integration point.
virtual void SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
Definition: lspace.C:109
void updateFringeTableMinMax(double *s, int size)
int giveSize() const
Returns the size of receiver.
Definition: floatarray.h:218
Node * giveNode(int n)
Service for accessing particular domain node.
Definition: domain.h:371
virtual SPRPatchType SPRNodalRecoveryMI_givePatchType()
Definition: lspace.C:136
the oofem namespace is to define a context or scope in which all oofem names are defined.
int giveNumber() const
Definition: femcmpnn.h:107
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
virtual IntegrationRule * GetSurfaceIntegrationRule(int iSurf)
Definition: lspace.C:649
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
#define pscm_SOFTENING
Definition: fcm.h:56
#define OOFEG_VARPLOT_PATTERN_LAYER
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80
virtual int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords)
Computes the global coordinates from given element&#39;s local coordinates.
Definition: element.C:1207
int numberOfDofMans
Number of dofmanagers.
Definition: element.h:149
void add(const FloatArray &src)
Adds array src to receiver.
Definition: floatarray.C:156
Class representing Gaussian-quadrature integration rule.
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