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 <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
00049 }
00050
00051
00052 ConstantSeries::~ConstantSeries()
00053 {
00054
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 cerr << "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 cerr << "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(ostream &s, int flag)
00093 {
00094 s << "Constant Series: factor: " << cFactor << "\n";
00095
00096 }