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
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
00050 }
00051
00052
00053 LinearSeries::~LinearSeries()
00054 {
00055
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 }