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