int FlatSliderSimple2d::displaySelf(Renderer &theViewer, int displayMode, float fact, const char **modes, int numMode) { int errCode = 0; // first determine the end points of the element based on // the display factor (a measure of the distorted image) const Vector &end1Crd = theNodes[0]->getCrds(); const Vector &end2Crd = theNodes[1]->getCrds(); static Vector v1(3); static Vector v2(3); static Vector v3(3); if (displayMode >= 0) { const Vector &end1Disp = theNodes[0]->getDisp(); const Vector &end2Disp = theNodes[1]->getDisp(); for (int i=0; i<2; i++) { v1(i) = end1Crd(i) + end1Disp(i)*fact; v2(i) = end1Crd(i) + (end1Disp(i) + end2Disp(i))*fact; v3(i) = end2Crd(i) + end2Disp(i)*fact; } } else { int mode = displayMode * -1; const Matrix &eigen1 = theNodes[0]->getEigenvectors(); const Matrix &eigen2 = theNodes[1]->getEigenvectors(); if (eigen1.noCols() >= mode) { for (int i=0; i<2; i++) { v1(i) = end1Crd(i) + eigen1(i,mode-1)*fact; v2(i) = end1Crd(i) + (eigen1(i,mode-1) + eigen2(i,mode-1))*fact; v3(i) = end2Crd(i) + eigen2(i,mode-1)*fact; } } else { for (int i=0; i<2; i++) { v1(i) = end1Crd(i); v2(i) = end1Crd(i); v3(i) = end2Crd(i); } } } errCode += theViewer.drawLine (v1, v2, 1.0, 1.0); errCode += theViewer.drawLine (v2, v3, 1.0, 1.0); return errCode; }
int DispBeamColumn2d::displaySelf(Renderer &theViewer, int displayMode, float fact, const char **displayModes, int numModes) { static Vector v1(3); static Vector v2(3); if (displayMode >= 0) { theNodes[0]->getDisplayCrds(v1, fact); theNodes[1]->getDisplayCrds(v2, fact); } else { theNodes[0]->getDisplayCrds(v1, 0.); theNodes[1]->getDisplayCrds(v2, 0.); // add eigenvector values int mode = displayMode * -1; const Matrix &eigen1 = theNodes[0]->getEigenvectors(); const Matrix &eigen2 = theNodes[1]->getEigenvectors(); if (eigen1.noCols() >= mode) { for (int i = 0; i < 2; i++) { v1(i) += eigen1(i,mode-1)*fact; v2(i) += eigen2(i,mode-1)*fact; } } } return theViewer.drawLine (v1, v2, 1.0, 1.0, this->getTag()); }
int ElasticBeam3d::displaySelf(Renderer &theViewer, int displayMode, float fact, const char **modes, int numMode) { static Vector v1(3); static Vector v2(3); theNodes[0]->getDisplayCrds(v1, fact); theNodes[1]->getDisplayCrds(v2, fact); float d1 = 0.0; float d2 = 0.0; int res = 0; if (displayMode > 0) { res += theViewer.drawLine(v1, v2, d1, d1, this->getTag(), 0); } else if (displayMode < 0) { theNodes[0]->getDisplayCrds(v1, 0.); theNodes[1]->getDisplayCrds(v2, 0.); // add eigenvector values int mode = displayMode * -1; const Matrix &eigen1 = theNodes[0]->getEigenvectors(); const Matrix &eigen2 = theNodes[1]->getEigenvectors(); if (eigen1.noCols() >= mode) { for (int i = 0; i < 3; i++) { v1(i) += eigen1(i,mode-1)*fact; v2(i) += eigen2(i,mode-1)*fact; } } return theViewer.drawLine (v1, v2, 0.0, 0.0, this->getTag(), 0); } if (numMode > 0) { // calculate q for potential need below this->getResistingForce(); } for (int i=0; i<numMode; i++) { const char *theMode = modes[i]; if (strcmp(theMode, "axialForce") == 0) { d1 = q(0); d2 = q(0);; res +=theViewer.drawLine(v1, v2, d1, d1, this->getTag(), i); } else if (strcmp(theMode, "endMoments") == 0) { d1 = q(1); d2 = q(2); static Vector delta(3); delta = v2-v1; delta/=10; res += theViewer.drawPoint(v1+delta, d1, this->getTag(), i); res += theViewer.drawPoint(v2-delta, d2, this->getTag(), i); } } return res; }
int Truss2::displaySelf(Renderer &theViewer, int displayMode, float fact, const char **modes, int numMode) { // ensure setDomain() worked if (L == 0.0) return 0; // first determine the two end points of the truss based on // the display factor (a measure of the distorted image) // store this information in 2 3d vectors v1 and v2 const Vector &end1Crd = theNodes[0]->getCrds(); const Vector &end2Crd = theNodes[1]->getCrds(); static Vector v1(3); static Vector v2(3); if (displayMode == 1 || displayMode == 2) { const Vector &end1Disp = theNodes[0]->getDisp(); const Vector &end2Disp = theNodes[1]->getDisp(); for (int i=0; i<dimension; i++) { v1(i) = end1Crd(i)+end1Disp(i)*fact; v2(i) = end2Crd(i)+end2Disp(i)*fact; } // compute the strain and axial force in the member double strain, force; if (L == 0.0) { strain = 0.0; force = 0.0; } else { strain = this->computeCurrentStrain(); theMaterial->setTrialStrain(strain); force = A*theMaterial->getStress(); } if (displayMode == 2) // use the strain as the drawing measure return theViewer.drawLine(v1, v2, (float)strain, (float)strain); else { // otherwise use the axial force as measure return theViewer.drawLine(v1,v2, (float)force, (float)force); } } else if (displayMode < 0) { int mode = displayMode * -1; const Matrix &eigen1 = theNodes[0]->getEigenvectors(); const Matrix &eigen2 = theNodes[1]->getEigenvectors(); if (eigen1.noCols() >= mode) { for (int i = 0; i < dimension; i++) { v1(i) = end1Crd(i) + eigen1(i,mode-1)*fact; v2(i) = end2Crd(i) + eigen2(i,mode-1)*fact; } } else { for (int i = 0; i < dimension; i++) { v1(i) = end1Crd(i); v2(i) = end2Crd(i); } } return theViewer.drawLine(v1, v2, 1.0, 1.0); } return 0; }
int Adapter::displaySelf(Renderer &theViewer, int displayMode, float fact) { int rValue = 0, i, j; if (numExternalNodes > 1) { if (displayMode >= 0) { for (i=0; i<numExternalNodes-1; i++) { const Vector &end1Crd = theNodes[i]->getCrds(); const Vector &end2Crd = theNodes[i+1]->getCrds(); const Vector &end1Disp = theNodes[i]->getDisp(); const Vector &end2Disp = theNodes[i+1]->getDisp(); int end1NumCrds = end1Crd.Size(); int end2NumCrds = end2Crd.Size(); static Vector v1(3), v2(3); for (j=0; j<end1NumCrds; j++) v1(j) = end1Crd(j) + end1Disp(j)*fact; for (j=0; j<end2NumCrds; j++) v2(j) = end2Crd(j) + end2Disp(j)*fact; rValue += theViewer.drawLine(v1, v2, 1.0, 1.0); } } else { int mode = displayMode * -1; for (i=0; i<numExternalNodes-1; i++) { const Vector &end1Crd = theNodes[i]->getCrds(); const Vector &end2Crd = theNodes[i+1]->getCrds(); const Matrix &eigen1 = theNodes[i]->getEigenvectors(); const Matrix &eigen2 = theNodes[i+1]->getEigenvectors(); int end1NumCrds = end1Crd.Size(); int end2NumCrds = end2Crd.Size(); static Vector v1(3), v2(3); if (eigen1.noCols() >= mode) { for (j=0; j<end1NumCrds; j++) v1(j) = end1Crd(j) + eigen1(j,mode-1)*fact; for (j=0; j<end2NumCrds; j++) v2(j) = end2Crd(j) + eigen2(j,mode-1)*fact; } else { for (j=0; j<end1NumCrds; j++) v1(j) = end1Crd(j); for (j=0; j<end2NumCrds; j++) v2(j) = end2Crd(j); } rValue += theViewer.drawLine(v1, v2, 1.0, 1.0); } } } return rValue; }
int PFEMElement2D::displaySelf(Renderer &theViewer, int displayMode, float fact, const char **displayModes, int numModes) { static Vector values(3); // now determine the end points of the Tri31 based on // the display factor (a measure of the distorted image) // store this information in 3 3d vectors v1 through v3 const Vector &end1Crd = nodes[0]->getCrds(); const Vector &end2Crd = nodes[2]->getCrds(); const Vector &end3Crd = nodes[4]->getCrds(); const int numnodes = 3; static Matrix coords(numnodes,3); if (displayMode >= 0) { const Vector &end1Disp = nodes[0]->getDisp(); const Vector &end2Disp = nodes[2]->getDisp(); const Vector &end3Disp = nodes[4]->getDisp(); for (int i = 0; i < 2; i++) { coords(0,i) = end1Crd(i) + end1Disp(i)*fact; coords(1,i) = end2Crd(i) + end2Disp(i)*fact; coords(2,i) = end3Crd(i) + end3Disp(i)*fact; } } else { int mode = displayMode * -1; const Matrix &eigen1 = nodes[0]->getEigenvectors(); const Matrix &eigen2 = nodes[2]->getEigenvectors(); const Matrix &eigen3 = nodes[4]->getEigenvectors(); if (eigen1.noCols() >= mode) { for (int i = 0; i < 2; i++) { coords(0,i) = end1Crd(i) + eigen1(i,mode-1)*fact; coords(1,i) = end2Crd(i) + eigen2(i,mode-1)*fact; coords(2,i) = end3Crd(i) + eigen3(i,mode-1)*fact; } } else { for (int i = 0; i < 2; i++) { coords(0,i) = end1Crd(i); coords(1,i) = end2Crd(i); coords(2,i) = end3Crd(i); } } } int error = 0; // finally we draw the element using drawPolygon error += theViewer.drawPolygon (coords, values); return error; }
int Quad4FiberOverlay::displaySelf(Renderer &theViewer, int displayMode, float fact) { int dimension = 2; static Vector v1(3); static Vector v2(3); if (displayMode == 1 || displayMode == 2) { const Vector &end1Disp = theNodes[0]->getDisp(); const Vector &end2Disp = theNodes[1]->getDisp(); for (int i=0; i<dimension; i++) { v1(i) = Qfi(i)+end1Disp(i)*fact; v2(i) = Qfj(i)+end2Disp(i)*fact; } // compute the strain and axial force in the member double strain, force; if (Lf == 0.0) { strain = 0.0; force = 0.0; } else { strain = this->computeCurrentStrain(); theMaterial->setTrialStrain(strain); force = Af*theMaterial->getStress(); } if (displayMode == 2) // use the strain as the drawing measure return theViewer.drawLine(v1, v2, (float)strain, (float)strain); else { // otherwise use the axial force as measure return theViewer.drawLine(v1,v2, (float)force, (float)force); } } else if (displayMode < 0) { int mode = displayMode * -1; const Matrix &eigen1 = theNodes[0]->getEigenvectors(); const Matrix &eigen2 = theNodes[1]->getEigenvectors(); if (eigen1.noCols() >= mode) { for (int i = 0; i < dimension; i++) { v1(i) = Qfi(i) + eigen1(i,mode-1)*fact; v2(i) = Qfj(i) + eigen2(i,mode-1)*fact; } } else { for (int i = 0; i < dimension; i++) { v1(i) = Qfi(i); v2(i) = Qfj(i); } } return theViewer.drawLine(v1, v2, 1.0, 1.0); } return 0; }
int ElastomericBearingBoucWen2d::displaySelf(Renderer &theViewer, int displayMode, float fact) { // first determine the end points of the element based on // the display factor (a measure of the distorted image) const Vector &end1Crd = theNodes[0]->getCrds(); const Vector &end2Crd = theNodes[1]->getCrds(); static Vector v1(3); static Vector v2(3); if (displayMode >= 0) { const Vector &end1Disp = theNodes[0]->getDisp(); const Vector &end2Disp = theNodes[1]->getDisp(); for (int i=0; i<2; i++) { v1(i) = end1Crd(i) + end1Disp(i)*fact; v2(i) = end2Crd(i) + end2Disp(i)*fact; } } else { int mode = displayMode * -1; const Matrix &eigen1 = theNodes[0]->getEigenvectors(); const Matrix &eigen2 = theNodes[1]->getEigenvectors(); if (eigen1.noCols() >= mode) { for (int i=0; i<2; i++) { v1(i) = end1Crd(i) + eigen1(i,mode-1)*fact; v2(i) = end2Crd(i) + eigen2(i,mode-1)*fact; } } else { for (int i=0; i<2; i++) { v1(i) = end1Crd(i); v2(i) = end2Crd(i); } } } return theViewer.drawLine (v1, v2, 1.0, 1.0); }
int FourNodeQuadWithSensitivity::displaySelf(Renderer &theViewer, int displayMode, float fact) { // first set the quantity to be displayed at the nodes; // if displayMode is 1 through 3 we will plot material stresses otherwise 0.0 static Vector values(4); for (int j=0; j<4; j++) values(j) = 0.0; if (displayMode < 4 && displayMode > 0) { for (int i=0; i<4; i++) { const Vector &stress = theMaterial[i]->getStress(); values(i) = stress(displayMode-1); } } // now determine the end points of the quad based on // the display factor (a measure of the distorted image) // store this information in 4 3d vectors v1 through v4 const Vector &end1Crd = theNodes[0]->getCrds(); const Vector &end2Crd = theNodes[1]->getCrds(); const Vector &end3Crd = theNodes[2]->getCrds(); const Vector &end4Crd = theNodes[3]->getCrds(); static Matrix coords(4,3); if (displayMode >= 0) { const Vector &end1Disp = theNodes[0]->getDisp(); const Vector &end2Disp = theNodes[1]->getDisp(); const Vector &end3Disp = theNodes[2]->getDisp(); const Vector &end4Disp = theNodes[3]->getDisp(); for (int i = 0; i < 2; i++) { coords(0,i) = end1Crd(i) + end1Disp(i)*fact; coords(1,i) = end2Crd(i) + end2Disp(i)*fact; coords(2,i) = end3Crd(i) + end3Disp(i)*fact; coords(3,i) = end4Crd(i) + end4Disp(i)*fact; } } else { int mode = displayMode * -1; const Matrix &eigen1 = theNodes[0]->getEigenvectors(); const Matrix &eigen2 = theNodes[1]->getEigenvectors(); const Matrix &eigen3 = theNodes[2]->getEigenvectors(); const Matrix &eigen4 = theNodes[3]->getEigenvectors(); if (eigen1.noCols() >= mode) { for (int i = 0; i < 2; i++) { coords(0,i) = end1Crd(i) + eigen1(i,mode-1)*fact; coords(1,i) = end2Crd(i) + eigen2(i,mode-1)*fact; coords(2,i) = end3Crd(i) + eigen3(i,mode-1)*fact; coords(3,i) = end4Crd(i) + eigen4(i,mode-1)*fact; } } else { for (int i = 0; i < 2; i++) { coords(0,i) = end1Crd(i); coords(1,i) = end2Crd(i); coords(2,i) = end3Crd(i); coords(3,i) = end4Crd(i); } } } int error = 0; // finally we draw the element using drawPolygon error += theViewer.drawPolygon (coords, values); return error; }
int PFEMElement2DBubble::displaySelf(Renderer &theViewer, int displayMode, float fact, const char **displayModes, int numModes) { // first set the quantity to be displayed at the nodes; // if displayMode is 1 through 3 we will plot material stresses otherwise 0.0 /* static Vector values(numgp); for (int j=0; j<numgp; j++) values(j) = 0.0; if (displayMode < numgp && displayMode > 0) { for (int i=0; i<numgp; i++) { const Vector &stress = theMaterial[i]->getStress(); values(i) = stress(displayMode-1); } } */ static Vector values(3); // now determine the end points of the Tri31 based on // the display factor (a measure of the distorted image) // store this information in 3 3d vectors v1 through v3 const Vector &end1Crd = nodes[0]->getCrds(); const Vector &end2Crd = nodes[2]->getCrds(); const Vector &end3Crd = nodes[4]->getCrds(); const int numnodes = 3; static Matrix coords(numnodes,3); if (displayMode >= 0) { const Vector &end1Disp = nodes[0]->getDisp(); const Vector &end2Disp = nodes[2]->getDisp(); const Vector &end3Disp = nodes[4]->getDisp(); for (int i = 0; i < 2; i++) { coords(0,i) = end1Crd(i) + end1Disp(i)*fact; coords(1,i) = end2Crd(i) + end2Disp(i)*fact; coords(2,i) = end3Crd(i) + end3Disp(i)*fact; } } else { int mode = displayMode * -1; const Matrix &eigen1 = nodes[0]->getEigenvectors(); const Matrix &eigen2 = nodes[2]->getEigenvectors(); const Matrix &eigen3 = nodes[4]->getEigenvectors(); if (eigen1.noCols() >= mode) { for (int i = 0; i < 2; i++) { coords(0,i) = end1Crd(i) + eigen1(i,mode-1)*fact; coords(1,i) = end2Crd(i) + eigen2(i,mode-1)*fact; coords(2,i) = end3Crd(i) + eigen3(i,mode-1)*fact; } } else { for (int i = 0; i < 2; i++) { coords(0,i) = end1Crd(i); coords(1,i) = end2Crd(i); coords(2,i) = end3Crd(i); } } } int error = 0; // finally we draw the element using drawPolygon error += theViewer.drawPolygon (coords, values); return error; }
int TrussSection::displaySelf(Renderer &theViewer, int displayMode, float fact) { // ensure setDomain() worked if (L == 0.0) return 0; // first determine the two end points of the truss based on // the display factor (a measure of the distorted image) // store this information in 2 3d vectors v1 and v2 const Vector &end1Crd = theNodes[0]->getCrds(); const Vector &end2Crd = theNodes[1]->getCrds(); static Vector v1(3); static Vector v2(3); if (displayMode == 1 || displayMode == 2) { const Vector &end1Disp = theNodes[0]->getDisp(); const Vector &end2Disp = theNodes[1]->getDisp(); for (int i=0; i<dimension; i++) { v1(i) = end1Crd(i)+end1Disp(i)*fact; v2(i) = end2Crd(i)+end2Disp(i)*fact; } // compute the strain and axial force in the member double strain, force; if (L == 0.0) { strain = 0.0; force = 0.0; } else { strain = this->computeCurrentStrain(); force = 0.0; int order = theSection->getOrder(); const ID &code = theSection->getType(); Vector e (order); int i; for (i = 0; i < order; i++) { if (code(i) == SECTION_RESPONSE_P) e(i) = strain; } theSection->setTrialSectionDeformation(e); const Vector &s = theSection->getStressResultant(); for (i = 0; i < order; i++) { if (code(i) == SECTION_RESPONSE_P) force += s(i); } } if (displayMode == 2) // use the strain as the drawing measure return theViewer.drawLine(v1, v2, (float)strain, (float)strain); else { // otherwise use the axial force as measure return theViewer.drawLine(v1,v2, (float)force, (float)force); } } else if (displayMode < 0) { int mode = displayMode * -1; const Matrix &eigen1 = theNodes[0]->getEigenvectors(); const Matrix &eigen2 = theNodes[1]->getEigenvectors(); if (eigen1.noCols() >= mode) { for (int i = 0; i < dimension; i++) { v1(i) = end1Crd(i) + eigen1(i,mode-1)*fact; v2(i) = end2Crd(i) + eigen2(i,mode-1)*fact; } } else { for (int i = 0; i < dimension; i++) { v1(i) = end1Crd(i); v2(i) = end2Crd(i); } } } return 0; }
int ShellMITC9::displaySelf(Renderer &theViewer, int displayMode, float fact, const char **modes, int numMode) { // first determine the end points of the quad based on // the display factor (a measure of the distorted image) // store this information in 4 3d vectors v1 through v4 const Vector &end1Crd = nodePointers[0]->getCrds(); const Vector &end2Crd = nodePointers[1]->getCrds(); const Vector &end3Crd = nodePointers[2]->getCrds(); const Vector &end4Crd = nodePointers[3]->getCrds(); static Matrix coords(4,3); static Vector values(4); static Vector P(54) ; for (int j=0; j<9; j++) values(j) = 0.0; if (displayMode >= 0) { const Vector &end1Disp = nodePointers[0]->getDisp(); const Vector &end2Disp = nodePointers[1]->getDisp(); const Vector &end3Disp = nodePointers[2]->getDisp(); const Vector &end4Disp = nodePointers[3]->getDisp(); if (displayMode < 8 && displayMode > 0) { for (int i=0; i<4; i++) { const Vector &stress = materialPointers[i]->getStressResultant(); values(i) = stress(displayMode-1); } } for (int i = 0; i < 3; i++) { coords(0,i) = end1Crd(i) + end1Disp(i)*fact; coords(1,i) = end2Crd(i) + end2Disp(i)*fact; coords(2,i) = end3Crd(i) + end3Disp(i)*fact; coords(3,i) = end4Crd(i) + end4Disp(i)*fact; } } else { int mode = displayMode * -1; const Matrix &eigen1 = nodePointers[0]->getEigenvectors(); const Matrix &eigen2 = nodePointers[1]->getEigenvectors(); const Matrix &eigen3 = nodePointers[2]->getEigenvectors(); const Matrix &eigen4 = nodePointers[3]->getEigenvectors(); if (eigen1.noCols() >= mode) { for (int i = 0; i < 3; i++) { coords(0,i) = end1Crd(i) + eigen1(i,mode-1)*fact; coords(1,i) = end2Crd(i) + eigen2(i,mode-1)*fact; coords(2,i) = end3Crd(i) + eigen3(i,mode-1)*fact; coords(3,i) = end4Crd(i) + eigen4(i,mode-1)*fact; } } else { for (int i = 0; i < 3; i++) { coords(0,i) = end1Crd(i); coords(1,i) = end2Crd(i); coords(2,i) = end3Crd(i); coords(3,i) = end4Crd(i); } } } int error = 0; error += theViewer.drawPolygon (coords, values); return error; }
int ConstantPressureVolumeQuad::displaySelf(Renderer &theViewer, int displayMode, float fact, const char **mode, int numModes) { // first determine the end points of the quad based on // the display factor (a measure of the distorted image) // store this information in 4 3d vectors v1 through v4 const Vector &end1Crd = nodePointers[0]->getCrds(); const Vector &end2Crd = nodePointers[1]->getCrds(); const Vector &end3Crd = nodePointers[2]->getCrds(); const Vector &end4Crd = nodePointers[3]->getCrds(); static Matrix coords(4,3) ; static Vector values(4) ; coords.Zero( ) ; values(0) = 1 ; values(1) = 1 ; values(2) = 1 ; values(3) = 1 ; if (displayMode >= 0) { const Vector &end1Disp = nodePointers[0]->getDisp(); const Vector &end2Disp = nodePointers[1]->getDisp(); const Vector &end3Disp = nodePointers[2]->getDisp(); const Vector &end4Disp = nodePointers[3]->getDisp(); for (int i = 0; i < 2; i++) { coords(0,i) = end1Crd(i) + end1Disp(i)*fact; coords(1,i) = end2Crd(i) + end2Disp(i)*fact; coords(2,i) = end3Crd(i) + end3Disp(i)*fact; coords(3,i) = end4Crd(i) + end4Disp(i)*fact; } } else { int mode = displayMode * -1; const Matrix &eigen1 = nodePointers[0]->getEigenvectors(); const Matrix &eigen2 = nodePointers[1]->getEigenvectors(); const Matrix &eigen3 = nodePointers[2]->getEigenvectors(); const Matrix &eigen4 = nodePointers[3]->getEigenvectors(); if (eigen1.noCols() >= mode) { for (int i = 0; i < 2; i++) { coords(0,i) = end1Crd(i) + eigen1(i,mode-1)*fact; coords(1,i) = end2Crd(i) + eigen2(i,mode-1)*fact; coords(2,i) = end3Crd(i) + eigen3(i,mode-1)*fact; coords(3,i) = end4Crd(i) + eigen4(i,mode-1)*fact; } } else { for (int i = 0; i < 2; i++) { coords(0,i) = end1Crd(i); coords(1,i) = end2Crd(i); coords(2,i) = end3Crd(i); coords(3,i) = end4Crd(i); } } } //opserr << coords; int error = 0; error += theViewer.drawPolygon (coords, values); return error; }
int BbarBrick::displaySelf(Renderer &theViewer, int displayMode, float fact) { const Vector &end1Crd = nodePointers[0]->getCrds(); const Vector &end2Crd = nodePointers[1]->getCrds(); const Vector &end3Crd = nodePointers[2]->getCrds(); const Vector &end4Crd = nodePointers[3]->getCrds(); const Vector &end5Crd = nodePointers[4]->getCrds(); const Vector &end6Crd = nodePointers[5]->getCrds(); const Vector &end7Crd = nodePointers[6]->getCrds(); const Vector &end8Crd = nodePointers[7]->getCrds(); static Matrix coords(4,3); static Vector values(4); static Vector P(24) ; values(0) = 1 ; values(1) = 1 ; values(2) = 1 ; values(3) = 1 ; int error = 0; int i; if (displayMode >= 0) { const Vector &end1Disp = nodePointers[0]->getDisp(); const Vector &end2Disp = nodePointers[1]->getDisp(); const Vector &end3Disp = nodePointers[2]->getDisp(); const Vector &end4Disp = nodePointers[3]->getDisp(); const Vector &end5Disp = nodePointers[4]->getDisp(); const Vector &end6Disp = nodePointers[5]->getDisp(); const Vector &end7Disp = nodePointers[6]->getDisp(); const Vector &end8Disp = nodePointers[7]->getDisp(); if (displayMode < 3 && displayMode > 0) P = this->getResistingForce(); for (i = 0; i < 3; i++) { coords(0,i) = end1Crd(i) + end1Disp(i)*fact; coords(1,i) = end2Crd(i) + end2Disp(i)*fact; coords(2,i) = end3Crd(i) + end3Disp(i)*fact; coords(3,i) = end4Crd(i) + end4Disp(i)*fact; } error += theViewer.drawPolygon (coords, values); for (i = 0; i < 3; i++) { coords(0,i) = end5Crd(i) + end5Disp(i)*fact; coords(1,i) = end6Crd(i) + end6Disp(i)*fact; coords(2,i) = end7Crd(i) + end7Disp(i)*fact; coords(3,i) = end8Crd(i) + end8Disp(i)*fact; } error += theViewer.drawPolygon (coords, values); for (i = 0; i < 3; i++) { coords(0,i) = end1Crd(i) + end1Disp(i)*fact; coords(1,i) = end4Crd(i) + end4Disp(i)*fact; coords(2,i) = end8Crd(i) + end8Disp(i)*fact; coords(3,i) = end5Crd(i) + end5Disp(i)*fact; } error += theViewer.drawPolygon (coords, values); for (i = 0; i < 3; i++) { coords(0,i) = end2Crd(i) + end2Disp(i)*fact; coords(1,i) = end3Crd(i) + end3Disp(i)*fact; coords(2,i) = end7Crd(i) + end7Disp(i)*fact; coords(3,i) = end6Crd(i) + end6Disp(i)*fact; } error += theViewer.drawPolygon (coords, values); for (i = 0; i < 3; i++) { coords(0,i) = end1Crd(i) + end1Disp(i)*fact; coords(1,i) = end2Crd(i) + end2Disp(i)*fact; coords(2,i) = end6Crd(i) + end6Disp(i)*fact; coords(3,i) = end5Crd(i) + end5Disp(i)*fact; } error += theViewer.drawPolygon (coords, values); for (i = 0; i < 3; i++) { coords(0,i) = end4Crd(i) + end4Disp(i)*fact; coords(1,i) = end3Crd(i) + end3Disp(i)*fact; coords(2,i) = end7Crd(i) + end7Disp(i)*fact; coords(3,i) = end8Crd(i) + end8Disp(i)*fact; } error += theViewer.drawPolygon (coords, values); } else { int mode = displayMode * -1; const Matrix &eigen1 = nodePointers[0]->getEigenvectors(); const Matrix &eigen2 = nodePointers[1]->getEigenvectors(); const Matrix &eigen3 = nodePointers[2]->getEigenvectors(); const Matrix &eigen4 = nodePointers[3]->getEigenvectors(); const Matrix &eigen5 = nodePointers[4]->getEigenvectors(); const Matrix &eigen6 = nodePointers[5]->getEigenvectors(); const Matrix &eigen7 = nodePointers[6]->getEigenvectors(); const Matrix &eigen8 = nodePointers[7]->getEigenvectors(); if (eigen1.noCols() >= mode) { for (i = 0; i < 3; i++) { coords(0,i) = end1Crd(i) + eigen1(i,mode-1)*fact; coords(1,i) = end2Crd(i) + eigen2(i,mode-1)*fact; coords(2,i) = end3Crd(i) + eigen3(i,mode-1)*fact; coords(3,i) = end4Crd(i) + eigen4(i,mode-1)*fact; } error += theViewer.drawPolygon (coords, values); for (i = 0; i < 3; i++) { coords(0,i) = end5Crd(i) + eigen5(i,mode-1)*fact; coords(1,i) = end6Crd(i) + eigen6(i,mode-1)*fact; coords(2,i) = end7Crd(i) + eigen7(i,mode-1)*fact; coords(3,i) = end8Crd(i) + eigen8(i,mode-1)*fact; } error += theViewer.drawPolygon (coords, values); for (i = 0; i < 3; i++) { coords(0,i) = end1Crd(i) + eigen1(i,mode-1)*fact; coords(1,i) = end4Crd(i) + eigen4(i,mode-1)*fact; coords(2,i) = end8Crd(i) + eigen8(i,mode-1)*fact; coords(3,i) = end5Crd(i) + eigen5(i,mode-1)*fact; } error += theViewer.drawPolygon (coords, values); for (i = 0; i < 3; i++) { coords(0,i) = end2Crd(i) + eigen2(i,mode-1)*fact; coords(1,i) = end3Crd(i) + eigen3(i,mode-1)*fact; coords(2,i) = end7Crd(i) + eigen7(i,mode-1)*fact; coords(3,i) = end6Crd(i) + eigen6(i,mode-1)*fact; } error += theViewer.drawPolygon (coords, values); for (i = 0; i < 3; i++) { coords(0,i) = end1Crd(i) + eigen1(i,mode-1)*fact; coords(1,i) = end2Crd(i) + eigen2(i,mode-1)*fact; coords(2,i) = end6Crd(i) + eigen6(i,mode-1)*fact; coords(3,i) = end5Crd(i) + eigen5(i,mode-1)*fact; } error += theViewer.drawPolygon (coords, values); for (i = 0; i < 3; i++) { coords(0,i) = end4Crd(i) + eigen4(i,mode-1)*fact; coords(1,i) = end3Crd(i) + eigen3(i,mode-1)*fact; coords(2,i) = end7Crd(i) + eigen7(i,mode-1)*fact; coords(3,i) = end8Crd(i) + eigen8(i,mode-1)*fact; } error += theViewer.drawPolygon (coords, values); } else { values.Zero(); for (i = 0; i < 3; i++) { coords(0,i) = end1Crd(i); coords(1,i) = end2Crd(i); coords(2,i) = end3Crd(i); coords(3,i) = end4Crd(i); } error += theViewer.drawPolygon (coords, values); for (i = 0; i < 3; i++) { coords(0,i) = end5Crd(i); coords(1,i) = end6Crd(i); coords(2,i) = end7Crd(i); coords(3,i) = end8Crd(i); } error += theViewer.drawPolygon (coords, values); for (i = 0; i < 3; i++) { coords(0,i) = end1Crd(i); coords(1,i) = end4Crd(i); coords(2,i) = end8Crd(i); coords(3,i) = end5Crd(i); } error += theViewer.drawPolygon (coords, values); for (i = 0; i < 3; i++) { coords(0,i) = end2Crd(i); coords(1,i) = end3Crd(i); coords(2,i) = end7Crd(i); coords(3,i) = end6Crd(i); } error += theViewer.drawPolygon (coords, values); for (i = 0; i < 3; i++) { coords(0,i) = end1Crd(i); coords(1,i) = end2Crd(i); coords(2,i) = end6Crd(i); coords(3,i) = end5Crd(i); } error += theViewer.drawPolygon (coords, values); for (i = 0; i < 3; i++) { coords(0,i) = end4Crd(i); coords(1,i) = end3Crd(i); coords(2,i) = end7Crd(i); coords(3,i) = end8Crd(i); } error += theViewer.drawPolygon (coords, values); } } return error; }
int N4BiaxialTruss::displaySelf(Renderer &theViewer, int displayMode, float fact) { // ensure setDomain() worked if (L == 0.0) return 0; // first determine the two end points of the N4BiaxialTruss based on // the display factor (a measure of the distorted image) // store this information in 2 3d vectors v1 and v2 const Vector &end1Crd = theNodes[0]->getCrds(); const Vector &end2Crd = theNodes[1]->getCrds(); const Vector &end3Crd = theNodes[3]->getCrds(); const Vector &end4Crd = theNodes[4]->getCrds(); static Vector v1(3); static Vector v2(3); static Vector v3(3); static Vector v4(3); int retVal = 0; if (displayMode == 1 || displayMode == 2) { const Vector &end1Disp = theNodes[0]->getDisp(); const Vector &end2Disp = theNodes[1]->getDisp(); const Vector &end3Disp = theNodes[3]->getDisp(); const Vector &end4Disp = theNodes[4]->getDisp(); for (int i=0; i<dimension; i++) { v1(i) = end1Crd(i)+end1Disp(i)*fact; v2(i) = end2Crd(i)+end2Disp(i)*fact; v3(i) = end3Crd(i)+end3Disp(i)*fact; v4(i) = end4Crd(i)+end4Disp(i)*fact; } // compute the strain and axial force in the member double force1, force2; if (L == 0.0) { strain_1 = 0.0; strain_2 = 0.0; force1 = 0.0; force2 = 0.0; } else { this->computeCurrentStrainBiaxial(); theMaterial_1->setTrialStrain(strain_1); theMaterial_2->setTrialStrain(strain_2); force1 = A*theMaterial_1->getStress(); force2 = A*theMaterial_2->getStress(); } if (displayMode == 2) {// use the strain as the drawing measure retVal += theViewer.drawLine(v1, v2, (float)strain_1, (float)strain_1); retVal += theViewer.drawLine(v3, v4, (float)strain_2, (float)strain_2); } else { // otherwise use the axial force as measure retVal += theViewer.drawLine(v1, v2, (float)force1, (float)force1); retVal += theViewer.drawLine(v3, v4, (float)force2, (float)force2); } return retVal; } else if (displayMode < 0) { int mode = displayMode * -1; const Matrix &eigen1 = theNodes[0]->getEigenvectors(); const Matrix &eigen2 = theNodes[1]->getEigenvectors(); const Matrix &eigen3 = theNodes[3]->getEigenvectors(); const Matrix &eigen4 = theNodes[4]->getEigenvectors(); if (eigen1.noCols() >= mode) { for (int i = 0; i < dimension; i++) { v1(i) = end1Crd(i) + eigen1(i,mode-1)*fact; v2(i) = end2Crd(i) + eigen2(i,mode-1)*fact; v3(i) = end3Crd(i) + eigen3(i,mode-1)*fact; v4(i) = end4Crd(i) + eigen4(i,mode-1)*fact; } } else { for (int i = 0; i < dimension; i++) { v1(i) = end1Crd(i); v2(i) = end2Crd(i); v3(i) = end3Crd(i); v4(i) = end4Crd(i); } } retVal += theViewer.drawLine(v1, v2, 1.0, 1.0); retVal += theViewer.drawLine(v3, v4, 1.0, 1.0); return retVal; } return 0; }