MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / plotData

Method plotData

SRC/recorder/AlgorithmIncrements.cpp:207–360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207int
208AlgorithmIncrements::plotData(const Vector &X, const Vector &B)
209{
210
211 int size = X.Size();
212 if (size < 2)
213 return 0;
214
215 /*
216 * first pass plot the unbalance (B in the SOE):
217 * 1) set the port window to be upper half
218 * 2) determine bounds
219 * 3) draw axis and bounds values
220 * 4) draw points
221 */
222
223 theRenderer->clearImage();
224 theRenderer->setPortWindow(-1.0, 1.0, 0.0, 1.0); // use the whole window
225
226 double xMin, xMax, yMin, yMax;
227 xMin = 0.0;
228 xMax = B.Size();
229 yMin = 0.0;
230 yMax = 0.0;
231 int i;
232
233 for (i=0; i<size; i++) {
234 double value = B(i);
235 if (value < yMin) yMin = value;
236 if (value > yMax) yMax = value;
237 }
238
239 if (-yMin > yMax)
240 yMax = -yMin;
241 else
242 yMin = -yMax;
243
244
245 // set the window bounds NOTE small border around the edges
246 double xBnd = (xMax-xMin)/10;
247 double yBnd = (yMax-yMin)/10;
248
249 theRenderer->setViewWindow(xMin-xBnd,xMax+xBnd,yMin-yBnd,yMax+yBnd);
250 theRenderer->startImage();
251
252 static Vector pt1(3);
253 static Vector pt2(3);
254 pt1(2) = 0.0; pt2(2) = 0.0;
255
256 // draw the x axis
257 pt1(0) = xMin; pt2(0) = xMax;
258 pt1(1) = 0.0; pt2(1) = 0.0;
259 theRenderer->drawLine(pt1, pt2, 0.0, 0.0);
260
261 // draw the y axis
262 pt1(0) = 0.0; pt2(0) = 0.0;
263 pt1(1) = yMin; pt2(1) = yMax;
264 theRenderer->drawLine(pt1, pt2, 0.0, 0.0);

Callers 2

recordMethod · 0.95
playbackMethod · 0.95

Calls 8

SizeMethod · 0.45
clearImageMethod · 0.45
setPortWindowMethod · 0.45
setViewWindowMethod · 0.45
startImageMethod · 0.45
drawLineMethod · 0.45
drawTextMethod · 0.45
doneImageMethod · 0.45

Tested by

no test coverage detected