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

LinearSeries.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/LinearSeries.cpp,v $
00024                                                                         
00025                                                                         
00026 // File: ~/domain/pattern/LinearSeries.C
00027 //
00028 // Written: fmk 
00029 // Created: 07/99
00030 // Revision: A
00031 //
00032 // Purpose: This file contains the class definition for LinearSeries.
00033 // LinearSeries is a concrete class. A LinearSeries object provides
00034 // a linear time series. the factor is given by the pseudoTime and 
00035 // a constant factor provided in the constructor.
00036 //
00037 // What: "@(#) LinearSeries.C, revA"
00038 
00039 
00040 #include <LinearSeries.h>
00041 #include <Vector.h>
00042 #include <Channel.h>
00043 
00044 
00045 LinearSeries::LinearSeries(double theFactor)
00046   :TimeSeries(TSERIES_TAG_LinearSeries),
00047    cFactor(theFactor)
00048 {
00049   // does nothing
00050 }
00051 
00052 
00053 LinearSeries::~LinearSeries()
00054 {
00055   // does nothing
00056 }
00057 
00058 double
00059 LinearSeries::getFactor(double pseudoTime)
00060 {
00061   return cFactor*pseudoTime;
00062 }
00063 
00064 
00065 int
00066 LinearSeries::sendSelf(int commitTag, Channel &theChannel)
00067 {
00068   int dbTag = this->getDbTag();
00069 
00070   Vector data(1);
00071   data(0) = cFactor;
00072   int result = theChannel.sendVector(dbTag,commitTag, data);
00073   if (result < 0) {
00074     cerr << "LinearSeries::sendSelf() - channel failed to send data\n";
00075     return result;
00076   }
00077   return 0;
00078 }
00079 
00080 
00081 int 
00082 LinearSeries::recvSelf(int commitTag, Channel &theChannel, 
00083          FEM_ObjectBroker &theBroker)
00084 {
00085   int dbTag = this->getDbTag();
00086   Vector data(1);
00087   int result = theChannel.recvVector(dbTag,commitTag, data);
00088   if (result < 0) {
00089     cerr << "LinearSeries::sendSelf() - channel failed to receive data\n";
00090     cFactor = 1.0;
00091     return result;
00092   }
00093   cFactor = data(0);
00094 
00095   return 0;    
00096 }
00097 
00098 
00099 void
00100 LinearSeries::Print(ostream &s, int flag)
00101 {
00102     s << "Linear Series: constant factor: " << cFactor << "\n";
00103 
00104 }
Copyright Contact Us