From 2af7027573233c52179bedc5021fda0e22b19965 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Mon, 18 Mar 2024 06:50:04 -0700 Subject: [PATCH 1/5] Adding SurfaceLoad element to object broker --- SRC/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SRC/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp b/SRC/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp index 34888985d6..534a7165d6 100644 --- a/SRC/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp +++ b/SRC/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp @@ -333,6 +333,7 @@ #include "UWelements/Quad4FiberOverlay.h" #include "UWelements/Brick8FiberOverlay.h" #include "EmbeddedBeamInterfaceL.h" +#include "SurfaceLoad.h" #include "PML/PML2D.h" #include "PML/PML3D.h" @@ -926,6 +927,9 @@ FEM_ObjectBrokerAllClasses::getNewElement(int classTag) case ELE_TAG_SSPbrickUP: return new SSPbrickUP(); + case ELE_TAG_SurfaceLoad: + return new SurfaceLoad(); + case ELE_TAG_Quad4FiberOverlay: return new Quad4FiberOverlay(); //Amin Pakzad From 88958f2ef0ecdce74210edca5ff453ea1582affb Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Mon, 18 Mar 2024 09:29:20 -0700 Subject: [PATCH 2/5] Fixing sendSelf/recvSelf --- SRC/element/surfaceLoad/SurfaceLoad.cpp | 132 ++++++------------------ SRC/element/surfaceLoad/SurfaceLoad.h | 2 - 2 files changed, 33 insertions(+), 101 deletions(-) diff --git a/SRC/element/surfaceLoad/SurfaceLoad.cpp b/SRC/element/surfaceLoad/SurfaceLoad.cpp index caebfaf4cf..93fdb2ab5a 100644 --- a/SRC/element/surfaceLoad/SurfaceLoad.cpp +++ b/SRC/element/surfaceLoad/SurfaceLoad.cpp @@ -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; @@ -335,67 +333,36 @@ SurfaceLoad::sendSelf(int commitTag, Channel &theChannel) // 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 - 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; } @@ -407,19 +374,28 @@ 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 res = theChannel.recvID(dataTag, commitTag, myExternalNodes); @@ -428,48 +404,6 @@ SurfaceLoad::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theB 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; } diff --git a/SRC/element/surfaceLoad/SurfaceLoad.h b/SRC/element/surfaceLoad/SurfaceLoad.h index fccae56c33..87b96ebc2a 100644 --- a/SRC/element/surfaceLoad/SurfaceLoad.h +++ b/SRC/element/surfaceLoad/SurfaceLoad.h @@ -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]; From 7b9c5ad991d2dad76696cfb70e61e4a8d94fa109 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Mon, 18 Mar 2024 09:39:56 -0700 Subject: [PATCH 3/5] Fixing sendSelf/recvSelf --- SRC/element/surfaceLoad/TriSurfaceLoad.cpp | 133 ++++++--------------- SRC/element/surfaceLoad/TriSurfaceLoad.h | 2 - 2 files changed, 37 insertions(+), 98 deletions(-) diff --git a/SRC/element/surfaceLoad/TriSurfaceLoad.cpp b/SRC/element/surfaceLoad/TriSurfaceLoad.cpp index d34c12cd81..67d459cb7d 100644 --- a/SRC/element/surfaceLoad/TriSurfaceLoad.cpp +++ b/SRC/element/surfaceLoad/TriSurfaceLoad.cpp @@ -121,8 +121,6 @@ TriSurfaceLoad::TriSurfaceLoad(int tag, int Nd1, int Nd2, int Nd3, double pressu myExternalNodes(1) = Nd2; myExternalNodes(2) = Nd3; - MyTag = tag; - GsPts[0][0] = 0.5; my_pressure = pressure; @@ -142,7 +140,6 @@ TriSurfaceLoad::TriSurfaceLoad() dcrd2(SL_NUM_NDF), dcrd3(SL_NUM_NDF) { - MyTag = 0; GsPts[0][0] = 0; my_pressure = 0; rhoH = 0; @@ -347,66 +344,39 @@ TriSurfaceLoad::sendSelf(int commitTag, Channel &theChannel) // object - don't want to have to do the check if sending data int dataTag = this->getDbTag(); - // TriSurfaceLoad packs it's data into a Vector and sends this to theChannel - // along with it's dbTag and the commitTag passed in the arguments + // TriSurfaceLoad 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(5); + static Vector data(4 + 6*SL_NUM_NDF + SL_NUM_NODE); data(0) = this->getTag(); - data(1) = SL_NUM_DOF; - data(2) = my_pressure; - data(3) = mLoadFactor; - data(4) = rhoH; - + data(1) = my_pressure; + data(2) = mLoadFactor; + data(3) = rhoH; + + for (int i = 0; i < SL_NUM_NDF; i++) { + data(4+ i) = g1(i); + data(4+ SL_NUM_NDF+i) = g2(i); + data(4+2*SL_NUM_NDF+i) = myNhat(i); + data(4+3*SL_NUM_NDF+i) = dcrd1(i); + data(4+4*SL_NUM_NDF+i) = dcrd2(i); + data(4+5*SL_NUM_NDF+i) = dcrd3(i); + } + for (int i = 0; i < SL_NUM_NODE; i++) + data(4+6*SL_NUM_NDF+i) = myNI(i); + res = theChannel.sendVector(dataTag, commitTag, data); if (res < 0) { opserr <<"WARNING TriSurfaceLoad::sendSelf() - " << this->getTag() << " failed to send data\n"; return -1; } - // TriSurfaceLoad then sends the tags of it's four nodes + // TriSurfaceLoad then sends the tags of its four nodes res = theChannel.sendID(dataTag, commitTag, myExternalNodes); if (res < 0) { opserr <<"WARNING TriSurfaceLoad::sendSelf() - " << this->getTag() << " failed to send myExternalNodes\n"; return -2; } - res = theChannel.sendVector(dataTag, commitTag, g1); - if (res < 0) { - opserr <<"WARNING TriSurfaceLoad::sendSelf() - " << this->getTag() << " failed to send g1\n"; - return -2; - } - res = theChannel.sendVector(dataTag, commitTag, g2); - if (res < 0) { - opserr <<"WARNING TriSurfaceLoad::sendSelf() - " << this->getTag() << " failed to send g2\n"; - return -2; - } - res = theChannel.sendVector(dataTag, commitTag, myNhat); - if (res < 0) { - opserr <<"WARNING TriSurfaceLoad::sendSelf() - " << this->getTag() << " failed to send myNhat\n"; - return -2; - } - res = theChannel.sendVector(dataTag, commitTag, myNI); - if (res < 0) { - opserr <<"WARNING TriSurfaceLoad::sendSelf() - " << this->getTag() << " failed to send myNI\n"; - return -2; - } - res = theChannel.sendVector(dataTag, commitTag, dcrd1); - if (res < 0) { - opserr <<"WARNING TriSurfaceLoad::sendSelf() - " << this->getTag() << " failed to send dcrd1\n"; - return -2; - } - res = theChannel.sendVector(dataTag, commitTag, dcrd2); - if (res < 0) { - opserr <<"WARNING TriSurfaceLoad::sendSelf() - " << this->getTag() << " failed to send dcrd2\n"; - return -2; - } - res = theChannel.sendVector(dataTag, commitTag, dcrd3); - if (res < 0) { - opserr <<"WARNING TriSurfaceLoad::sendSelf() - " << this->getTag() << " failed to send dcrd3\n"; - return -2; - } - - return 0; } @@ -418,65 +388,36 @@ TriSurfaceLoad::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &t // TriSurfaceLoad creates a Vector, receives the Vector and then sets the // internal data with the data in the Vector - static Vector data(5); + static Vector data(4 + 6*SL_NUM_NDF + SL_NUM_NODE); res = theChannel.recvVector(dataTag, commitTag, data); if (res < 0) { opserr <<"WARNING TriSurfaceLoad::recvSelf() - failed to receive Vector\n"; return -1; } - MyTag = data(0); - my_pressure = data(2); - mLoadFactor = data(3); - rhoH = data(4); - - this->setTag((int)MyTag); - - - // TriSurfaceLoad now receives the tags of it's four external nodes + this->setTag(int(data(0))); + my_pressure = data(1); + mLoadFactor = data(2); + rhoH = data(3); + + for (int i = 0; i < SL_NUM_NDF; i++) { + g1(i) = data(4+ i); + g2(i) = data(4+ SL_NUM_NDF+i); + myNhat(i) = data(4+2*SL_NUM_NDF+i); + dcrd1(i) = data(4+3*SL_NUM_NDF+i); + dcrd2(i) = data(4+4*SL_NUM_NDF+i); + dcrd3(i) = data(4+5*SL_NUM_NDF+i); + } + for (int i = 0; i < SL_NUM_NODE; i++) + myNI(i) = data(4+6*SL_NUM_NDF+i); + + // TriSurfaceLoad now receives the tags of its four external nodes res = theChannel.recvID(dataTag, commitTag, myExternalNodes); if (res < 0) { opserr <<"WARNING TriSurfaceLoad::recvSelf() - " << this->getTag() << " failed to receive ID\n"; return -2; } - res = theChannel.recvVector(dataTag, commitTag, g1); - if (res < 0) { - opserr <<"WARNING TriSurfaceLoad::sendSelf() - " << this->getTag() << " failed to receive g1\n"; - return -2; - } - res = theChannel.recvVector(dataTag, commitTag, g2); - if (res < 0) { - opserr <<"WARNING TriSurfaceLoad::sendSelf() - " << this->getTag() << " failed to receive g2\n"; - return -2; - } - res = theChannel.recvVector(dataTag, commitTag, myNhat); - if (res < 0) { - opserr <<"WARNING TriSurfaceLoad::sendSelf() - " << this->getTag() << " failed to receive myNhat\n"; - return -2; - } - res = theChannel.recvVector(dataTag, commitTag, myNI); - if (res < 0) { - opserr <<"WARNING TriSurfaceLoad::sendSelf() - " << this->getTag() << " failed to receive myNI\n"; - return -2; - } - res = theChannel.recvVector(dataTag, commitTag, dcrd1); - if (res < 0) { - opserr <<"WARNING TriSurfaceLoad::sendSelf() - " << this->getTag() << " failed to receive dcrd1\n"; - return -2; - } - res = theChannel.recvVector(dataTag, commitTag, dcrd2); - if (res < 0) { - opserr <<"WARNING TriSurfaceLoad::sendSelf() - " << this->getTag() << " failed to receive dcrd2\n"; - return -2; - } - res = theChannel.recvVector(dataTag, commitTag, dcrd3); - if (res < 0) { - opserr <<"WARNING TriSurfaceLoad::sendSelf() - " << this->getTag() << " failed to receive dcrd3\n"; - return -2; - } - - return 0; } diff --git a/SRC/element/surfaceLoad/TriSurfaceLoad.h b/SRC/element/surfaceLoad/TriSurfaceLoad.h index 0328e691c0..097b60321a 100644 --- a/SRC/element/surfaceLoad/TriSurfaceLoad.h +++ b/SRC/element/surfaceLoad/TriSurfaceLoad.h @@ -117,8 +117,6 @@ class TriSurfaceLoad : public Element Vector dcrd2; // current coordinates of node 2 Vector dcrd3; // current coordinates of node 3 - int MyTag; // what is my name? - static double oneOverRoot3; static double GsPts[1][1]; From d1c795285120461c315ca8851672f9bbda17a82d Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Mon, 18 Mar 2024 09:43:34 -0700 Subject: [PATCH 4/5] Adding TriSurfaceLoad to object broker --- SRC/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SRC/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp b/SRC/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp index 534a7165d6..f1ccf83d31 100644 --- a/SRC/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp +++ b/SRC/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp @@ -334,6 +334,7 @@ #include "UWelements/Brick8FiberOverlay.h" #include "EmbeddedBeamInterfaceL.h" #include "SurfaceLoad.h" +#include "TriSurfaceLoad.h" #include "PML/PML2D.h" #include "PML/PML3D.h" @@ -929,6 +930,9 @@ FEM_ObjectBrokerAllClasses::getNewElement(int classTag) case ELE_TAG_SurfaceLoad: return new SurfaceLoad(); + + case ELE_TAG_TriSurfaceLoad: + return new TriSurfaceLoad(); case ELE_TAG_Quad4FiberOverlay: return new Quad4FiberOverlay(); //Amin Pakzad From 1f0cc5db7da30e17f307f4caaf6ed520e03b3047 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Mon, 18 Mar 2024 20:02:47 -0700 Subject: [PATCH 5/5] Changing comments --- SRC/element/surfaceLoad/SurfaceLoad.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SRC/element/surfaceLoad/SurfaceLoad.cpp b/SRC/element/surfaceLoad/SurfaceLoad.cpp index 93fdb2ab5a..962bbc424c 100644 --- a/SRC/element/surfaceLoad/SurfaceLoad.cpp +++ b/SRC/element/surfaceLoad/SurfaceLoad.cpp @@ -330,8 +330,8 @@ 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(3 + 7*SL_NUM_NDF + SL_NUM_NODE); data(0) = this->getTag(); @@ -397,7 +397,7 @@ SurfaceLoad::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theB 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";