diff --git a/SRC/domain/pattern/PathTimeSeries.cpp b/SRC/domain/pattern/PathTimeSeries.cpp index 137bdcb4dc..e42aa6f3f3 100644 --- a/SRC/domain/pattern/PathTimeSeries.cpp +++ b/SRC/domain/pattern/PathTimeSeries.cpp @@ -49,8 +49,7 @@ using std::ios; PathTimeSeries::PathTimeSeries() :TimeSeries(TSERIES_TAG_PathTimeSeries), thePath(0), time(0), currentTimeLoc(0), cFactor(0.0), - dbTag1(0), dbTag2(0), lastSendCommitTag(-1), lastChannel(0), - useLast(false) + dbTag1(0), dbTag2(0), useLast(false) { // does nothing } @@ -62,8 +61,7 @@ PathTimeSeries::PathTimeSeries(int tag, bool last) :TimeSeries(tag, TSERIES_TAG_PathTimeSeries), thePath(0), time(0), currentTimeLoc(0), cFactor(theFactor), - dbTag1(0), dbTag2(0), lastSendCommitTag(-1), lastChannel(0), - useLast(last) + dbTag1(0), dbTag2(0), useLast(last) { // check vectors are of same size if (theLoadPath.Size() != theTimePath.Size()) { @@ -97,8 +95,7 @@ PathTimeSeries::PathTimeSeries(int tag, bool last) :TimeSeries(tag, TSERIES_TAG_PathTimeSeries), thePath(0), time(0), currentTimeLoc(0), cFactor(theFactor), - dbTag1(0), dbTag2(0), lastSendCommitTag(-1), lastChannel(0), - useLast(last) + dbTag1(0), dbTag2(0), useLast(last) { // determine the number of data points int numDataPoints1 =0; @@ -205,8 +202,7 @@ PathTimeSeries::PathTimeSeries(int tag, bool last) :TimeSeries(tag, TSERIES_TAG_PathTimeSeries), thePath(0), time(0), currentTimeLoc(0), cFactor(theFactor), - dbTag1(0), dbTag2(0), lastSendCommitTag(-1), lastChannel(0), - useLast(last) + dbTag1(0), dbTag2(0), useLast(last) { // determine the number of data points int numDataPoints = 0; @@ -408,25 +404,15 @@ PathTimeSeries::sendSelf(int commitTag, Channel &theChannel) int dbTag = this->getDbTag(); Vector data(6+1); data(0) = cFactor; - int size = -1; + int size = thePath->Size(); data(1) = size; - if (thePath != 0) { - size = thePath->Size(); - data(1) = size; - if (dbTag1 == 0) { - dbTag1 = theChannel.getDbTag(); - dbTag2 = theChannel.getDbTag(); - } - data(2) = dbTag1; - data(3) = dbTag2; + if (dbTag1 == 0) { + dbTag1 = theChannel.getDbTag(); + dbTag2 = theChannel.getDbTag(); } - - if ((lastSendCommitTag == -1) && (theChannel.isDatastore() == 1)) { - lastSendCommitTag = commitTag; - } - - data(4) = lastSendCommitTag; + data(2) = dbTag1; + data(3) = dbTag2; if (useLast == true) data(5) = 1; @@ -441,45 +427,26 @@ PathTimeSeries::sendSelf(int commitTag, Channel &theChannel) // we only send the vector data if this is the first time it is sent to the database // or the channel is for sending the data to a remote process - - if (lastChannel != &theChannel || (lastSendCommitTag == commitTag) || (theChannel.isDatastore() == 0)) { - - lastChannel = &theChannel; - - if (size > 0) { - Vector ddata(2*size); - for (int i = 0; i < size; i++) - ddata(i) = (*thePath)(i); - for (int i = 0; i < size; i++) - ddata(size+i) = (*time)(i); - result = theChannel.sendVector(dbTag, commitTag, ddata); - if (result < 0) { - opserr << "PathTimeSeries::sendSelf() - "; - opserr << "channel failed to send the Path Vector\n"; - return result; - } - } - - /* - if (thePath != 0) { - result = theChannel.sendVector(dbTag1, commitTag, *thePath); - if (result < 0) { - opserr << "PathTimeSeries::sendSelf() - "; - opserr << "channel failed to send the Path Vector\n"; - return result; - } + // ... + // Now sending the vector data every time + + if (thePath != 0) { + result = theChannel.sendVector(dbTag1, commitTag, *thePath); + if (result < 0) { + opserr << "PathTimeSeries::sendSelf() - "; + opserr << "channel failed to send the Path Vector\n"; + return result; } - if (time != 0) { - result = theChannel.sendVector(dbTag2, commitTag, *time); - if (result < 0) { - opserr << "PathTimeSeries::sendSelf() - "; - opserr << "channel failed to send the Path Vector\n"; - return result; - } + } + if (time != 0) { + result = theChannel.sendVector(dbTag2, commitTag, *time); + if (result < 0) { + opserr << "PathTimeSeries::sendSelf() - "; + opserr << "channel failed to send the Path Vector\n"; + return result; } - */ - return 0; } + return 0; } @@ -497,17 +464,14 @@ PathTimeSeries::recvSelf(int commitTag, Channel &theChannel, } cFactor = data(0); int size = data(1); - lastSendCommitTag = data(4); if (data(5) == 1) useLast = true; else useLast = false; - // get the data cvector, only receive them once as they cannot change - if (thePath == 0 && size > 0) { - dbTag1 = data(2); - dbTag2 = data(3); + // allocate the data vector if needed + if ((thePath == 0 || time == 0) && size > 0) { thePath = new Vector(size); time = new Vector(size); @@ -524,36 +488,24 @@ PathTimeSeries::recvSelf(int commitTag, Channel &theChannel, time = 0; return -1; } - - if (size > 0) { - Vector ddata(2*size); - result = theChannel.recvVector(dbTag, commitTag, ddata); - if (result < 0) { - opserr << "PathTimeSeries::recvSelf() - "; - opserr << "channel failed to receive the Path/time data Vector\n"; - return result; - } - for (int i = 0; i < size; i++) - (*thePath)(i) = ddata(i); - for (int i = 0; i < size; i++) - (*time)(i) = ddata(size+i); - } - - /* - result = theChannel.recvVector(dbTag1, lastSendCommitTag, *thePath); - if (result < 0) { - opserr << "PathTimeSeries::recvSelf() - "; - opserr << "channel failed to receive the Path Vector\n"; - return result; - } - result = theChannel.recvVector(dbTag2, lastSendCommitTag, *time); - if (result < 0) { - opserr << "PathTimeSeries::recvSelf() - "; - opserr << "channel failed to receive the time Vector\n"; - return result; - } - */ } + + dbTag1 = data(2); + dbTag2 = data(3); + + result = theChannel.recvVector(dbTag1, commitTag, *thePath); + if (result < 0) { + opserr << "PathTimeSeries::recvSelf() - "; + opserr << "channel failed to receive the Path Vector\n"; + return result; + } + result = theChannel.recvVector(dbTag2, commitTag, *time); + if (result < 0) { + opserr << "PathTimeSeries::recvSelf() - "; + opserr << "channel failed to receive the time Vector\n"; + return result; + } + return 0; } diff --git a/SRC/domain/pattern/PathTimeSeries.h b/SRC/domain/pattern/PathTimeSeries.h index d55ea6a9b9..a67d623829 100644 --- a/SRC/domain/pattern/PathTimeSeries.h +++ b/SRC/domain/pattern/PathTimeSeries.h @@ -91,8 +91,6 @@ class PathTimeSeries : public TimeSeries int currentTimeLoc; // current location in time double cFactor; // additional factor on the returned load factor int dbTag1, dbTag2; // additional database tags needed for vector objects - int lastSendCommitTag; - Channel *lastChannel; bool useLast; };