void InterfaceElem2dQuad :: drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep) { GraphicObj *go; // if (!go) { // create new one WCRec p [ 2 ]; /* poin */ if ( !gc.testElementGraphicActivity(this) ) { return; } EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH); EASValsSetColor( gc.getElementColor() ); EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER); p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1); p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2); p [ 0 ].z = 0.0; p [ 1 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1); p [ 1 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2); p [ 1 ].z = 0.0; go = CreateLine3D(p); EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go); EGAttachObject(go, ( EObjectP ) this); EMAddGraphicsToModel(ESIModel(), go); p [ 0 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1); p [ 0 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2); p [ 0 ].z = 0.0; p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(1); p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(2); p [ 1 ].z = 0.0; go = CreateLine3D(p); EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go); EGAttachObject(go, ( EObjectP ) this); EMAddGraphicsToModel(ESIModel(), go); }
void InterfaceElem2dQuad :: drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType type) { GraphicObj *go; // if (!go) { // create new one WCRec p [ 2 ]; /* poin */ if ( !gc.testElementGraphicActivity(this) ) { return; } double defScale = gc.getDefScale(); EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH); EASValsSetColor( gc.getDeformedElementColor() ); EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER + 1); p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale); p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale); p [ 0 ].z = 0.0; p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale); p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale); p [ 1 ].z = 0.0; go = CreateLine3D(p); EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go); EMAddGraphicsToModel(ESIModel(), go); p [ 0 ].x = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(1, tStep, defScale); p [ 0 ].y = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(2, tStep, defScale); p [ 0 ].z = 0.0; p [ 1 ].x = ( FPNum ) this->giveNode(5)->giveUpdatedCoordinate(1, tStep, defScale); p [ 1 ].y = ( FPNum ) this->giveNode(5)->giveUpdatedCoordinate(2, tStep, defScale); p [ 1 ].z = 0.0; go = CreateLine3D(p); EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go); EMAddGraphicsToModel(ESIModel(), go); }
void LIBeam3dNL :: drawDeformedGeometry(oofegGraphicContext &gc, UnknownType type) { GraphicObj *go; if ( !gc.testElementGraphicActivity(this) ) { return; } TimeStep *tStep = domain->giveEngngModel()->giveCurrentStep(); double defScale = gc.getDefScale(); // if (!go) { // create new one WCRec p [ 2 ]; /* poin */ EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH); EASValsSetColor( gc.getDeformedElementColor() ); EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER); p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(1, tStep, EID_MomentumBalance, defScale); p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(2, tStep, EID_MomentumBalance, defScale); p [ 0 ].z = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(3, tStep, EID_MomentumBalance, defScale); p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(1, tStep, EID_MomentumBalance, defScale); p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(2, tStep, EID_MomentumBalance, defScale); p [ 1 ].z = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(3, tStep, EID_MomentumBalance, defScale); go = CreateLine3D(p); EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go); EMAddGraphicsToModel(ESIModel(), go); }
void Lattice2d :: drawRawCrossSections(oofegGraphicContext &gc, TimeStep *tStep) { GraphicObj *go; // if (!go) { // create new one WCRec p [ 2 ]; /* poin */ if ( !gc.testElementGraphicActivity(this) ) { return; } EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH); EASValsSetColor( gc.getCrossSectionColor() ); EASValsSetLayer(OOFEG_RAW_CROSSSECTION_LAYER); FloatArray coords; this->giveCrossSectionCoordinates(coords); p [ 0 ].x = ( FPNum ) coords.at(1); p [ 0 ].y = ( FPNum ) coords.at(2); p [ 0 ].z = ( FPNum ) coords.at(3); p [ 1 ].x = ( FPNum ) coords.at(4); p [ 1 ].y = ( FPNum ) coords.at(5); p [ 1 ].z = ( FPNum ) coords.at(6); go = CreateLine3D(p); EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go); EGAttachObject(go, ( EObjectP ) this); EMAddGraphicsToModel(ESIModel(), go); }
void Lattice2d :: drawSpecial(oofegGraphicContext &gc, TimeStep *tStep) { WCRec p [ 2 ]; GraphicObj *tr; GaussPoint *gp; FloatArray crackStatuses, cf; if ( !gc.testElementGraphicActivity(this) ) { return; } if ( gc.giveIntVarType() == IST_CrackState ) { gp = integrationRulesArray [ 0 ]->getIntegrationPoint(0); this->giveIPValue(crackStatuses, gp, IST_CrackStatuses, tStep); if ( crackStatuses(0) == 1. || crackStatuses(0) == 2. || crackStatuses(0) == 3 || crackStatuses(0) == 4 ) { FloatArray coords; this->giveCrossSectionCoordinates(coords); p [ 0 ].x = ( FPNum ) coords.at(1); p [ 0 ].y = ( FPNum ) coords.at(2); p [ 0 ].z = ( FPNum ) coords.at(3); p [ 1 ].x = ( FPNum ) coords.at(4); p [ 1 ].y = ( FPNum ) coords.at(5); p [ 1 ].z = ( FPNum ) coords.at(6); EASValsSetLayer(OOFEG_CRACK_PATTERN_LAYER); EASValsSetLineWidth(OOFEG_CRACK_PATTERN_WIDTH); if ( ( crackStatuses(0) == 1. ) ) { EASValsSetColor( gc.getActiveCrackColor() ); } else if ( crackStatuses(0) == 2. ) { EASValsSetColor( gc.getCrackPatternColor() ); } else if ( crackStatuses(0) == 3. ) { EASValsSetColor( gc.getActiveCrackColor() ); } else if ( crackStatuses(0) == 4. ) { EASValsSetColor( gc.getActiveCrackColor() ); } tr = CreateLine3D(p); EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, tr); EGAttachObject(tr, ( EObjectP ) this); EMAddGraphicsToModel(ESIModel(), tr); } } }
void CohesiveSurface3d :: drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep) { if ( !gc.testElementGraphicActivity(this) ) { return; } //WCRec p[4]; GraphicObj *go; Particle *nodeA = ( Particle * ) this->giveNode(1); Particle *nodeB = ( Particle * ) this->giveNode(2); //double rA = nodeA -> giveRadius(); //double rB = nodeB -> giveRadius(); //double r = (rA+rB)/4.; EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH); EASValsSetColor( gc.getElementColor() ); EASValsSetEdgeColor( gc.getElementEdgeColor() ); EASValsSetEdgeFlag(true); EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER); WCRec pl [ 2 ]; // determine coordinates of the particles connected by this element pl [ 0 ].x = ( FPNum ) nodeA->giveCoordinate(1); pl [ 0 ].y = ( FPNum ) nodeA->giveCoordinate(2); pl [ 0 ].z = ( FPNum ) nodeA->giveCoordinate(3); pl [ 1 ].x = ( FPNum ) nodeB->giveCoordinate(1); pl [ 1 ].y = ( FPNum ) nodeB->giveCoordinate(2); pl [ 1 ].z = ( FPNum ) nodeB->giveCoordinate(3); if ( giveNumberOfNodes() == 3 ) { // the second particle should be shifted (periodic arrangement) Particle *nodeC = ( Particle * ) this->giveNode(3); pl [ 1 ].x += kx * ( nodeC->giveCoordinate(1) ); pl [ 1 ].y += ky * ( nodeC->giveCoordinate(2) ); pl [ 1 ].z += kz * ( nodeC->giveCoordinate(3) ); } // plot a line segment connecting the particles go = CreateLine3D(pl); EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go); EGAttachObject(go, ( EObjectP ) this); EMAddGraphicsToModel(ESIModel(), go); }
void Truss2d :: drawRawGeometry(oofegGraphicContext &gc) { int c1, c2; resolveCoordIndices(c1, c2); GraphicObj *go; // if (!go) { // create new one WCRec p [ 2 ]; /* point */ if ( !gc.testElementGraphicActivity(this) ) { return; } EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH); EASValsSetColor( gc.getElementColor() ); EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER); if ( cs_mode == 0 ) { p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(c1); p [ 0 ].y = 0.; p [ 0 ].z = ( FPNum ) this->giveNode(1)->giveCoordinate(c2); p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(c1); p [ 1 ].y = 0.; p [ 1 ].z = ( FPNum ) this->giveNode(2)->giveCoordinate(c2); } else if ( cs_mode == 1 ) { p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(c1); p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(c2); p [ 0 ].z = 0.; p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(c1); p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(c2); p [ 1 ].z = 0.; } else if ( cs_mode == 2 ) { p [ 0 ].x = 0.; p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(c1); p [ 0 ].z = ( FPNum ) this->giveNode(1)->giveCoordinate(c2); p [ 1 ].x = 0.; p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(c1); p [ 1 ].z = ( FPNum ) this->giveNode(2)->giveCoordinate(c2); } go = CreateLine3D(p); EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go); EGAttachObject(go, ( EObjectP ) this); EMAddGraphicsToModel(ESIModel(), go); }
void Truss1d :: drawScalar(oofegGraphicContext &gc, TimeStep *tStep) { int i, indx, result = 0; WCRec p [ 2 ]; GraphicObj *tr; FloatArray v1, v2; double s [ 2 ], defScale; if ( !gc.testElementGraphicActivity(this) ) { return; } if ( gc.giveIntVarMode() == ISM_recovered ) { result += this->giveInternalStateAtNode(v1, gc.giveIntVarType(), gc.giveIntVarMode(), 1, tStep); result += this->giveInternalStateAtNode(v2, gc.giveIntVarType(), gc.giveIntVarMode(), 2, tStep); } else if ( gc.giveIntVarMode() == ISM_local ) { GaussPoint *gp = integrationRulesArray [ 0 ]->getIntegrationPoint(0); result += giveIPValue(v1, gp, gc.giveIntVarType(), tStep); v2 = v1; result *= 2; } if ( result != 2 ) { return; } indx = gc.giveIntVarIndx(); s [ 0 ] = v1.at(indx); s [ 1 ] = v2.at(indx); EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER); if ( ( gc.getScalarAlgo() == SA_ISO_SURF ) || ( gc.getScalarAlgo() == SA_ISO_LINE ) ) { for ( i = 0; i < 2; i++ ) { if ( gc.getInternalVarsDefGeoFlag() ) { // use deformed geometry defScale = gc.getDefScale(); p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale); p [ i ].y = 0.; p [ i ].z = 0.; } else { p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1); p [ i ].y = 0.; p [ i ].z = 0.; } } //EASValsSetColor(gc.getYieldPlotColor(ratio)); tr = CreateLine3D(p); EGWithMaskChangeAttributes(LAYER_MASK, tr); EMAddGraphicsToModel(ESIModel(), tr); } else if ( ( gc.getScalarAlgo() == SA_ZPROFILE ) || ( gc.getScalarAlgo() == SA_COLORZPROFILE ) ) { double landScale = gc.getLandScale(); for ( i = 0; i < 2; i++ ) { if ( gc.getInternalVarsDefGeoFlag() ) { // use deformed geometry defScale = gc.getDefScale(); p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale); p [ i ].y = 0.0; p [ i ].z = s [ i ] * landScale; } else { p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1); p [ i ].y = 0.0; p [ i ].z = s [ i ] * landScale; } } if ( gc.getScalarAlgo() == SA_ZPROFILE ) { /* * EASValsSetColor(gc.getDeformedElementColor()); * EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH); * tr = CreateLine3D(p); * EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, tr); */ WCRec pp [ 4 ]; pp [ 0 ].x = p [ 0 ].x; pp [ 0 ].y = 0.0; pp [ 0 ].z = 0.0; pp [ 1 ].x = p [ 0 ].x; pp [ 1 ].y = 0.0; pp [ 1 ].z = p [ 0 ].z; pp [ 2 ].x = p [ 1 ].x; pp [ 2 ].y = 0.0; pp [ 2 ].z = p [ 1 ].z; pp [ 3 ].x = p [ 1 ].x; pp [ 3 ].y = 0.0; pp [ 3 ].z = 0.0; tr = CreateQuad3D(pp); EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH); EASValsSetColor( gc.getDeformedElementColor() ); //EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER); EASValsSetFillStyle(FILL_HOLLOW); EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | LAYER_MASK, tr); EMAddGraphicsToModel(ESIModel(), tr); } else { //tr = CreateTriangleWD3D(p, s[0], s[1], s[2]); EASValsSetColor( gc.getDeformedElementColor() ); tr = CreateLine3D(p); EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, tr); EMAddGraphicsToModel(ESIModel(), tr); } } }
void Lattice2d :: drawSpecial(oofegGraphicContext &gc, TimeStep *tStep) { WCRec l [ 2 ]; GraphicObj *tr; GaussPoint *gp; FloatArray crackStatuses, cf; if ( !gc.testElementGraphicActivity(this) ) { return; } if ( gc.giveIntVarType() == IST_CrackState ) { gp = integrationRulesArray [ 0 ]->getIntegrationPoint(0); this->giveIPValue(crackStatuses, gp, IST_CrackStatuses, tStep); if ( crackStatuses(0) == 1. || crackStatuses(0) == 2. || crackStatuses(0) == 3 || crackStatuses(0) == 4 ) { double x1, y1, x2, y2; x1 = this->giveNode(1)->giveCoordinate(1); y1 = this->giveNode(1)->giveCoordinate(2); x2 = this->giveNode(2)->giveCoordinate(1); y2 = this->giveNode(2)->giveCoordinate(2); //Compute normal and shear direction FloatArray normalDirection; FloatArray shearDirection; normalDirection.resize(2); normalDirection.zero(); shearDirection.resize(2); shearDirection.zero(); normalDirection.at(1) = x2 - x1; normalDirection.at(2) = y2 - y1; normalDirection.normalize(); if ( normalDirection.at(2) == 0. ) { shearDirection.at(1) = 0.; shearDirection.at(2) = 1.; } else { shearDirection.at(1) = 1.0; shearDirection.at(2) = -normalDirection.at(1) / normalDirection.at(2); } shearDirection.normalize(); l [ 0 ].x = ( FPNum ) this->gpCoords.at(1) - shearDirection.at(1) * this->width / 2.; l [ 0 ].y = ( FPNum ) this->gpCoords.at(2) - shearDirection.at(2) * this->width / 2.; l [ 0 ].z = 0.; l [ 1 ].x = ( FPNum ) this->gpCoords.at(1) + shearDirection.at(1) * this->width / 2.; ; l [ 1 ].y = ( FPNum ) this->gpCoords.at(2) + shearDirection.at(2) * this->width / 2.; l [ 1 ].z = 0.; EASValsSetLayer(OOFEG_CRACK_PATTERN_LAYER); EASValsSetLineWidth(OOFEG_CRACK_PATTERN_WIDTH); if ( ( crackStatuses(0) == 1. ) ) { EASValsSetColor( gc.getActiveCrackColor() ); } else if ( crackStatuses(0) == 2. ) { EASValsSetColor( gc.getCrackPatternColor() ); } else if ( crackStatuses(0) == 3. ) { EASValsSetColor( gc.getActiveCrackColor() ); } else if ( crackStatuses(0) == 4. ) { EASValsSetColor( gc.getActiveCrackColor() ); } tr = CreateLine3D(l); EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, tr); EMAddGraphicsToModel(ESIModel(), tr); } } }
void LSpace :: drawTriad(FloatArray &coords, int isurf) { FloatMatrix jm(3, 3); FloatArray gc(3); GraphicObj *go; WCRec p [ 2 ]; // point double coeff = 1.0; int i, succ; /* * // version I * this->interpolation.giveJacobianMatrixAt (jm, domain, nodeArray, coords); * // determine origin * this->interpolation.local2global (gc, domain, nodeArray, coords, 0.0); * // draw triad * */ // version II // determine surface center IntArray snodes(4); FloatArray h1(3), h2(3), nn(3), n(3); int j; const char *colors[] = { "red", "green", "blue" }; this->interpolation.computeSurfaceMapping(snodes, dofManArray, isurf); for ( i = 1; i <= 4; i++ ) { gc.add( * ( domain->giveNode( snodes.at(i) )->giveCoordinates() ) ); } gc.times(1. / 4.); // determine "average normal" nn.zero(); for ( i = 1; i <= 4; i++ ) { j = ( i ) % 4 + 1; h1 = * domain->giveNode( snodes.at(i) )->giveCoordinates(); h1.subtract(gc); h2 = * domain->giveNode( snodes.at(j) )->giveCoordinates(); h2.subtract(gc); n.beVectorProductOf(h1, h2); if ( n.dotProduct(n, 3) > 1.e-6 ) { n.normalize(); } nn.add(n); } nn.times(1. / 4.); if ( nn.dotProduct(nn, 3) < 1.e-6 ) { return; } nn.normalize(); for ( i = 1; i <= 3; i++ ) { jm.at(i, 3) = nn.at(i); } // determine lcs of surface // local x axis in xy plane double test = fabs(fabs( nn.at(3) ) - 1.0); if ( test < 1.e-5 ) { h1.at(1) = jm.at(1, 1) = 1.0; h1.at(2) = jm.at(2, 1) = 0.0; } else { h1.at(1) = jm.at(1, 1) = jm.at(2, 3); h1.at(2) = jm.at(2, 1) = -jm.at(1, 3); } h1.at(3) = jm.at(3, 1) = 0.0; // local y axis perpendicular to local x,z axes h2.beVectorProductOf(nn, h1); for ( i = 1; i <= 3; i++ ) { jm.at(i, 2) = h2.at(i); } p [ 0 ].x = gc.at(1); p [ 0 ].y = gc.at(2); p [ 0 ].z = gc.at(3); for ( i = 1; i <= 3; i++ ) { p [ 1 ].x = p [ 0 ].x + coeff *jm.at(1, i); p [ 1 ].y = p [ 0 ].y + coeff *jm.at(2, i); p [ 1 ].z = p [ 0 ].z + coeff *jm.at(3, i); EASValsSetColor( ColorGetPixelFromString(const_cast< char * >(colors [ i - 1 ]), & succ) ); go = CreateLine3D(p); EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go); EMAddGraphicsToModel(ESIModel(), go); } }