Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

RectangularSeries.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.1.1.1 $
00022 // $Date: 2000/09/15 08:23:19 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/domain/pattern/RectangularSeries.cpp,v $
00024                                                                         
00025                                                                         
00026 // File: ~/domain/pattern/RectangularSeries.C
00027 //
00028 // Written: fmk 
00029 // Created: 07/99
00030 // Revision: A
00031 //
00032 // Purpose: This file contains the class implementation of RectangularSeries.
00033 //
00034 // What: "@(#) RectangularSeries.C, revA"
00035 
00036 
00037 #include <RectangularSeries.h>
00038 #include <Vector.h>
00039 #include <Channel.h>
00040 
00041 RectangularSeries::RectangularSeries(double startTime, double finishTime,
00042       double theFactor)
00043   :TimeSeries(TSERIES_TAG_RectangularSeries),
00044    tStart(startTime),tFinish(finishTime),cFactor(theFactor)
00045 {
00046   // does nothing
00047 }
00048 
00049 RectangularSeries::RectangularSeries()
00050   :TimeSeries(TSERIES_TAG_RectangularSeries),
00051    tStart(0),tFinish(0),cFactor(0)
00052 {
00053   // does nothing
00054 }
00055 
00056 
00057 RectangularSeries::~RectangularSeries()
00058 {
00059   // does nothing
00060 }
00061 
00062 double
00063 RectangularSeries::getFactor(double pseudoTime)
00064 { 
00065   if (pseudoTime >= tStart && pseudoTime <= tFinish)
00066     return cFactor;
00067   else
00068     return 0;
00069 }
00070 
00071 int
00072 RectangularSeries::sendSelf(int commitTag, Channel &theChannel)
00073 {
00074   int dbTag = this->getDbTag();
00075   Vector data(3);
00076   data(0) = cFactor;
00077   data(1) = tStart; 
00078   data(2) = tFinish;
00079   int result = theChannel.sendVector(dbTag,commitTag, data);
00080   if (result < 0) {
00081     cerr << "RectangularSeries::sendSelf() - channel failed to send data\n";
00082     return result;
00083   }
00084   return 0;
00085 }
00086 
00087 
00088 int 
00089 RectangularSeries::recvSelf(int commitTag, Channel &theChannel, 
00090          FEM_ObjectBroker &theBroker)
00091 {
00092   int dbTag = this->getDbTag();
00093   Vector data(3);
00094   int result = theChannel.recvVector(dbTag,commitTag, data);
00095   if (result < 0) {
00096     cerr << "RectangularSeries::sendSelf() - channel failed to receive data\n";
00097     cFactor = 1.0;
00098     tStart= 0.0;
00099     tFinish = 0.0;
00100     return result;
00101   }
00102   cFactor = data(0);
00103   tStart = data(1);
00104   tFinish = data(2);
00105 
00106   return 0;    
00107 }
00108 
00109 void
00110 RectangularSeries::Print(ostream &s, int flag)
00111 {
00112     s << "Linear Series: constant factor: " << cFactor;
00113     s << "  tStart: " << tStart << "  tFinish: " << tFinish << endl;
00114 
00115 }
Copyright Contact Us