00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #include <MaxNodeDispRecorder.h>
00040 #include <Domain.h>
00041 #include <Node.h>
00042 #include <Vector.h>
00043 #include <ID.h>
00044
00045 MaxNodeDispRecorder::MaxNodeDispRecorder(int theDof,
00046 const ID &nodes,
00047 Domain &theDom)
00048 :theNodes(nodes), maxDisp(nodes.Size()),
00049 dof(theDof), theDomain(&theDom)
00050 {
00051 if (dof < 0) dof = 0;
00052 }
00053
00054 MaxNodeDispRecorder::~MaxNodeDispRecorder()
00055 {
00056
00057 }
00058
00059 int
00060 MaxNodeDispRecorder::record(int commitTag)
00061 {
00062 for (int i=0; i<theNodes.Size(); i++) {
00063 Node *theNode = theDomain->getNode(theNodes(i));
00064 if (theNode != 0) {
00065 const Vector &theDisp = theNode->getTrialDisp();
00066 if (theDisp.Size() > dof) {
00067 double disp = theDisp(dof);
00068 if (disp > 0 && disp > maxDisp(i))
00069 maxDisp(i) = disp;
00070 else if (disp < 0 && -disp > maxDisp(i))
00071 maxDisp(i) = -disp;
00072 }
00073 }
00074 }
00075 return 0;
00076 }
00077
00078
00079 int
00080 MaxNodeDispRecorder::playback(int commitTag)
00081 {
00082 cerr << "Max Recorded Displacement: " << maxDisp << endl;
00083 return 0;
00084 }
00085
00086
00087 void
00088 MaxNodeDispRecorder::restart(void)
00089 {
00090 maxDisp.Zero();
00091 }
00092