MaxNodeDispRecorder.cpp

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 1999, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** ****************************************************************** */
00020                                                                         
00021 // $Revision: 1.5 $
00022 // $Date: 2004/11/24 22:45:28 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/recorder/MaxNodeDispRecorder.cpp,v $
00024                                                                         
00025                                                                         
00026 // File: ~/recorder/MaxNodeDispRecorder.C
00027 //
00028 // Written: fmk 
00029 // Created: 11/98
00030 // Revision: A
00031 //
00032 // Description: This file contains the class definition for MaxNodeDispRecorder.
00033 // A MaxNodeDispRecorder is used to determine the max nodal displacement
00034 // at a collection of nodes over an analysis. (between commitTag of 0 and
00035 // last commitTag).
00036 //
00037 // What: "@(#) MaxNodeDispRecorder.C, revA"
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 :Recorder(RECORDER_TAGS_MaxNodeDispRecorder), 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, double timeStamp)
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     opserr << "Max Recorded Displacement: " << maxDisp << endln;
00083     return 0;
00084 }
00085 
00086 
00087 int
00088 MaxNodeDispRecorder::restart(void)
00089 {
00090     maxDisp.Zero();
00091     return 0;
00092 }
00093 

Generated on Mon Oct 23 15:05:24 2006 for OpenSees by doxygen 1.5.0