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 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 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 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 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; }