288LSpace :: HuertaErrorEstimatorI_setupRefinedElementProblem(
RefinedElement *refinedElement,
int level,
int nodeId,
290 HuertaErrorEstimatorInterface :: SetupMode sMode,
TimeStep *tStep,
291 int &localNodeId,
int &localElemId,
int &localBcId,
293 HuertaErrorEstimator :: AnalysisMode aMode)
295 double x = 0.0, y = 0.0, z = 0.0;
296 int nodes = 8, sides = 12, faces = 6;
298 static int sideNode [ 12 ] [ 2 ] = { { 1, 2 }, { 2, 3 }, { 3, 4 }, { 4, 1 },
299 { 5, 6 }, { 6, 7 }, { 7, 8 }, { 8, 5 },
300 { 1, 5 }, { 2, 6 }, { 3, 7 }, { 4, 8 } };
301 static int faceNode [ 6 ] [ 4 ] = { { 1, 2, 3, 4 }, { 5, 6, 7, 8 },
302 { 1, 2, 6, 5 }, { 2, 3, 7, 6 }, { 3, 4, 8, 7 }, { 4, 1, 5, 8 } };
308 static int hexaSideNode [ 8 ] [ 3 ] = { { 1, 4, 9 }, { 2, 1, 10 }, { 3, 2, 11 }, { 4, 3, 12 },
309 { 8, 5, 9 }, { 5, 6, 10 }, { 6, 7, 11 }, { 7, 8, 12 } };
310 static int hexaFaceNode [ 8 ] [ 3 ] = { { 1, 3, 6 }, { 1, 4, 3 }, { 1, 5, 4 }, { 1, 6, 5 },
311 { 2, 6, 3 }, { 2, 3, 4 }, { 2, 4, 5 }, { 2, 5, 6 } };
313 FloatArray corner [ 8 ], midSide [ 12 ], midFace [ 6 ], midNode;
314 if ( sMode == HuertaErrorEstimatorInterface :: NodeMode ||
315 ( sMode == HuertaErrorEstimatorInterface :: BCMode && aMode == HuertaErrorEstimator :: HEE_linear ) ) {
316 for (
int inode = 0; inode < nodes; inode++ ) {
317 corner [ inode ] = this->
giveNode(inode + 1)->giveCoordinates();
319 x += corner [ inode ].
at(1);
320 y += corner [ inode ].
at(2);
321 z += corner [ inode ].
at(3);
324 for (
int iside = 0; iside < sides; iside++ ) {
325 midSide [ iside ].
resize(3);
327 int nd1 = sideNode [ iside ] [ 0 ] - 1;
328 int nd2 = sideNode [ iside ] [ 1 ] - 1;
330 midSide [ iside ].
at(1) = ( corner [ nd1 ].
at(1) + corner [ nd2 ].at(1) ) / 2.0;
331 midSide [ iside ].
at(2) = ( corner [ nd1 ].
at(2) + corner [ nd2 ].at(2) ) / 2.0;
332 midSide [ iside ].
at(3) = ( corner [ nd1 ].
at(3) + corner [ nd2 ].at(3) ) / 2.0;
337 midNode.
at(1) = x / nodes;
338 midNode.
at(2) = y / nodes;
339 midNode.
at(3) = z / nodes;
341 for (
int iface = 0; iface < faces; iface++ ) {
343 for (
int inode = 0; inode < 4; inode++ ) {
344 int nd = faceNode [ iface ] [ inode ] - 1;
345 x += corner [ nd ].
at(1);
346 y += corner [ nd ].
at(2);
347 z += corner [ nd ].
at(3);
350 midFace [ iface ].
resize(3);
352 midFace [ iface ].
at(1) = x / 4;
353 midFace [ iface ].
at(2) = y / 4;
354 midFace [ iface ].
at(3) = z / 4;
359 sMode, tStep, nodes, corner, midSide, midFace, midNode,
360 localNodeId, localElemId, localBcId, hexaSideNode, hexaFaceNode,
361 controlNode, controlDof, aMode,
"LSpace");
379 if ( !
gc.testElementGraphicActivity(
this) ) {
384 EASValsSetColor(
gc.getElementColor() );
385 EASValsSetEdgeColor(
gc.getElementEdgeColor() );
386 EASValsSetEdgeFlag(
true);
388 EASValsSetFillStyle(FILL_SOLID);
389 for (
int i = 0; i < 8; i++ ) {
390 p [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(1);
391 p [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(2);
392 p [ i ].z = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(3);
395 go = CreateHexahedron(p);
396 EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
397 EGAttachObject(go, ( EObjectP )
this);
398 EMAddGraphicsToModel(ESIModel(), go);
441 const char *colors[] = {
442 "red",
"green",
"blue"
447 for ( i = 1; i <= 4; i++ ) {
448 gc.add(
domain->giveNode( snodes.
at(i) )->giveCoordinates() );
454 for ( i = 1; i <= 4; i++ ) {
456 h1 =
domain->giveNode( snodes.
at(i) )->giveCoordinates();
458 h2 =
domain->giveNode( snodes.
at(j) )->giveCoordinates();
469 if ( nn.dotProduct(nn, 3) < 1.e-6 ) {
474 for ( i = 1; i <= 3; i++ ) {
475 jm.
at(i, 3) = nn.at(i);
480 double test = fabs(fabs( nn.at(3) ) - 1.0);
481 if ( test < 1.e-5 ) {
482 h1.at(1) = jm.
at(1, 1) = 1.0;
483 h1.at(2) = jm.
at(2, 1) = 0.0;
485 h1.at(1) = jm.
at(1, 1) = jm.
at(2, 3);
486 h1.at(2) = jm.
at(2, 1) = -jm.
at(1, 3);
489 h1.at(3) = jm.
at(3, 1) = 0.0;
491 h2.beVectorProductOf(nn, h1);
492 for ( i = 1; i <= 3; i++ ) {
493 jm.
at(i, 2) = h2.at(i);
497 p [ 0 ].x =
gc.at(1);
498 p [ 0 ].y =
gc.at(2);
499 p [ 0 ].z =
gc.at(3);
500 for ( i = 1; i <= 3; i++ ) {
501 p [ 1 ].x = p [ 0 ].x + coeff *jm.
at(1, i);
502 p [ 1 ].y = p [ 0 ].y + coeff *jm.
at(2, i);
503 p [ 1 ].z = p [ 0 ].z + coeff *jm.
at(3, i);
505 EASValsSetColor( ColorGetPixelFromString(
const_cast< char *
>(colors [ i - 1 ]), & succ) );
507 go = CreateLine3D(p);
508 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
509 EMAddGraphicsToModel(ESIModel(), go);
519 double defScale =
gc.getDefScale();
521 if ( !
gc.testElementGraphicActivity(
this) ) {
526 EASValsSetColor(
gc.getDeformedElementColor() );
527 EASValsSetEdgeColor(
gc.getElementEdgeColor() );
528 EASValsSetEdgeFlag(
true);
530 EASValsSetFillStyle(FILL_SOLID);
531 for ( i = 0; i < 8; i++ ) {
532 p [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
533 p [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
534 p [ i ].z = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(3, tStep, defScale);
537 go = CreateHexahedron(p);
538 EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
539 EMAddGraphicsToModel(ESIModel(), go);
545 int i, indx, result = 0;
549 double s [ 8 ], defScale = 0.0;
551 if ( !
gc.testElementGraphicActivity(
this) ) {
556 for ( i = 1; i <= 8; i++ ) {
567 indx =
gc.giveIntVarIndx();
569 for ( i = 1; i <= 8; i++ ) {
570 s [ i - 1 ] = v [ i - 1 ].
at(indx);
573 EASValsSetEdgeColor(
gc.getElementEdgeColor() );
574 EASValsSetEdgeFlag(
true);
577 for ( i = 0; i < 8; i++ ) {
578 if (
gc.getInternalVarsDefGeoFlag() ) {
580 defScale =
gc.getDefScale();
581 p [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
582 p [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
583 p [ i ].z = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(3, tStep, defScale);
585 p [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(1);
586 p [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(2);
587 p [ i ].z = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(3);
591 gc.updateFringeTableMinMax(s, 8);
592 tr = CreateHexahedronWD(p, s);
593 EGWithMaskChangeAttributes(LAYER_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK, tr);
594 EMAddGraphicsToModel(ESIModel(), tr);
606 if ( !
gc.testElementGraphicActivity(
this) ) {
610 if (
gc.giveIntVarType() == IST_CrackState ) {
617 if ( this->
giveIPValue(cf, gp, IST_CrackedFlag, tStep) == 0 ) {
621 if ( (
int ) cf.
at(1) == 0 ) {
629 if ( this->
giveIPValue(crackDir, gp, IST_CrackDirs, tStep) ) {
630 this->
giveIPValue(crackStatuses, gp, IST_CrackStatuses, tStep);
633 for ( i = 1; i <= 3; i++ ) {
634 crackStatus = ( int ) crackStatuses.
at(i);
642 }
else if ( i == 2 ) {
650 q [ 0 ].x = ( FPNum ) gpc.
at(1) + 0.5 * crackDir.
at(0 + j) *
length + 0.5 * crackDir.
at(0 + k) *
length;
651 q [ 0 ].y = ( FPNum ) gpc.
at(2) + 0.5 * crackDir.
at(3 + j) *
length + 0.5 * crackDir.
at(3 + k) *
length;
652 q [ 0 ].z = ( FPNum ) gpc.
at(3) + 0.5 * crackDir.
at(6 + j) *
length + 0.5 * crackDir.
at(6 + k) *
length;
653 q [ 1 ].x = ( FPNum ) gpc.
at(1) + 0.5 * crackDir.
at(0 + j) *
length - 0.5 * crackDir.
at(0 + k) *
length;
654 q [ 1 ].y = ( FPNum ) gpc.
at(2) + 0.5 * crackDir.
at(3 + j) *
length - 0.5 * crackDir.
at(3 + k) *
length;
655 q [ 1 ].z = ( FPNum ) gpc.
at(3) + 0.5 * crackDir.
at(6 + j) *
length - 0.5 * crackDir.
at(6 + k) *
length;
656 q [ 2 ].x = ( FPNum ) gpc.
at(1) - 0.5 * crackDir.
at(0 + j) *
length - 0.5 * crackDir.
at(0 + k) *
length;
657 q [ 2 ].y = ( FPNum ) gpc.
at(2) - 0.5 * crackDir.
at(3 + j) *
length - 0.5 * crackDir.
at(3 + k) *
length;
658 q [ 2 ].z = ( FPNum ) gpc.
at(3) - 0.5 * crackDir.
at(6 + j) *
length - 0.5 * crackDir.
at(6 + k) *
length;
659 q [ 3 ].x = ( FPNum ) gpc.
at(1) - 0.5 * crackDir.
at(0 + j) *
length + 0.5 * crackDir.
at(0 + k) *
length;
660 q [ 3 ].y = ( FPNum ) gpc.
at(2) - 0.5 * crackDir.
at(3 + j) *
length + 0.5 * crackDir.
at(3 + k) *
length;
661 q [ 3 ].z = ( FPNum ) gpc.
at(3) - 0.5 * crackDir.
at(6 + j) *
length + 0.5 * crackDir.
at(6 + k) *
length;
666 EASValsSetColor(
gc.getActiveCrackColor() );
668 EASValsSetColor(
gc.getCrackPatternColor() );
672 tr = CreateQuad3D(q);
673 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, tr);
674 EMAddGraphicsToModel(ESIModel(), tr);
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)
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]