183Quad1PlaneStrain :: HuertaErrorEstimatorI_setupRefinedElementProblem(
RefinedElement *refinedElement,
int level,
int nodeId,
185 HuertaErrorEstimatorInterface :: SetupMode sMode,
TimeStep *tStep,
186 int &localNodeId,
int &localElemId,
int &localBcId,
188 HuertaErrorEstimator :: AnalysisMode aMode)
190 int nodes = 4, sides = 4;
191 double x = 0.0, y = 0.0;
193 static int sideNode [ 4 ] [ 2 ] = { { 1, 2 }, { 2, 3 }, { 3, 4 }, { 4, 1 } };
195 FloatArray corner [ 4 ], midSide [ 4 ], midNode, cor [ 4 ];
196 if ( sMode == HuertaErrorEstimatorInterface :: NodeMode ||
197 ( sMode == HuertaErrorEstimatorInterface :: BCMode && aMode == HuertaErrorEstimator :: HEE_linear ) ) {
198 for (
int inode = 0; inode < nodes; inode++ ) {
199 corner [ inode ] = this->
giveNode(inode + 1)->giveCoordinates();
200 if ( corner [ inode ].giveSize() != 3 ) {
202 cor [ inode ].
at(1) = corner [ inode ].
at(1);
203 cor [ inode ].
at(2) = corner [ inode ].
at(2);
204 cor [ inode ].
at(3) = 0.0;
206 corner [ inode ] = cor [ inode ];
209 x += corner [ inode ].
at(1);
210 y += corner [ inode ].
at(2);
213 for (
int iside = 0; iside < sides; iside++ ) {
214 midSide [ iside ].
resize(3);
216 int nd1 = sideNode [ iside ] [ 0 ] - 1;
217 int nd2 = sideNode [ iside ] [ 1 ] - 1;
219 midSide [ iside ].
at(1) = ( corner [ nd1 ].
at(1) + corner [ nd2 ].at(1) ) / 2.0;
220 midSide [ iside ].
at(2) = ( corner [ nd1 ].
at(2) + corner [ nd2 ].at(2) ) / 2.0;
221 midSide [ iside ].
at(3) = 0.0;
226 midNode.
at(1) = x / nodes;
227 midNode.
at(2) = y / nodes;
232 sMode, tStep, nodes, corner, midSide, midNode,
233 localNodeId, localElemId, localBcId,
234 controlNode, controlDof, aMode,
"Quad1PlaneStrain");
253 if ( !
gc.testElementGraphicActivity(
this) ) {
258 EASValsSetColor(
gc.getElementColor() );
259 EASValsSetEdgeColor(
gc.getElementEdgeColor() );
260 EASValsSetEdgeFlag(
true);
262 EASValsSetFillStyle(FILL_HOLLOW);
263 p [ 0 ].x = ( FPNum ) this->
giveNode(1)->giveCoordinate(1);
264 p [ 0 ].y = ( FPNum ) this->
giveNode(1)->giveCoordinate(2);
266 p [ 1 ].x = ( FPNum ) this->
giveNode(2)->giveCoordinate(1);
267 p [ 1 ].y = ( FPNum ) this->
giveNode(2)->giveCoordinate(2);
269 p [ 2 ].x = ( FPNum ) this->
giveNode(3)->giveCoordinate(1);
270 p [ 2 ].y = ( FPNum ) this->
giveNode(3)->giveCoordinate(2);
272 p [ 3 ].x = ( FPNum ) this->
giveNode(4)->giveCoordinate(1);
273 p [ 3 ].y = ( FPNum ) this->
giveNode(4)->giveCoordinate(2);
276 go = CreateQuad3D(p);
277 EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
278 EGAttachObject(go, ( EObjectP )
this);
279 EMAddGraphicsToModel(ESIModel(), go);
287 double defScale =
gc.getDefScale();
289 if ( !
gc.testElementGraphicActivity(
this) ) {
294 EASValsSetColor(
gc.getDeformedElementColor() );
295 EASValsSetEdgeColor(
gc.getElementEdgeColor() );
296 EASValsSetEdgeFlag(
true);
298 EASValsSetFillStyle(FILL_HOLLOW);
299 p [ 0 ].x = ( FPNum ) this->
giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale);
300 p [ 0 ].y = ( FPNum ) this->
giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale);
302 p [ 1 ].x = ( FPNum ) this->
giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale);
303 p [ 1 ].y = ( FPNum ) this->
giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale);
305 p [ 2 ].x = ( FPNum ) this->
giveNode(3)->giveUpdatedCoordinate(1, tStep, defScale);
306 p [ 2 ].y = ( FPNum ) this->
giveNode(3)->giveUpdatedCoordinate(2, tStep, defScale);
308 p [ 3 ].x = ( FPNum ) this->
giveNode(4)->giveUpdatedCoordinate(1, tStep, defScale);
309 p [ 3 ].y = ( FPNum ) this->
giveNode(4)->giveUpdatedCoordinate(2, tStep, defScale);
312 go = CreateQuad3D(p);
313 EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
314 EMAddGraphicsToModel(ESIModel(), go);
321 int i, indx, result = 0;
325 double s [ 4 ], defScale;
327 if ( !
gc.testElementGraphicActivity(
this) ) {
333 for ( i = 1; i <= 4; i++ ) {
341 indx =
gc.giveIntVarIndx();
343 for ( i = 1; i <= 4; i++ ) {
344 s [ i - 1 ] = v [ i - 1 ].
at(indx);
348 for ( i = 0; i < 4; i++ ) {
349 if (
gc.getInternalVarsDefGeoFlag() ) {
351 defScale =
gc.getDefScale();
352 p [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
353 p [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
356 p [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(1);
357 p [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(2);
363 gc.updateFringeTableMinMax(s, 4);
364 tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
365 EGWithMaskChangeAttributes(LAYER_MASK, tr);
366 EMAddGraphicsToModel(ESIModel(), tr);
368 double landScale =
gc.getLandScale();
370 for ( i = 0; i < 4; i++ ) {
371 if (
gc.getInternalVarsDefGeoFlag() ) {
373 defScale =
gc.getDefScale();
374 p [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
375 p [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
376 p [ i ].z = s [ i ] * landScale;
378 p [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(1);
379 p [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(2);
380 p [ i ].z = s [ i ] * landScale;
384 if ( fabs(s [ i ]) < 1.0e-6 ) {
390 EASValsSetColor(
gc.getDeformedElementColor() );
392 tr = CreateQuad3D(p);
393 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, tr);
395 gc.updateFringeTableMinMax(s, 4);
396 tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
397 EGWithMaskChangeAttributes(LAYER_MASK, tr);
400 EMAddGraphicsToModel(ESIModel(), tr);
410 for ( i = 0; i < 4; i++ ) {
411 if (
gc.getInternalVarsDefGeoFlag() ) {
413 defScale =
gc.getDefScale();
414 pp [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
415 pp [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
418 pp [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(1);
419 pp [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(2);
424 for ( i = 0; i < 3; i++ ) {
425 pp [ i + 4 ].x = 0.5 * ( pp [ i ].x + pp [ i + 1 ].x );
426 pp [ i + 4 ].y = 0.5 * ( pp [ i ].y + pp [ i + 1 ].y );
427 pp [ i + 4 ].z = 0.5 * ( pp [ i ].z + pp [ i + 1 ].z );
430 pp [ 7 ].x = 0.5 * ( pp [ 3 ].x + pp [ 0 ].x );
431 pp [ 7 ].y = 0.5 * ( pp [ 3 ].y + pp [ 0 ].y );
432 pp [ 7 ].z = 0.5 * ( pp [ 3 ].z + pp [ 0 ].z );
434 pp [ 8 ].x = 0.25 * ( pp [ 0 ].x + pp [ 1 ].x + pp [ 2 ].x + pp [ 3 ].x );
435 pp [ 8 ].y = 0.25 * ( pp [ 0 ].y + pp [ 1 ].y + pp [ 2 ].y + pp [ 3 ].y );
436 pp [ 8 ].z = 0.25 * ( pp [ 0 ].z + pp [ 1 ].z + pp [ 2 ].z + pp [ 3 ].z );
439 const FloatArray& gpCoords = gp->giveNaturalCoordinates();
440 if ( ( gpCoords.
at(1) > 0. ) && ( gpCoords.
at(2) > 0. ) ) {
445 }
else if ( ( gpCoords.
at(1) < 0. ) && ( gpCoords.
at(2) > 0. ) ) {
450 }
else if ( ( gpCoords.
at(1) < 0. ) && ( gpCoords.
at(2) < 0. ) ) {
462 if (
giveIPValue(v [ 0 ], gp,
gc.giveIntVarType(), tStep) == 0 ) {
466 indx =
gc.giveIntVarIndx();
468 for ( i = 1; i <= 4; i++ ) {
469 s [ i - 1 ] = v [ 0 ].
at(indx);
472 for ( i = 0; i < 4; i++ ) {
473 p [ i ].x = pp [ ind.
at(i + 1) ].x;
474 p [ i ].y = pp [ ind.
at(i + 1) ].y;
475 p [ i ].z = pp [ ind.
at(i + 1) ].z;
478 gc.updateFringeTableMinMax(s, 4);
479 tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
480 EGWithMaskChangeAttributes(LAYER_MASK, tr);
481 EMAddGraphicsToModel(ESIModel(), tr);
493 double defScale =
gc.getDefScale();
496 if ( !
gc.testElementGraphicActivity(
this) ) {
500 if (
gc.giveIntVarType() == IST_CrackState ) {
509 if ( this->
giveIPValue(cf, gp, IST_CrackedFlag, tStep) == 0 ) {
513 if ( (
int ) cf.
at(1) == 0 ) {
517 if ( this->
giveIPValue(crackDir, gp, IST_CrackDirs, tStep) ) {
518 this->
giveIPValue(crackStatuses, gp, IST_CrackStatuses, tStep);
519 for ( i = 1; i <= 3; i++ ) {
520 crackStatus = ( int ) crackStatuses.
at(i);
527 ay = crackDir.
at(3 + i);
528 if ( fabs(ax) > 1.e-6 ) {
531 norm = sqrt(bx * bx + by * by);
540 if (
gc.getInternalVarsDefGeoFlag() ) {
541 double ksi, eta, n1, n2, n3, n4;
542 ksi = gp->giveNaturalCoordinate(1);
543 eta = gp->giveNaturalCoordinate(2);
545 n1 = ( 1. + ksi ) * ( 1. + eta ) * 0.25;
546 n2 = ( 1. - ksi ) * ( 1. + eta ) * 0.25;
547 n3 = ( 1. - ksi ) * ( 1. - eta ) * 0.25;
548 n4 = ( 1. + ksi ) * ( 1. - eta ) * 0.25;
552 gpglobalcoords.
at(1) = ( n1 * this->
giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale) +
553 n2 * this->
giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale) +
554 n3 * this->
giveNode(3)->giveUpdatedCoordinate(1, tStep, defScale) +
555 n4 * this->
giveNode(4)->giveUpdatedCoordinate(1, tStep, defScale) );
556 gpglobalcoords.
at(2) = ( n1 * this->
giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale) +
557 n2 * this->
giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale) +
558 n3 * this->
giveNode(3)->giveUpdatedCoordinate(2, tStep, defScale) +
559 n4 * this->
giveNode(4)->giveUpdatedCoordinate(2, tStep, defScale) );
564 xc = gpglobalcoords.
at(1);
565 yc = gpglobalcoords.
at(2);
567 l [ 0 ].x = ( FPNum ) xc + bx *
length;
568 l [ 0 ].y = ( FPNum ) yc + by *
length;
570 l [ 1 ].x = ( FPNum ) xc - bx *
length;
571 l [ 1 ].y = ( FPNum ) yc - by *
length;
576 EASValsSetColor(
gc.getActiveCrackColor() );
578 EASValsSetColor(
gc.getCrackPatternColor() );
581 tr = CreateLine3D(l);
582 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, tr);
583 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]