Skip to content

Commit

Permalink
Merge pull request OpenSees#1431 from mhscott/hysteretic-backbone
Browse files Browse the repository at this point in the history
HystereticBacbkone classes
  • Loading branch information
mhscott authored May 20, 2024
2 parents 5595ec8 + e9cc9c6 commit 467cd73
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 3 deletions.
6 changes: 5 additions & 1 deletion SRC/material/uniaxial/backbone/MaterialBackbone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ MaterialBackbone::sendSelf(int cTag, Channel &theChannel)
}

res += theMaterial->sendSelf(cTag, theChannel);

if (res < 0) {
opserr << "MaterialBackbone::sendSelf -- failed to send material" << endln;
return res;
}

return res;
}

Expand Down
72 changes: 70 additions & 2 deletions SRC/material/uniaxial/backbone/MultilinearBackbone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include <MultilinearBackbone.h>
#include <Vector.h>
#include <ID.h>
#include <Channel.h>

#include <elementAPI.h>
Expand Down Expand Up @@ -235,12 +236,79 @@ MultilinearBackbone::getVariable (int varID, double &theValue)
int
MultilinearBackbone::sendSelf(int commitTag, Channel &theChannel)
{
return -1;
int dbTag = this->getDbTag();

ID idata(2);
idata(0) = this->getTag();
idata(1) = numPoints;

if (theChannel.sendID(dbTag, commitTag, idata) < 0) {
opserr << "MultilinearBackbone::sendSelf - failed to send ID data" << endln;
return -1;
}

Vector data(4*numPoints + 3);
for (int i = 0; i < numPoints; i++) {
data(i) = e[i];
data(numPoints+1 + i) = s[i];
data(2*(numPoints+1) + i) = c[i];
data(3*(numPoints+1) + i) = E[i];
}
data(numPoints) = e[numPoints];
data(2*numPoints+1) = s[numPoints];
data(3*numPoints+2) = c[numPoints];

if (theChannel.sendVector(dbTag, commitTag, data) < 0) {
opserr << "MultilinearBackbone::sendSelf - failed to send data" << endln;
return -2;
}

return 0;
}

int
MultilinearBackbone::recvSelf(int commitTag, Channel &theChannel,
FEM_ObjectBroker &theBroker)
{
return -1;
int dbTag = this->getDbTag();

ID idata(2);

if (theChannel.recvID(dbTag, commitTag, idata) < 0) {
opserr << "MultilinearBackbone::recvSelf -- could not receive ID data" << endln;
return -1;
}

this->setTag(idata(0));
numPoints = idata(1);

Vector data(4*numPoints + 3);
if (theChannel.recvVector(dbTag, commitTag, data) < 0) {
opserr << "MultilinearBackbone::recvSelf -- could not receive data" << endln;
return -2;
}

if (numPoints > 0) {
if (e != 0) delete [] e;
if (s != 0) delete [] s;
if (c != 0) delete [] c;
if (E != 0) delete [] E;

e = new double[numPoints+1];
s = new double[numPoints+1];
c = new double[numPoints+1];
E = new double[numPoints];

for (int i = 0; i < numPoints; i++) {
e[i] = data(i);
s[i] = data(numPoints+1 + i);
c[i] = data(2*(numPoints+1) + i);
E[i] = data(3*(numPoints+1) + i);
}
e[numPoints] = data(numPoints);
s[numPoints] = data(2*numPoints+1);
c[numPoints] = data(3*numPoints+2);
}

return 0;
}

0 comments on commit 467cd73

Please sign in to comment.