本文整理汇总了C++中FEM_ObjectBroker::getNewNDMaterial方法的典型用法代码示例。如果您正苦于以下问题:C++ FEM_ObjectBroker::getNewNDMaterial方法的具体用法?C++ FEM_ObjectBroker::getNewNDMaterial怎么用?C++ FEM_ObjectBroker::getNewNDMaterial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FEM_ObjectBroker
的用法示例。
在下文中一共展示了FEM_ObjectBroker::getNewNDMaterial方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: data
int
BeamContact2Dp::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
{
int res = 0;
int dataTag = this->getDbTag();
// BeamContact2Dp creates a vector, receives the vector, and then sets the internal
// data with the data in the vector
static Vector data(6);
res = theChannel.recvVector(dataTag, commitTag, data);
if (res < 0) {
opserr << "WARNING BeamContact2Dp::recvSelf() - failed to receive Vector\n";
return -1;
}
this->setTag((int)data(0));
mRadius = data(1);
mPenalty = data(2);
mIniContact = (int)data(3);
// BeamContact2Dp now receives the tags of its four external nodes
res = theChannel.recvID(dataTag, commitTag, mExternalNodes);
if (res < 0) {
opserr << "WARNING BeamContact2Dp::recvSelf() - " << this->getTag() << " failed to receive ID\n";
return -2;
}
// finally, BeamContact2Dp creates a material object of the correct type, sets its
// database tag, and asks this new object to receive itself
int matClass = (int)data(4);
int matDb = (int)data(5);
// check if material object exists and that it is the right type
if ((theMaterial == 0) || (theMaterial->getClassTag() != matClass)) {
// if old one, delete it
if (theMaterial != 0)
delete theMaterial;
// create new material object
NDMaterial *theMatCopy = theBroker.getNewNDMaterial(matClass);
theMaterial = (ContactMaterial2D *)theMatCopy;
if (theMaterial == 0) {
opserr << "WARNING BeamContact2Dp::recvSelf() - " << this->getTag()
<< " failed to get a blank Material of type " << matClass << endln;
return -3;
}
}
// NOTE: we set the dbTag before we receive the material
theMaterial->setDbTag(matDb);
res = theMaterial->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr << "WARNING BeamContact2Dp::recvSelf() - " << this->getTag() << " failed to receive its Material\n";
return -3;
}
return 0;
}
示例2: idData
int
BeamFiberMaterial2d::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
{
int res = 0;
// recv an id containg the tag and associated materials class and db tags
static ID idData(3);
res = theChannel.sendID(this->getDbTag(), commitTag, idData);
if (res < 0) {
opserr << "BeamFiberMaterial2d::sendSelf() - failed to send id data\n";
return res;
}
this->setTag(idData(0));
int matClassTag = idData(1);
// if the associated material has not yet been created or is of the wrong type
// create a new material for recvSelf later
if (theMaterial == 0 || theMaterial->getClassTag() != matClassTag) {
if (theMaterial != 0)
delete theMaterial;
theMaterial = theBroker.getNewNDMaterial(matClassTag);
if (theMaterial == 0) {
opserr << "BeamFiberMaterial2d::recvSelf() - failed to get a material of type: " << matClassTag << endln;
return -1;
}
}
theMaterial->setDbTag(idData(2));
// recv a vector containing strains and set the strains
static Vector vecData(4);
res = theChannel.recvVector(this->getDbTag(), commitTag, vecData);
if (res < 0) {
opserr << "BeamFiberMaterial2d::sendSelf() - failed to send vector data\n";
return res;
}
Cstrain22 = vecData(0);
Cstrain33 = vecData(1);
Cgamma31 = vecData(2);
Cgamma23 = vecData(3);
Tstrain22 = Cstrain22;
Tstrain33 = Cstrain33;
Tgamma31 = Cgamma31;
Tgamma23 = Cgamma23;
// now receive the materials data
res = theMaterial->recvSelf(commitTag, theChannel, theBroker);
if (res < 0)
opserr << "BeamFiberMaterial2d::sendSelf() - failed to send vector material\n";
return res;
}
示例3: idData
int
PlateFromPlaneStressMaterialThermal::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
{
int res = 0;
int dataTag = this->getDbTag();
// recv an id containg the tag and associated materials class and db tags
static ID idData(3);
res = theChannel.recvID(dataTag, commitTag, idData);
if (res < 0) {
opserr << "PlateFromPlaneStressMaterialThermal::sendSelf() - failed to receive id data" << endln;
return res;
}
this->setTag(idData(0));
int matClassTag = idData(1);
if (theMat->getClassTag() != matClassTag) {
if (theMat != 0) delete theMat;
theMat = theBroker.getNewNDMaterial(matClassTag);
if (theMat == 0) {
opserr << "PlateFromPlaneStressMaterialThermal::recvSelf() - failed to get a material of type: " << matClassTag << endln;
return -1;
}
}
theMat->setDbTag(idData(2));
static Vector vecData(1);
res = theChannel.recvVector(dataTag, commitTag, vecData);
if (res < 0) {
opserr << "PlateFromPlaneStressMaterialThermal::sendSelf() - failed to receive vector data" << endln;
return res;
}
gmod = vecData(0);
// now receive the materials data
res = theMat->recvSelf(commitTag, theChannel, theBroker);
if (res < 0)
opserr << "PlateFromPlaneStressMaterialThermal::sendSelf() - failed to receive material1" << endln;
return res;
}
示例4: recvSelf
int TwentyEightNodeBrickUP::recvSelf (int commitTag,
Channel &theChannel,
FEM_ObjectBroker &theBroker)
{
int res = 0;
int dataTag = this->getDbTag();
// TwentyEightNodeBrickUP creates a Vector, receives the Vector and then sets the
// internal data with the data in the Vector
static Vector data(13);
res += theChannel.recvVector(dataTag, commitTag, data);
if (res < 0) {
opserr << "WARNING TwentyEightNodeBrickUP::recvSelf() - failed to receive Vector\n";
return res;
}
this->setTag((int)data(0));
rho = data(1);
b[0] = data(2);
b[1] = data(3);
b[2] = data(4);
alphaM = data(5);
betaK = data(6);
betaK0 = data(7);
betaKc = data(8);
kc = data(9);
perm[0] = data(10);
perm[1] = data(11);
perm[2] = data(12);
static ID idData(74);
// TwentyEightNodeBrickUP now receives the tags of its four external nodes
res += theChannel.recvID(dataTag, commitTag, idData);
if (res < 0) {
opserr << "WARNING TwentyEightNodeBrickUP::recvSelf() - " << this->getTag() << " failed to receive ID\n";
return res;
}
int i;
for( i = 0; i < 20; i++)
connectedExternalNodes(i) = idData(54+i);
if (materialPointers == 0) {
// Allocate new materials
materialPointers = new NDMaterial* [nintu];
if (materialPointers == 0) {
opserr << "TwentyEightNodeBrickUP::recvSelf() - Could not allocate NDMaterial array\n";
return -1;
}
for (i = 0; i < nintu; i++) {
int matClassTag = idData(i);
int matDbTag = idData(i+nintu);
// Allocate new material with the sent class tag
materialPointers[i] = theBroker.getNewNDMaterial(matClassTag);
if (materialPointers[i] == 0) {
opserr << "TwentyEightNodeBrickUP::recvSelf() - Broker could not create NDMaterial of class type " << matClassTag << endln;
return -1;
}
// Now receive materials into the newly allocated space
materialPointers[i]->setDbTag(matDbTag);
res += materialPointers[i]->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr << "TwentyEightNodeBrickUP::recvSelf() - material " << i << "failed to recv itself\n";
return res;
}
}
}
// materials exist , ensure materials of correct type and recvSelf on them
else {
for (i = 0; i < nintu; i++) {
int matClassTag = idData(i);
int matDbTag = idData(i+nintu);
// Check that material is of the right type; if not,
// delete it and create a new one of the right type
if (materialPointers[i]->getClassTag() != matClassTag) {
delete materialPointers[i];
materialPointers[i] = theBroker.getNewNDMaterial(matClassTag);
if (materialPointers[i] == 0) {
opserr << "TwentyEightNodeBrickUP::recvSelf() - Broker could not create NDMaterial of class type " <<
matClassTag << endln;
exit(-1);
}
}
// Receive the material
materialPointers[i]->setDbTag(matDbTag);
res += materialPointers[i]->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr << "TwentyEightNodeBrickUP::recvSelf() - material " << i << "failed to recv itself\n";
return res;
}
}
}
//.........这里部分代码省略.........
示例5: idData
int
NineNodeMixedQuad::recvSelf (int commitTag,
Channel &theChannel,
FEM_ObjectBroker &theBroker)
{
int res = 0;
int dataTag = this->getDbTag();
static ID idData(28);
// Quad now receives the tags of its four external nodes
res += theChannel.recvID(dataTag, commitTag, idData);
if (res < 0) {
opserr << "WARNING NineNodeMixedQuad::recvSelf() - " << this->getTag() << " failed to receive ID\n";
return res;
}
this->setTag(idData(18));
connectedExternalNodes(0) = idData(19);
connectedExternalNodes(1) = idData(20);
connectedExternalNodes(2) = idData(21);
connectedExternalNodes(3) = idData(22);
connectedExternalNodes(4) = idData(23);
connectedExternalNodes(5) = idData(24);
connectedExternalNodes(6) = idData(25);
connectedExternalNodes(7) = idData(26);
connectedExternalNodes(8) = idData(27);
int i;
if (materialPointers[0] == 0) {
for (i = 0; i < 9; i++) {
int matClassTag = idData(i);
int matDbTag = idData(i+9);
// Allocate new material with the sent class tag
materialPointers[i] = theBroker.getNewNDMaterial(matClassTag);
if (materialPointers[i] == 0) {
opserr << "NineNodeMixedQuad::recvSelf() - Broker could not create NDMaterial of class type" << matClassTag << endln;
return -1;
}
// Now receive materials into the newly allocated space
materialPointers[i]->setDbTag(matDbTag);
res += materialPointers[i]->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr << "NineNodeMixedQuad::recvSelf() - material " <<
i << "failed to recv itself\n";
return res;
}
}
}
// Number of materials is the same, receive materials into current space
else {
for (i = 0; i < 9; i++) {
int matClassTag = idData(i);
int matDbTag = idData(i+9);
// Check that material is of the right type; if not,
// delete it and create a new one of the right type
if (materialPointers[i]->getClassTag() != matClassTag) {
delete materialPointers[i];
materialPointers[i] = theBroker.getNewNDMaterial(matClassTag);
if (materialPointers[i] == 0) {
opserr << "NineNodeMixedQuad::recvSelf() - Broker could not create NDMaterial of class type" << matClassTag << endln;
exit(-1);
}
}
// Receive the material
materialPointers[i]->setDbTag(matDbTag);
res += materialPointers[i]->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr << "NineNodeMixedQuad::recvSelf() - material " <<
i << "failed to recv itself\n";
return res;
}
}
}
return res;
}
示例6: recvSelf
int Twenty_Node_Brick::recvSelf (int commitTag,
Channel &theChannel,
FEM_ObjectBroker &theBroker)
{
int res = 0;
int dataTag = this->getDbTag();
static ID idData(75);
// now receives the tags of its 20 external nodes
res += theChannel.recvID(dataTag, commitTag, idData);
if (res < 0) {
opserr << "WARNING Twenty_Node_Brick::recvSelf() - " << this->getTag() << " failed to receive ID\n";
return res;
}
this->setTag(idData(74));
int i;
for( i = 0; i < 20; i++)
connectedExternalNodes(i) = idData(54+i);
if (materialPointers[0] == 0) {
for (i = 0; i < nintu; i++) {
int matClassTag = idData(i);
int matDbTag = idData(i+nintu);
// Allocate new material with the sent class tag
materialPointers[i] = theBroker.getNewNDMaterial(matClassTag);
if (materialPointers[i] == 0) {
opserr << "Twenty_Node_Brick::recvSelf() - Broker could not create NDMaterial of class type " << matClassTag << endln;
return -1;
}
// Now receive materials into the newly allocated space
materialPointers[i]->setDbTag(matDbTag);
res += materialPointers[i]->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr << "Twenty_Node_Brick::recvSelf() - material " << i << "failed to recv itself\n";
return res;
}
}
}
// materials exist , ensure materials of correct type and recvSelf on them
else {
for (i = 0; i < nintu; i++) {
int matClassTag = idData(i);
int matDbTag = idData(i+nintu);
// Check that material is of the right type; if not,
// delete it and create a new one of the right type
if (materialPointers[i]->getClassTag() != matClassTag) {
delete materialPointers[i];
//.........这里部分代码省略.........
示例7: data
int
NineFourNodeQuadUP::recvSelf(int commitTag, Channel &theChannel,
FEM_ObjectBroker &theBroker)
{
int res = 0;
int dataTag = this->getDbTag();
// Quad creates a Vector, receives the Vector and then sets the
// internal data with the data in the Vector
static Vector data(7);
res += theChannel.recvVector(dataTag, commitTag, data);
if (res < 0) {
opserr << "WARNING NineFourNodeQuadUP::recvSelf() - failed to receive Vector\n";
return res;
}
this->setTag((int)data(0));
thickness = data(1);
rho = data(2);
b[0] = data(3);
b[1] = data(4);
//pressure = data(5);
kc = data(6);
perm[0] = data(7);
perm[1] = data(8);
// Quad now receives the tags of its four external nodes
res += theChannel.recvID(dataTag, commitTag, connectedExternalNodes);
if (res < 0) {
opserr << "WARNING NineFourNodeQuadUP::recvSelf() - " << this->getTag() << " failed to receive ID\n";
return res;
}
// Quad now receives the ids of its materials
int newOrder = (int)data(9);
int numMats = newOrder;
ID classTags(2*numMats);
res += theChannel.recvID(dataTag, commitTag, classTags);
if (res < 0) {
opserr << "NineFourNodeQuadUP::recvSelf() - failed to recv ID data\n";
return res;
}
int i;
// If the number of materials (quadrature order) is not the same,
// delete the old materials, allocate new ones and then receive
if (9 != newOrder) {
// Delete the materials
for (i = 0; i < 9; i++) {
if (theMaterial[i])
delete theMaterial[i];
}
if (theMaterial)
delete [] theMaterial;
// Allocate new materials
theMaterial = new NDMaterial *[9];
if (theMaterial == 0) {
opserr << "NineFourNodeQuadUP::recvSelf() - Could not allocate NDMaterial* array\n";
return -1;
}
for (i = 0; i < 9; i++) {
int matClassTag = classTags(i);
int matDbTag = classTags(i+numMats);
// Allocate new material with the sent class tag
theMaterial[i] = theBroker.getNewNDMaterial(matClassTag);
if (theMaterial[i] == 0) {
opserr << "NineFourNodeQuadUP::recvSelf() - Broker could not create NDMaterial of class type" << matClassTag << endln;
return -1;
}
// Now receive materials into the newly allocated space
theMaterial[i]->setDbTag(matDbTag);
res += theMaterial[i]->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr << "NLBeamColumn3d::recvSelf() - material " << i << "failed to recv itself\n";
return res;
}
}
}
// Number of materials is the same, receive materials into current space
else {
for (i = 0; i < 9; i++) {
int matClassTag = classTags(i);
int matDbTag = classTags(i+numMats);
// Check that material is of the right type; if not,
// delete it and create a new one of the right type
if (theMaterial[i]->getClassTag() != matClassTag) {
delete theMaterial[i];
theMaterial[i] = theBroker.getNewNDMaterial(matClassTag);
if (theMaterial[i] == 0) {
opserr << "NineFourNodeQuadUP::recvSelf() - Broker could not create NDMaterial of class type " << matClassTag << endln;
exit(-1);
}
}
// Receive the material
theMaterial[i]->setDbTag(matDbTag);
res += theMaterial[i]->recvSelf(commitTag, theChannel, theBroker);
//.........这里部分代码省略.........
示例8: idData
int
ConstantPressureVolumeQuad :: recvSelf (int commitTag,
Channel &theChannel,
FEM_ObjectBroker &theBroker)
{
int res = 0;
int dataTag = this->getDbTag();
static ID idData(14);
// Quad now receives the tags of its four external nodes
res += theChannel.recvID(dataTag, commitTag, idData);
if (res < 0) {
opserr << "WARNING ConstantPressureVolumeQuad::recvSelf() - " << this->getTag() << " failed to receive ID\n";
return res;
}
this->setTag(idData(8));
connectedExternalNodes(0) = idData(9);
connectedExternalNodes(1) = idData(10);
connectedExternalNodes(2) = idData(11);
connectedExternalNodes(3) = idData(12);
int i;
if (idData(13) == 1) {
// recv damping coefficients
static Vector dData(4);
if (theChannel.recvVector(dataTag, commitTag, dData) < 0) {
opserr << "EnahancesQuad::sendSelf() - failed to recv double data\n";
return -1;
}
alphaM = dData(0);
betaK = dData(1);
betaK0 = dData(2);
betaKc = dData(3);
}
if (materialPointers[0] == 0) {
for (i = 0; i < 4; i++) {
int matClassTag = idData(i);
int matDbTag = idData(i+4);
// Allocate new material with the sent class tag
materialPointers[i] = theBroker.getNewNDMaterial(matClassTag);
if (materialPointers[i] == 0) {
opserr << "ConstantPressureVolumeQuad::recvSelf() - " <<
"Broker could not create NDMaterial of class type" << matClassTag << endln;
return -1;
}
// Now receive materials into the newly allocated space
materialPointers[i]->setDbTag(matDbTag);
res += materialPointers[i]->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr << "NLBeamColumn3d::recvSelf() - material " <<
i << "failed to recv itself\n";
return res;
}
}
}
// Number of materials is the same, receive materials into current space
else {
for (i = 0; i < 4; i++) {
int matClassTag = idData(i);
int matDbTag = idData(i+4);
// Check that material is of the right type; if not,
// delete it and create a new one of the right type
if (materialPointers[i]->getClassTag() != matClassTag) {
delete materialPointers[i];
materialPointers[i] = theBroker.getNewNDMaterial(matClassTag);
if (materialPointers[i] == 0) {
opserr << "ConstantPressureVolumeQuad::recvSelf() - " <<
"Broker could not create NDMaterial of class type" << matClassTag << endln;
exit(-1);
}
}
// Receive the material
materialPointers[i]->setDbTag(matDbTag);
res += materialPointers[i]->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr << "ConstantPressureVolumeQuad::recvSelf() - material " << i <<
"failed to recv itself\n";
return res;
}
}
}
return res;
}
示例9: data
int
GenericSectionNd::recvSelf(int cTag, Channel &theChannel,
FEM_ObjectBroker &theBroker)
{
int res = 0;
static ID data(5);
// Receive the data ID
res += theChannel.recvID(this->getDbTag(), cTag, data);
if (res < 0) {
g3ErrorHandler->warning("%s -- could not receive data ID",
"GenericSectionNd::recvSelf");
return res;
}
this->setTag(data(0));
order = data(1);
otherDbTag = data(2);
// Check if section ID code is null or wrong size, reallocate if so
if (code == 0)
code = new ID(order);
else if (code->Size() != order) {
delete code;
code = new ID(order);
}
if (code == 0) {
g3ErrorHandler->warning("%s -- could not allocate new code ID",
"GenericSectionNd::recvSelf");
return -1;
}
// Receive the code ID
res += theChannel.recvID(otherDbTag, cTag, *code);
if (res < 0) {
g3ErrorHandler->warning("%s -- could not receive code ID",
"GenericSectionNd::recvSelf");
return res;
}
int classTag = data(3);
// Check if the material is null; if so, get a new one
if (theModel == 0)
theModel = theBroker.getNewNDMaterial(classTag);
// Check that the material is of the right type; if not, delete
// the current one and get a new one of the right type
else if (theModel->getClassTag() != classTag) {
delete theModel;
theModel = theBroker.getNewNDMaterial(classTag);
}
// Check if either allocation failed
if (theModel == 0) {
g3ErrorHandler->warning("%s -- could not get an NDMaterial",
"GenericSectionNd::recvSelf");
return -1;
}
// Now, receive the material
theModel->setDbTag(data(4));
res += theModel->recvSelf(cTag, theChannel, theBroker);
if (res < 0) {
g3ErrorHandler->warning("%s -- could not receive NDMaterial",
"GenericSectionNd::recvSelf");
return res;
}
return res;
}
示例10: data
int
SSPquad::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
{
int res = 0;
int dataTag = this->getDbTag();
// SSPquad creates a Vector, receives the Vector and then sets the
// internal data with the data in the Vector
static Vector data(10);
res += theChannel.recvVector(dataTag, commitTag, data);
if (res < 0) {
opserr << "WARNING SSPquad::recvSelf() - failed to receive Vector\n";
return res;
}
this->setTag((int)data(0));
mThickness = data(1);
b[0] = data(2);
b[1] = data(3);
// SSPquad now receives the tags of its four external nodes
res += theChannel.recvID(dataTag, commitTag, mExternalNodes);
if (res < 0) {
opserr << "WARNING SSPquad::recvSelf() - " << this->getTag() << " failed to receive ID\n";
return res;
}
// finally, SSPquad creates a material object of the correct type, sets its
// database tag, and asks this new object to receive itself
int matClass = (int)data(4);
int matDb = (int)data(5);
alphaM = data(6);
betaK = data(7);
betaK0 = data(8);
betaKc = data(9);
// check if material object exists and that it is the right type
if ((theMaterial == 0) || (theMaterial->getClassTag() != matClass)) {
// if old one, delete it
if (theMaterial != 0)
delete theMaterial;
// create new material object
NDMaterial *theMatCopy = theBroker.getNewNDMaterial(matClass);
theMaterial = (NDMaterial *)theMatCopy;
if (theMaterial == 0) {
opserr << "WARNING SSPquad::recvSelf() - " << this->getTag()
<< " failed to get a blank Material of type " << matClass << endln;
return -3;
}
}
// NOTE: we set the dbTag before we receive the material
theMaterial->setDbTag(matDb);
res = theMaterial->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr << "WARNING SSPquad::recvSelf() - " << this->getTag() << " failed to receive its Material\n";
return -3;
}
return 0;
}
示例11: idData
int
ZeroLengthND::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
{
int res = 0;
int dataTag = this->getDbTag();
// ZeroLengthND creates an ID, receives the ID and then sets the
// internal data with the data in the ID
static ID idData(11);
res += theChannel.recvID(dataTag, commitTag, idData);
if (res < 0) {
opserr << "ZeroLengtHND::recvSelf -- failed to receive ID data\n";
return res;
}
res += theChannel.recvMatrix(dataTag, commitTag, transformation);
if (res < 0) {
opserr << "zeroLengthND::revbSelf -- failed to receive transformation Matrix\n";
return res;
}
this->setTag(idData(0));
dimension = idData(1);
numDOF = idData(2);
connectedExternalNodes(0) = idData(5);
connectedExternalNodes(1) = idData(6);
if (order != idData(3)) {
order = idData(3);
// Allocate transformation matrix
if (A != 0)
delete A;
A = new Matrix(order, numDOF);
if (numDOF == 6) {
K = &K6;
P = &P6;
}
else {
K = &K12;
P = &P12;
}
if (order == 2)
v = &v2;
else
v = &v3;
}
int classTag = idData(7);
// If null, get a new one from the broker
if (theNDMaterial == 0)
theNDMaterial = theBroker.getNewNDMaterial(classTag);
// If wrong type, get a new one from the broker
if (theNDMaterial->getClassTag() != classTag) {
delete theNDMaterial;
theNDMaterial = theBroker.getNewNDMaterial(classTag);
}
// Check if either allocation failed from broker
if (theNDMaterial == 0) {
opserr << "ZeroLengthND:: -- failed to allocate new NDMaterial\n";
return -1;
}
// Receive the NDMaterial
theNDMaterial->setDbTag(idData(8));
res += theNDMaterial->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr << "ZeroLengthND:: -- failed to receive NDMaterial\n";
return res;
}
// Receive the UniaxialMaterial, if present
if (idData(4) == 1) {
classTag = idData(9);
// If null, get a new one from the broker
if (the1DMaterial == 0)
the1DMaterial = theBroker.getNewUniaxialMaterial(classTag);
// If wrong type, get a new one from the broker
if (the1DMaterial->getClassTag() != classTag) {
delete the1DMaterial;
the1DMaterial = theBroker.getNewUniaxialMaterial(classTag);
}
// Check if either allocation failed from broker
if (the1DMaterial == 0) {
opserr << "ZeroLengthND:: -- failed to allocate new UniaxialMaterial\n";
return -1;
//.........这里部分代码省略.........
示例12: recvSelf
int BbarBrick::recvSelf (int commitTag,
Channel &theChannel,
FEM_ObjectBroker &theBroker)
{
int res = 0;
int dataTag = this->getDbTag();
static ID idData(25);
// Quad now receives the tags of its four external nodes
res += theChannel.recvID(dataTag, commitTag, idData);
if (res < 0) {
opserr << "WARNING BbarBrick::recvSelf() - " << this->getTag() << " failed to receive ID\n";
return res;
}
this->setTag(idData(24));
// recv damping & body forces coefficients
static Vector dData(7);
if (theChannel.recvVector(dataTag, commitTag, dData) < 0) {
opserr << "DispBeamColumn2d::sendSelf() - failed to recv double data\n";
return -1;
}
alphaM = dData(0);
betaK = dData(1);
betaK0 = dData(2);
betaKc = dData(3);
b[0] = dData(4);
b[1] = dData(5);
b[2] = dData(6);
connectedExternalNodes(0) = idData(16);
connectedExternalNodes(1) = idData(17);
connectedExternalNodes(2) = idData(18);
connectedExternalNodes(3) = idData(19);
connectedExternalNodes(4) = idData(20);
connectedExternalNodes(5) = idData(21);
connectedExternalNodes(6) = idData(22);
connectedExternalNodes(7) = idData(23);
if (materialPointers[0] == 0) {
for (int i = 0; i < 8; i++) {
int matClassTag = idData(i);
int matDbTag = idData(i+8);
// Allocate new material with the sent class tag
materialPointers[i] = theBroker.getNewNDMaterial(matClassTag);
if (materialPointers[i] == 0) {
opserr << "BbarBrick::recvSelf() - Broker could not create NDMaterial of class type" <<
matClassTag << endln;
exit(-1);
}
// Now receive materials into the newly allocated space
materialPointers[i]->setDbTag(matDbTag);
res += materialPointers[i]->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr << "NLBeamColumn3d::recvSelf() - material " <<
i << "failed to recv itself\n";
return res;
}
}
}
// materials exist , ensure materials of correct type and recvSelf on them
else {
for (int i = 0; i < 8; i++) {
int matClassTag = idData(i);
int matDbTag = idData(i+8);
// Check that material is of the right type; if not,
// delete it and create a new one of the right type
if (materialPointers[i]->getClassTag() != matClassTag) {
delete materialPointers[i];
materialPointers[i] = theBroker.getNewNDMaterial(matClassTag);
if (materialPointers[i] == 0) {
opserr << "BbarBrick::recvSelf() - Broker could not create NDMaterial of class type" <<
matClassTag << endln;
exit(-1);
}
materialPointers[i]->setDbTag(matDbTag);
}
// Receive the material
res += materialPointers[i]->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr << "NLBeamColumn3d::recvSelf() - material " <<
i << "failed to recv itself\n";
return res;
}
}
}
return res;
}
示例13: data
int
Tri31::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
{
int res = 0;
int dataTag = this->getDbTag();
// Tri31 creates a Vector, receives the Vector and then sets the
// internal data with the data in the Vector
static Vector data(10);
res += theChannel.recvVector(dataTag, commitTag, data);
if (res < 0) {
opserr << "WARNING Tri31::recvSelf() - failed to receive Vector\n";
return res;
}
this->setTag((int)data(0));
thickness = data(1);
b[0] = data(3);
b[1] = data(4);
pressure = data(5);
alphaM = data(6);
betaK = data(7);
betaK0 = data(8);
betaKc = data(9);
static ID idData(2*numgp+numnodes+1);
// Tri31 now receives the tags of its four external nodes
res += theChannel.recvID(dataTag, commitTag, idData);
if (res < 0) {
opserr << "WARNING Tri31::recvSelf() - " << this->getTag() << " failed to receive ID\n";
return res;
}
int count = 2*numgp;
connectedExternalNodes(0) = idData(count); count += 1;
connectedExternalNodes(1) = idData(count); count += 1;
connectedExternalNodes(2) = idData(count);
if (theMaterial == 0) {
// Allocate new materials
theMaterial = new NDMaterial *[numgp];
if (theMaterial == 0) {
opserr << "Tri31::recvSelf() - Could not allocate NDMaterial* array\n";
return -1;
}
for (int i = 0; i < numgp; i++) {
int matClassTag = idData(i);
int matDbTag = idData(i+numgp);
// Allocate new material with the sent class tag
theMaterial[i] = theBroker.getNewNDMaterial(matClassTag);
if (theMaterial[i] == 0) {
opserr << "Tri31::recvSelf() - Broker could not create NDMaterial of class type " << matClassTag << endln;
return -1;
}
// Now receive materials into the newly allocated space
theMaterial[i]->setDbTag(matDbTag);
res += theMaterial[i]->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr << "NLBeamColumn3d::recvSelf() - material " << i << "failed to recv itself\n";
return res;
}
}
}
// materials exist , ensure materials of correct type and recvSelf on them
else {
for (int i = 0; i < numgp; i++) {
int matClassTag = idData(i);
int matDbTag = idData(i+numgp);
// Check that material is of the right type; if not,
// delete it and create a new one of the right type
if (theMaterial[i]->getClassTag() != matClassTag) {
delete theMaterial[i];
theMaterial[i] = theBroker.getNewNDMaterial(matClassTag);
if (theMaterial[i] == 0) {
opserr << "NLBeamColumn3d::recvSelf() - material " << i << "failed to create\n";
return -1;
}
}
// Receive the material
theMaterial[i]->setDbTag(matDbTag);
res += theMaterial[i]->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr << "NLBeamColumn3d::recvSelf() - material " << i << "failed to recv itself\n";
return res;
}
}
}
return res;
}
示例14: idData
int
NDFiber2d::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
{
//
// get tag and material info from an ID
//
int res = 0;
int dbTag = this->getDbTag();
static ID idData(3);
res += theChannel.recvID(dbTag, commitTag, idData);
if (res < 0) {
opserr << "NDFiber2d::recvSelf - failed to receive ID data\n";
return res;
}
this->setTag(idData(0));
//
// get area from a vector received from channel
//
static Vector dData(2);
res += theChannel.recvVector(dbTag, commitTag, dData);
if (res < 0) {
opserr << "NDFiber2d::recvSelf - failed to receive Vector data\n";
return res;
}
area = dData(0);
y = dData(1);
//
// now we do the material stuff
//
int matClassTag = idData(1);
// if we have a material, check it is of correct type
if (theMaterial != 0) {
if (matClassTag != theMaterial->getClassTag()) {
delete theMaterial;
theMaterial = 0;
}
}
// if no material we need to get one,
// NOTE: not an else if in case deleted in if above
if (theMaterial == 0) {
theMaterial = theBroker.getNewNDMaterial(matClassTag);
if (theMaterial == 0) {
opserr << "NDFiber2d::recvSelf() - " <<
"failed to get a NDMaterial of type " << matClassTag << endln;
return -1;
}
}
// set the materials dbTag and invoke recvSelf on the material
theMaterial->setDbTag(idData(2));
// now invoke recvSelf on the material
res += theMaterial->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr << "NDFiber2d::recvSelf() - the material failed in recvSelf()\n";
return res;
}
return res;
}
示例15: idData
int
BiaxialFiber3d::recvSelf(int commitTag, Channel &theChannel,
FEM_ObjectBroker &theBroker)
{
//
// get tag and material info from an ID
//
static ID idData(3);
int dbTag = this->getDbTag();
if (theChannel.recvID(dbTag, commitTag, idData) < 0) {
opserr << "BiaxialFiber3d::recvSelf() - failed to recv ID data\n";
return -1;
}
this->setTag(idData(0));
//
// get area and position datafrom a vector
//
static Vector dData(4);
if (theChannel.recvVector(dbTag, commitTag, dData) < 0) {
opserr << "BiaxialFiber3d::recvSelf() - failed to recv Vector data\n";
return -2;
}
area = dData(0);
as[0] = dData(1);
as[1] = dData(2);
R = dData(3);
//
// now we do the material stuff
//
int matClassTag = idData(1);
// if we have a material, check it is of correct type
if (theMaterial != 0) {
if (matClassTag != theMaterial->getClassTag()) {
delete theMaterial;
theMaterial = 0;
}
}
// if no material we need to get one,
// NOTE: not an else if in case deleted in if above
if (theMaterial == 0) {
theMaterial = theBroker.getNewNDMaterial(matClassTag);
if (theMaterial == 0) {
opserr << "BiaxialFiber3d::recvSelf() - " <<
"failed to get a UniaxialMaterial of type "<< matClassTag << endln;
return -3;
}
}
// set the materials dbTag and invoke recvSelf on the material
theMaterial->setDbTag(idData(2));
// now invoke recvSelf on the material
if (theMaterial->recvSelf(commitTag, theChannel, theBroker) < 0) {
opserr << "BiaxialFiber3d::recvSelf() - the material failed in recvSelf()\n";
return -4;
}
return 0;
}