Skip to content

Commit

Permalink
Merge pull request OpenSees#1366 from mhscott/surface-load
Browse files Browse the repository at this point in the history
Adding SurfaceLoad and TriSurfaceLoad to object broker
  • Loading branch information
fmckenna authored Mar 19, 2024
2 parents 6606d32 + 1f0cc5d commit b35ead4
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 202 deletions.
8 changes: 8 additions & 0 deletions SRC/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@
#include "UWelements/Quad4FiberOverlay.h"
#include "UWelements/Brick8FiberOverlay.h"
#include "EmbeddedBeamInterfaceL.h"
#include "SurfaceLoad.h"
#include "TriSurfaceLoad.h"

#include "PML/PML2D.h"
#include "PML/PML3D.h"
Expand Down Expand Up @@ -926,6 +928,12 @@ FEM_ObjectBrokerAllClasses::getNewElement(int classTag)
case ELE_TAG_SSPbrickUP:
return new SSPbrickUP();

case ELE_TAG_SurfaceLoad:
return new SurfaceLoad();

case ELE_TAG_TriSurfaceLoad:
return new TriSurfaceLoad();

case ELE_TAG_Quad4FiberOverlay:
return new Quad4FiberOverlay(); //Amin Pakzad

Expand Down
138 changes: 36 additions & 102 deletions SRC/element/surfaceLoad/SurfaceLoad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ SurfaceLoad::SurfaceLoad(int tag, int Nd1, int Nd2, int Nd3, int Nd4, double pre
myExternalNodes(2) = Nd3;
myExternalNodes(3) = Nd4;

MyTag = tag;

GsPts[0][0] = -oneOverRoot3;
GsPts[0][1] = -oneOverRoot3;
GsPts[1][0] = oneOverRoot3;
Expand Down Expand Up @@ -332,70 +330,39 @@ SurfaceLoad::sendSelf(int commitTag, Channel &theChannel)
// object - don't want to have to do the check if sending data
int dataTag = this->getDbTag();

// SurfaceLoad packs it's data into a Vector and sends this to theChannel
// along with it's dbTag and the commitTag passed in the arguments
// SurfaceLoad packs its data into a Vector and sends this to theChannel
// along with its dbTag and the commitTag passed in the arguments

static Vector data(4);
static Vector data(3 + 7*SL_NUM_NDF + SL_NUM_NODE);
data(0) = this->getTag();
data(1) = SL_NUM_DOF;
data(2) = my_pressure;
data(3) = mLoadFactor;

data(1) = my_pressure;
data(2) = mLoadFactor;

for (int i = 0; i < SL_NUM_NDF; i++) {
data(3+ i) = g1(i);
data(3+ SL_NUM_NDF+i) = g2(i);
data(3+2*SL_NUM_NDF+i) = myNhat(i);
data(3+3*SL_NUM_NDF+i) = dcrd1(i);
data(3+4*SL_NUM_NDF+i) = dcrd2(i);
data(3+5*SL_NUM_NDF+i) = dcrd3(i);
data(3+6*SL_NUM_NDF+i) = dcrd4(i);
}
for (int i = 0; i < SL_NUM_NODE; i++)
data(3+7*SL_NUM_NDF+i) = myNI(i);

res = theChannel.sendVector(dataTag, commitTag, data);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::sendSelf() - " << this->getTag() << " failed to send data\n";
return -1;
}

// SurfaceLoad then sends the tags of it's four nodes
// SurfaceLoad then sends the tags of its four nodes
res = theChannel.sendID(dataTag, commitTag, myExternalNodes);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::sendSelf() - " << this->getTag() << " failed to send myExternalNodes\n";
return -2;
}

res = theChannel.sendVector(dataTag, commitTag, g1);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::sendSelf() - " << this->getTag() << " failed to send g1\n";
return -2;
}
res = theChannel.sendVector(dataTag, commitTag, g2);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::sendSelf() - " << this->getTag() << " failed to send g2\n";
return -2;
}
res = theChannel.sendVector(dataTag, commitTag, myNhat);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::sendSelf() - " << this->getTag() << " failed to send myNhat\n";
return -2;
}
res = theChannel.sendVector(dataTag, commitTag, myNI);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::sendSelf() - " << this->getTag() << " failed to send myNI\n";
return -2;
}
res = theChannel.sendVector(dataTag, commitTag, dcrd1);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::sendSelf() - " << this->getTag() << " failed to send dcrd1\n";
return -2;
}
res = theChannel.sendVector(dataTag, commitTag, dcrd2);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::sendSelf() - " << this->getTag() << " failed to send dcrd2\n";
return -2;
}
res = theChannel.sendVector(dataTag, commitTag, dcrd3);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::sendSelf() - " << this->getTag() << " failed to send dcrd3\n";
return -2;
}
res = theChannel.sendVector(dataTag, commitTag, dcrd4);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::sendSelf() - " << this->getTag() << " failed to send dcrd4\n";
return -2;
}


return 0;
}

Expand All @@ -407,69 +374,36 @@ SurfaceLoad::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theB

// SurfaceLoad creates a Vector, receives the Vector and then sets the
// internal data with the data in the Vector
static Vector data(4);
static Vector data(3 + 7*SL_NUM_NDF + SL_NUM_NODE);
res = theChannel.recvVector(dataTag, commitTag, data);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::recvSelf() - failed to receive Vector\n";
return -1;
}

MyTag = data(0);
my_pressure = data(2);
mLoadFactor = data(3);

this->setTag((int)MyTag);

this->setTag(int(data(0)));
my_pressure = data(1);
mLoadFactor = data(2);

for (int i = 0; i < SL_NUM_NDF; i++) {
g1(i) = data(3+ i);
g2(i) = data(3+ SL_NUM_NDF+i);
myNhat(i) = data(3+2*SL_NUM_NDF+i);
dcrd1(i) = data(3+3*SL_NUM_NDF+i);
dcrd2(i) = data(3+4*SL_NUM_NDF+i);
dcrd3(i) = data(3+5*SL_NUM_NDF+i);
dcrd4(i) = data(3+6*SL_NUM_NDF+i);
}
for (int i = 0; i < SL_NUM_NODE; i++)
myNI(i) = data(3+7*SL_NUM_NDF+i);

// SurfaceLoad now receives the tags of it's four external nodes
// SurfaceLoad now receives the tags of its four external nodes
res = theChannel.recvID(dataTag, commitTag, myExternalNodes);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::recvSelf() - " << this->getTag() << " failed to receive ID\n";
return -2;
}

res = theChannel.recvVector(dataTag, commitTag, g1);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::sendSelf() - " << this->getTag() << " failed to receive g1\n";
return -2;
}
res = theChannel.recvVector(dataTag, commitTag, g2);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::sendSelf() - " << this->getTag() << " failed to receive g2\n";
return -2;
}
res = theChannel.recvVector(dataTag, commitTag, myNhat);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::sendSelf() - " << this->getTag() << " failed to receive myNhat\n";
return -2;
}
res = theChannel.recvVector(dataTag, commitTag, myNI);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::sendSelf() - " << this->getTag() << " failed to receive myNI\n";
return -2;
}
res = theChannel.recvVector(dataTag, commitTag, dcrd1);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::sendSelf() - " << this->getTag() << " failed to receive dcrd1\n";
return -2;
}
res = theChannel.recvVector(dataTag, commitTag, dcrd2);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::sendSelf() - " << this->getTag() << " failed to receive dcrd2\n";
return -2;
}
res = theChannel.recvVector(dataTag, commitTag, dcrd3);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::sendSelf() - " << this->getTag() << " failed to receive dcrd3\n";
return -2;
}
res = theChannel.recvVector(dataTag, commitTag, dcrd4);
if (res < 0) {
opserr <<"WARNING SurfaceLoad::sendSelf() - " << this->getTag() << " failed to receive dcrd4\n";
return -2;
}


return 0;
}

Expand Down
2 changes: 0 additions & 2 deletions SRC/element/surfaceLoad/SurfaceLoad.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ class SurfaceLoad : public Element
Vector dcrd3; // current coordinates of node 3
Vector dcrd4; // current coordinates of node 4

int MyTag; // what is my name?

static double oneOverRoot3;
static double GsPts[4][2];

Expand Down
Loading

0 comments on commit b35ead4

Please sign in to comment.