131 double cx = 0., cy = 0.;
132 for (
int i = 1; i <= 3; i++ ) {
133 x.at(i) =
giveNode(i)->giveCoordinate(1);
144 for (
int i = 1; i <= 3; i++ ) {
145 if ( ( ( x.at(i) - cx ) * normalToCrackPlane.
at(1) + ( y.
at(i) - cy ) * normalToCrackPlane.
at(2) ) > 0. ) {
154 dnx.
at(1, 1) = y.
at(2) - y.
at(3);
155 dnx.
at(2, 1) = y.
at(3) - y.
at(1);
156 dnx.
at(3, 1) = y.
at(1) - y.
at(2);
157 dnx.
at(1, 2) = x.at(3) - x.at(2);
158 dnx.
at(2, 2) = x.at(1) - x.at(3);
159 dnx.
at(3, 2) = x.at(2) - x.at(1);
165 for (
int i = 1; i <= 3; i++ ) {
166 gradPhi.
at(1) += phi.
at(i) * dnx.
at(i, 1);
167 gradPhi.
at(2) += phi.
at(i) * dnx.
at(i, 2);
172 for (
int i = 1; i <= 2; i++ ) {
173 dPhidN += gradPhi.
at(i) * normalToCrackPlane.
at(i);
176 if ( dPhidN == 0. ) {
180 return 1. / fabs(dPhidN);
198TrPlaneStress2d :: HuertaErrorEstimatorI_setupRefinedElementProblem(
RefinedElement *refinedElement,
int level,
int nodeId,
200 HuertaErrorEstimatorInterface :: SetupMode sMode,
TimeStep *tStep,
201 int &localNodeId,
int &localElemId,
int &localBcId,
203 HuertaErrorEstimator :: AnalysisMode aMode)
205 int nodes = 3, sides = 3;
206 double x = 0.0, y = 0.0;
208 static int sideNode [ 3 ] [ 2 ] = { { 1, 2 }, { 2, 3 }, { 3, 1 } };
210 FloatArray corner [ 3 ], midSide [ 3 ], midNode, cor [ 3 ];
211 if ( sMode == HuertaErrorEstimatorInterface :: NodeMode ||
212 ( sMode == HuertaErrorEstimatorInterface :: BCMode && aMode == HuertaErrorEstimator :: HEE_linear ) ) {
213 for (
int inode = 0; inode < nodes; inode++ ) {
214 corner [ inode ] = this->
giveNode(inode + 1)->giveCoordinates();
215 if ( corner [ inode ].giveSize() != 3 ) {
217 cor [ inode ].
at(1) = corner [ inode ].
at(1);
218 cor [ inode ].
at(2) = corner [ inode ].
at(2);
219 cor [ inode ].
at(3) = 0.0;
221 corner [ inode ] = cor [ inode ];
224 x += corner [ inode ].
at(1);
225 y += corner [ inode ].
at(2);
228 for (
int iside = 0; iside < sides; iside++ ) {
229 midSide [ iside ].
resize(3);
231 int nd1 = sideNode [ iside ] [ 0 ] - 1;
232 int nd2 = sideNode [ iside ] [ 1 ] - 1;
234 midSide [ iside ].
at(1) = ( corner [ nd1 ].
at(1) + corner [ nd2 ].at(1) ) / 2.0;
235 midSide [ iside ].
at(2) = ( corner [ nd1 ].
at(2) + corner [ nd2 ].at(2) ) / 2.0;
236 midSide [ iside ].
at(3) = 0.0;
241 midNode.
at(1) = x / nodes;
242 midNode.
at(2) = y / nodes;
247 sMode, tStep, nodes, corner, midSide, midNode,
248 localNodeId, localElemId, localBcId,
249 controlNode, controlDof, aMode,
"PlaneStress2d");
266 if ( !
gc.testElementGraphicActivity(
this) ) {
271 EASValsSetColor(
gc.getElementColor() );
272 EASValsSetEdgeColor(
gc.getElementEdgeColor() );
273 EASValsSetEdgeFlag(
true);
275 p [ 0 ].x = ( FPNum ) this->
giveNode(1)->giveCoordinate(1);
276 p [ 0 ].y = ( FPNum ) this->
giveNode(1)->giveCoordinate(2);
278 p [ 1 ].x = ( FPNum ) this->
giveNode(2)->giveCoordinate(1);
279 p [ 1 ].y = ( FPNum ) this->
giveNode(2)->giveCoordinate(2);
281 p [ 2 ].x = ( FPNum ) this->
giveNode(3)->giveCoordinate(1);
282 p [ 2 ].y = ( FPNum ) this->
giveNode(3)->giveCoordinate(2);
285 go = CreateTriangle3D(p);
286 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
287 EGAttachObject(go, ( EObjectP )
this);
288 EMAddGraphicsToModel(ESIModel(), go);
296 double defScale =
gc.getDefScale();
298 if ( !
gc.testElementGraphicActivity(
this) ) {
303 EASValsSetColor(
gc.getDeformedElementColor() );
304 EASValsSetEdgeColor(
gc.getElementEdgeColor() );
305 EASValsSetEdgeFlag(
true);
307 p [ 0 ].x = ( FPNum ) this->
giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale);
308 p [ 0 ].y = ( FPNum ) this->
giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale);
310 p [ 1 ].x = ( FPNum ) this->
giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale);
311 p [ 1 ].y = ( FPNum ) this->
giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale);
313 p [ 2 ].x = ( FPNum ) this->
giveNode(3)->giveUpdatedCoordinate(1, tStep, defScale);
314 p [ 2 ].y = ( FPNum ) this->
giveNode(3)->giveUpdatedCoordinate(2, tStep, defScale);
317 go = CreateTriangle3D(p);
318 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
319 EMAddGraphicsToModel(ESIModel(), go);
324 int i, indx, result = 0;
328 double s [ 3 ], defScale;
330 if ( !
gc.testElementGraphicActivity(
this) ) {
350 indx =
gc.giveIntVarIndx();
352 s [ 0 ] = v1.
at(indx);
353 s [ 1 ] = v2.
at(indx);
354 s [ 2 ] = v3.
at(indx);
359 for ( i = 0; i < 3; i++ ) {
360 if (
gc.getInternalVarsDefGeoFlag() ) {
362 defScale =
gc.getDefScale();
363 p [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
364 p [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
367 p [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(1);
368 p [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(2);
374 gc.updateFringeTableMinMax(s, 3);
375 tr = CreateTriangleWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ]);
376 EGWithMaskChangeAttributes(LAYER_MASK, tr);
377 EMAddGraphicsToModel(ESIModel(), tr);
379 double landScale =
gc.getLandScale();
381 for ( i = 0; i < 3; i++ ) {
382 if (
gc.getInternalVarsDefGeoFlag() ) {
384 defScale =
gc.getDefScale();
385 p [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
386 p [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
387 p [ i ].z = s [ i ] * landScale;
389 p [ i ].x = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(1);
390 p [ i ].y = ( FPNum ) this->
giveNode(i + 1)->giveCoordinate(2);
391 p [ i ].z = s [ i ] * landScale;
396 EASValsSetColor(
gc.getDeformedElementColor() );
398 EASValsSetFillStyle(FILL_SOLID);
399 tr = CreateTriangle3D(p);
400 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | FILL_MASK | LAYER_MASK, tr);
402 gc.updateFringeTableMinMax(s, 3);
403 EASValsSetFillStyle(FILL_SOLID);
404 tr = CreateTriangleWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ]);
405 EGWithMaskChangeAttributes(FILL_MASK | LAYER_MASK, tr);
408 EMAddGraphicsToModel(ESIModel(), tr);
417 double defScale =
gc.getDefScale();
420 if ( !
gc.testElementGraphicActivity(
this) ) {
424 if (
gc.giveIntVarType() == IST_CrackState ) {
431 if ( this->
giveIPValue(cf, gp, IST_CrackedFlag, tStep) == 0 ) {
435 if ( (
int ) cf.
at(1) == 0 ) {
439 if ( this->
giveIPValue(crackDir, gp, IST_CrackDirs, tStep) ) {
440 this->
giveIPValue(crackStatuses, gp, IST_CrackStatuses, tStep);
441 for (
int i = 1; i <= 3; i++ ) {
442 crackStatus = ( int ) crackStatuses.
at(i);
449 ay = crackDir.
at(3 + i);
450 if ( fabs(ax) > 1.e-6 ) {
453 norm = sqrt(bx * bx + by * by);
464 for (
int j = 1; j <= 3; j++ ) {
465 if (
gc.getInternalVarsDefGeoFlag() ) {
467 xc += ( FPNum ) this->
giveNode(j)->giveUpdatedCoordinate(1, tStep, defScale);
468 yc += ( FPNum ) this->
giveNode(j)->giveUpdatedCoordinate(2, tStep, defScale);
470 xc += ( FPNum ) this->
giveNode(j)->giveCoordinate(1);
471 yc += ( FPNum ) this->
giveNode(j)->giveCoordinate(2);
478 l [ 0 ].x = ( FPNum ) xc + bx *
length;
479 l [ 0 ].y = ( FPNum ) yc + by *
length;
481 l [ 1 ].x = ( FPNum ) xc - bx *
length;
482 l [ 1 ].y = ( FPNum ) yc - by *
length;
487 EASValsSetColor(
gc.getActiveCrackColor() );
489 EASValsSetColor(
gc.getCrackPatternColor() );
492 tr = CreateLine3D(l);
493 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, tr);
494 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)
#define OOFEG_CRACK_PATTERN_LAYER
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
#define OOFEG_VARPLOT_PATTERN_LAYER
#define OOFEG_DEFORMED_GEOMETRY_LAYER
#define OOFEG_DEFORMED_GEOMETRY_WIDTH
#define OOFEG_RAW_GEOMETRY_WIDTH
#define OOFEG_RAW_GEOMETRY_LAYER
#define OOFEG_CRACK_PATTERN_WIDTH