271PlaneStress2d :: HuertaErrorEstimatorI_setupRefinedElementProblem(
RefinedElement *refinedElement,
int level,
int nodeId,
273 HuertaErrorEstimatorInterface :: SetupMode sMode,
TimeStep *tStep,
274 int &localNodeId,
int &localElemId,
int &localBcId,
276 HuertaErrorEstimator :: AnalysisMode aMode)
278 int nodes = 4, sides = 4;
279 double x = 0.0, y = 0.0;
281 static int sideNode [ 4 ] [ 2 ] = { { 1, 2 }, { 2, 3 }, { 3, 4 }, { 4, 1 } };
283 FloatArray corner [ 4 ], midSide [ 4 ], midNode, cor [ 4 ];
284 if ( sMode == HuertaErrorEstimatorInterface :: NodeMode ||
285 ( sMode == HuertaErrorEstimatorInterface :: BCMode && aMode == HuertaErrorEstimator :: HEE_linear ) ) {
286 for (
int inode = 0; inode < nodes; inode++ ) {
287 corner [ inode ] = this->
giveNode(inode + 1)->giveCoordinates();
288 if ( corner [ inode ].giveSize() != 3 ) {
290 cor [ inode ].
at(1) = corner [ inode ].
at(1);
291 cor [ inode ].
at(2) = corner [ inode ].
at(2);
292 cor [ inode ].
at(3) = 0.0;
294 corner [ inode ] = cor [ inode ];
297 x += corner [ inode ].
at(1);
298 y += corner [ inode ].
at(2);
301 for (
int iside = 0; iside < sides; iside++ ) {
302 midSide [ iside ].
resize(3);
304 int nd1 = sideNode [ iside ] [ 0 ] - 1;
305 int nd2 = sideNode [ iside ] [ 1 ] - 1;
307 midSide [ iside ].
at(1) = ( corner [ nd1 ].
at(1) + corner [ nd2 ].at(1) ) / 2.0;
308 midSide [ iside ].
at(2) = ( corner [ nd1 ].
at(2) + corner [ nd2 ].at(2) ) / 2.0;
309 midSide [ iside ].
at(3) = 0.0;
314 midNode.
at(1) = x / nodes;
315 midNode.
at(2) = y / nodes;
320 sMode, tStep, nodes, corner, midSide, midNode,
321 localNodeId, localElemId, localBcId,
322 controlNode, controlDof, aMode,
"PlaneStress2d");
339 if ( !
gc.testElementGraphicActivity(
this) ) {
344 EASValsSetColor(
gc.getElementColor() );
345 EASValsSetEdgeColor(
gc.getElementEdgeColor() );
346 EASValsSetEdgeFlag(
true);
348 EASValsSetFillStyle(FILL_HOLLOW);
349 p [ 0 ].x = ( FPNum ) this->
giveNode(1)->giveCoordinate(1);
350 p [ 0 ].y = ( FPNum ) this->
giveNode(1)->giveCoordinate(2);
351 p [ 0 ].z = ( FPNum ) this->
giveNode(1)->giveCoordinate(3);
352 p [ 1 ].x = ( FPNum ) this->
giveNode(2)->giveCoordinate(1);
353 p [ 1 ].y = ( FPNum ) this->
giveNode(2)->giveCoordinate(2);
354 p [ 1 ].z = ( FPNum ) this->
giveNode(2)->giveCoordinate(3);
355 p [ 2 ].x = ( FPNum ) this->
giveNode(3)->giveCoordinate(1);
356 p [ 2 ].y = ( FPNum ) this->
giveNode(3)->giveCoordinate(2);
357 p [ 2 ].z = ( FPNum ) this->
giveNode(3)->giveCoordinate(3);
358 p [ 3 ].x = ( FPNum ) this->
giveNode(4)->giveCoordinate(1);
359 p [ 3 ].y = ( FPNum ) this->
giveNode(4)->giveCoordinate(2);
360 p [ 3 ].z = ( FPNum ) this->
giveNode(4)->giveCoordinate(3);
362 go = CreateQuad3D(p);
363 EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
364 EGAttachObject(go, ( EObjectP )
this);
365 EMAddGraphicsToModel(ESIModel(), go);
373 double defScale =
gc.getDefScale();
375 if ( !
gc.testElementGraphicActivity(
this) ) {
380 EASValsSetColor(
gc.getDeformedElementColor() );
381 EASValsSetEdgeColor(
gc.getElementEdgeColor() );
382 EASValsSetEdgeFlag(
true);
384 EASValsSetFillStyle(FILL_HOLLOW);
385 p [ 0 ].x = ( FPNum ) this->
giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale);
386 p [ 0 ].y = ( FPNum ) this->
giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale);
387 p [ 0 ].z = ( FPNum ) this->
giveNode(1)->giveUpdatedCoordinate(3, tStep, defScale);
388 p [ 1 ].x = ( FPNum ) this->
giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale);
389 p [ 1 ].y = ( FPNum ) this->
giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale);
390 p [ 1 ].z = ( FPNum ) this->
giveNode(2)->giveUpdatedCoordinate(3, tStep, defScale);
391 p [ 2 ].x = ( FPNum ) this->
giveNode(3)->giveUpdatedCoordinate(1, tStep, defScale);
392 p [ 2 ].y = ( FPNum ) this->
giveNode(3)->giveUpdatedCoordinate(2, tStep, defScale);
393 p [ 2 ].z = ( FPNum ) this->
giveNode(3)->giveUpdatedCoordinate(3, tStep, defScale);
394 p [ 3 ].x = ( FPNum ) this->
giveNode(4)->giveUpdatedCoordinate(1, tStep, defScale);
395 p [ 3 ].y = ( FPNum ) this->
giveNode(4)->giveUpdatedCoordinate(2, tStep, defScale);
396 p [ 3 ].z = ( FPNum ) this->
giveNode(4)->giveUpdatedCoordinate(3, tStep, defScale);
398 go = CreateQuad3D(p);
399 EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
400 EMAddGraphicsToModel(ESIModel(), go);
407 int i, indx, result = 0;
411 double s [ 4 ], defScale;
413 if ( !
gc.testElementGraphicActivity(
this) ) {
419 for ( i = 1; i <= 4; i++ ) {
427 indx =
gc.giveIntVarIndx();
429 for ( i = 1; i <= 4; i++ ) {
430 s [ i - 1 ] = v [ i - 1 ].
at(indx);
434 for ( i = 0; i < 4; i++ ) {
435 if (
gc.getInternalVarsDefGeoFlag() ) {
437 defScale =
gc.getDefScale();
438 p [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
439 p [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
442 p [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(1);
443 p [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(2);
449 gc.updateFringeTableMinMax(s, 4);
450 tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
451 EGWithMaskChangeAttributes(LAYER_MASK, tr);
452 EMAddGraphicsToModel(ESIModel(), tr);
478 double landScale =
gc.getLandScale();
480 for ( i = 0; i < 4; i++ ) {
481 if (
gc.getInternalVarsDefGeoFlag() ) {
483 defScale =
gc.getDefScale();
484 p [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
485 p [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
486 p [ i ].z = s [ i ] * landScale;
488 p [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(1);
489 p [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(2);
490 p [ i ].z = s [ i ] * landScale;
494 if ( fabs(s [ i ]) < 1.0e-6 ) {
500 EASValsSetColor(
gc.getDeformedElementColor() );
502 tr = CreateQuad3D(p);
503 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, tr);
505 gc.updateFringeTableMinMax(s, 4);
506 tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
507 EGWithMaskChangeAttributes(LAYER_MASK, tr);
510 EMAddGraphicsToModel(ESIModel(), tr);
520 for ( i = 0; i < 4; i++ ) {
521 if (
gc.getInternalVarsDefGeoFlag() ) {
523 defScale =
gc.getDefScale();
524 pp [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
525 pp [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
526 pp [ i ].z = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(3, tStep, defScale);
528 pp [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(1);
529 pp [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(2);
530 pp [ i ].z = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(3);
534 for ( i = 0; i < 3; i++ ) {
535 pp [ i + 4 ].x = 0.5 * ( pp [ i ].x + pp [ i + 1 ].x );
536 pp [ i + 4 ].y = 0.5 * ( pp [ i ].y + pp [ i + 1 ].y );
537 pp [ i + 4 ].z = 0.5 * ( pp [ i ].z + pp [ i + 1 ].z );
540 pp [ 7 ].x = 0.5 * ( pp [ 3 ].x + pp [ 0 ].x );
541 pp [ 7 ].y = 0.5 * ( pp [ 3 ].y + pp [ 0 ].y );
542 pp [ 7 ].z = 0.5 * ( pp [ 3 ].z + pp [ 0 ].z );
544 pp [ 8 ].x = 0.25 * ( pp [ 0 ].x + pp [ 1 ].x + pp [ 2 ].x + pp [ 3 ].x );
545 pp [ 8 ].y = 0.25 * ( pp [ 0 ].y + pp [ 1 ].y + pp [ 2 ].y + pp [ 3 ].y );
546 pp [ 8 ].z = 0.25 * ( pp [ 0 ].z + pp [ 1 ].z + pp [ 2 ].z + pp [ 3 ].z );
549 const FloatArray& gpCoords = gp->giveNaturalCoordinates();
550 if ( ( gpCoords.
at(1) > 0. ) && ( gpCoords.
at(2) > 0. ) ) {
555 }
else if ( ( gpCoords.
at(1) < 0. ) && ( gpCoords.
at(2) > 0. ) ) {
560 }
else if ( ( gpCoords.
at(1) < 0. ) && ( gpCoords.
at(2) < 0. ) ) {
572 if (
giveIPValue(v [ 0 ], gp,
gc.giveIntVarType(), tStep) == 0 ) {
576 indx =
gc.giveIntVarIndx();
578 for ( i = 1; i <= 4; i++ ) {
579 s [ i - 1 ] = v [ 0 ].
at(indx);
582 for ( i = 0; i < 4; i++ ) {
583 p [ i ].x = pp [ ind.
at(i + 1) ].x;
584 p [ i ].y = pp [ ind.
at(i + 1) ].y;
585 p [ i ].z = pp [ ind.
at(i + 1) ].z;
588 gc.updateFringeTableMinMax(s, 4);
589 tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
590 EGWithMaskChangeAttributes(LAYER_MASK, tr);
591 EMAddGraphicsToModel(ESIModel(), tr);
605 double defScale =
gc.getDefScale();
608 if ( !
gc.testElementGraphicActivity(
this) ) {
612 if (
gc.giveIntVarType() == IST_CrackState ) {
621 if ( this->
giveIPValue(cf, gp, IST_CrackedFlag, tStep) == 0 ) {
625 if ( (
int ) cf.
at(1) == 0 ) {
629 if ( this->
giveIPValue(crackDir, gp, IST_CrackDirs, tStep) ) {
630 this->
giveIPValue(crackStatuses, gp, IST_CrackStatuses, tStep);
631 for ( i = 1; i <= 3; i++ ) {
632 crackStatus = ( int ) crackStatuses.
at(i);
639 ay = crackDir.
at(3 + i);
640 if ( fabs(ax) > 1.e-6 ) {
643 norm = sqrt(bx * bx + by * by);
652 if (
gc.getInternalVarsDefGeoFlag() ) {
653 double ksi, eta, n1, n2, n3, n4;
654 ksi = gp->giveNaturalCoordinate(1);
655 eta = gp->giveNaturalCoordinate(2);
657 n1 = ( 1. + ksi ) * ( 1. + eta ) * 0.25;
658 n2 = ( 1. - ksi ) * ( 1. + eta ) * 0.25;
659 n3 = ( 1. - ksi ) * ( 1. - eta ) * 0.25;
660 n4 = ( 1. + ksi ) * ( 1. - eta ) * 0.25;
664 gpglobalcoords.
at(1) = ( n1 * this->
giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale) +
665 n2 * this->
giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale) +
666 n3 * this->
giveNode(3)->giveUpdatedCoordinate(1, tStep, defScale) +
667 n4 * this->
giveNode(4)->giveUpdatedCoordinate(1, tStep, defScale) );
668 gpglobalcoords.
at(2) = ( n1 * this->
giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale) +
669 n2 * this->
giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale) +
670 n3 * this->
giveNode(3)->giveUpdatedCoordinate(2, tStep, defScale) +
671 n4 * this->
giveNode(4)->giveUpdatedCoordinate(2, tStep, defScale) );
676 xc = gpglobalcoords.
at(1);
677 yc = gpglobalcoords.
at(2);
679 l [ 0 ].x = ( FPNum ) xc + bx *
length;
680 l [ 0 ].y = ( FPNum ) yc + by *
length;
682 l [ 1 ].x = ( FPNum ) xc - bx *
length;
683 l [ 1 ].y = ( FPNum ) yc - by *
length;
688 EASValsSetColor(
gc.getActiveCrackColor() );
690 EASValsSetColor(
gc.getCrackPatternColor() );
693 tr = CreateLine3D(l);
694 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, tr);
695 EMAddGraphicsToModel(ESIModel(), tr);
void setupRefinedElementProblem2D(Element *element, RefinedElement *refinedElement, int level, int nodeId, IntArray &localNodeIdArray, IntArray &globalNodeIdArray, HuertaErrorEstimatorInterface ::SetupMode mode, TimeStep *tStep, int nodes, FloatArray *corner, FloatArray *midSide, FloatArray &midNode, int &localNodeId, int &localElemId, int &localBcId, IntArray &controlNode, IntArray &controlDof, HuertaErrorEstimator ::AnalysisMode aMode, const char *quadtype)
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]