本文整理汇总了C++中FEM_ObjectBroker::getNewUniaxialMaterial方法的典型用法代码示例。如果您正苦于以下问题:C++ FEM_ObjectBroker::getNewUniaxialMaterial方法的具体用法?C++ FEM_ObjectBroker::getNewUniaxialMaterial怎么用?C++ FEM_ObjectBroker::getNewUniaxialMaterial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FEM_ObjectBroker
的用法示例。
在下文中一共展示了FEM_ObjectBroker::getNewUniaxialMaterial方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: data
int
CorotTruss::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
{
int res;
int dataTag = this->getDbTag();
// truss 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 Truss::recvSelf() - failed to receive Vector\n";
return -1;
}
this->setTag((int)data(0));
numDIM = (int)data(1);
numDOF = (int)data(2);
A = data(3);
rho = data(6);
// truss now receives the tags of it's two external nodes
res = theChannel.recvID(dataTag, commitTag, connectedExternalNodes);
if (res < 0) {
opserr << "WARNING Truss::recvSelf() - " << this->getTag() << " failed to receive ID\n";
return -2;
}
// finally truss creates a material object of the correct type,
// sets its database tag and asks this new object to recveive itself.
int matClass = (int)data(4);
int matDb = (int)data(5);
// check if we have a material object already & if we do if of right type
if ((theMaterial == 0) || (theMaterial->getClassTag() != matClass)) {
// if old one .. delete it
if (theMaterial != 0)
delete theMaterial;
// create a new material object
theMaterial = theBroker.getNewUniaxialMaterial(matClass);
if (theMaterial == 0) {
opserr << "WARNING Truss::recvSelf() - " << this->getTag() <<
"failed to get a blank Material of type: " << matClass << endln;
return -3;
}
}
theMaterial->setDbTag(matDb); // note: we set the dbTag before we receive the material
res = theMaterial->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr << "WARNING Truss::recvSelf() - " << this->getTag() << " failed to receive its Material\n";
return -3;
}
return 0;
}
示例2: classTags
int
PathIndependentMaterial::recvSelf(int cTag, Channel &theChannel,
FEM_ObjectBroker &theBroker)
{
int res = 0;
static ID classTags(3);
int dbTag = this->getDbTag();
res = theChannel.recvID(dbTag, cTag, classTags);
if (res < 0) {
opserr << "PathIndependentMaterial::recvSelf -- could not receive ID\n";
return res;
}
this->setTag(int(classTags(2)));
// Check if the material is null; if so, get a new one
if (theMaterial == 0) {
theMaterial = theBroker.getNewUniaxialMaterial(classTags(0));
if (theMaterial == 0) {
opserr << " PathIndependentMaterial::recvSelf -- could not get a UniaxialMaterial\n";
return -1;
}
}
// Check that the material is of the right type; if not, delete
// the current one and get a new one of the right type
if (theMaterial->getClassTag() != classTags(0)) {
delete theMaterial;
theMaterial = theBroker.getNewUniaxialMaterial(classTags(0));
if (theMaterial == 0) {
opserr << "PathIndependentMaterial::recvSelf -- could not get a UniaxialMaterial\n";
exit(-1);
}
}
// Now, receive the material
theMaterial->setDbTag(classTags(1));
res += theMaterial->recvSelf(cTag, theChannel, theBroker);
if (res < 0) {
opserr << "PathIndependentMaterial::recvSelf -- could not receive UniaxialMaterial\n";
return res;
}
return res;
}
示例3: idData
int
CoupledZeroLength::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
{
int res = 0;
int dataTag = this->getDbTag();
// CoupledZeroLength creates an ID, receives the ID and then sets the
// internal data with the data in the ID
static ID idData(10);
res += theChannel.recvID(dataTag, commitTag, idData);
if (res < 0) {
opserr << "CoupledZeroLength::recvSelf -- failed to receive ID data\n";
return res;
}
res += theChannel.recvMatrix(dataTag, commitTag, transformation);
if (res < 0) {
opserr << "CoupledZeroLength::recvSelf -- failed to receive transformation Matrix\n";
return res;
}
this->setTag(idData(0));
dimension = idData(1);
numDOF = idData(2);
connectedExternalNodes(0) = idData(3);
connectedExternalNodes(1) = idData(4);
useRayleighDamping = idData(5);
dirn1 = idData(6);
dirn1 = idData(7);
int matDbTag = idData(8);
int matClassTag = idData(9);
// If null, get a new one from the broker
if (theMaterial == 0 || theMaterial->getClassTag() != matClassTag) {
if (theMaterial != 0)
delete theMaterial;
theMaterial = theBroker.getNewUniaxialMaterial(matClassTag);
if (theMaterial == 0) {
opserr << "CoupledZeroLength::recvSelf -- failed to allocate new Material " << endln;
return -1;
}
}
// Receive the materials
theMaterial->setDbTag(matDbTag);
res = theMaterial->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr << "CoupledZeroLength::recvSelf -- failed to receive new Material1d " << endln;
}
return res;
}
示例4: data
int ElastomericBearing2d::recvSelf(int commitTag, Channel &rChannel,
FEM_ObjectBroker &theBroker)
{
// delete material memory
for (int i=0; i<2; i++)
if (theMaterials[i] != 0)
delete theMaterials[i];
// receive element parameters
static Vector data(9);
rChannel.recvVector(0, commitTag, data);
this->setTag((int)data(0));
k0 = data(1);
qYield = data(2);
k2 = data(3);
shearDistI = data(4);
addRayleigh = (int)data(5);
mass = data(6);
double ke = k0 + k2;
// receive the two end nodes
rChannel.recvID(0, commitTag, connectedExternalNodes);
// receive the material class tags
ID matClassTags(2);
rChannel.recvID(0, commitTag, matClassTags);
// receive the material models
for (int i=0; i<2; i++) {
theMaterials[i] = theBroker.getNewUniaxialMaterial(matClassTags(i));
if (theMaterials[i] == 0) {
opserr << "ElastomericBearing2d::recvSelf() - "
<< "failed to get blank uniaxial material.\n";
return -2;
}
theMaterials[i]->recvSelf(commitTag, rChannel, theBroker);
}
// receive remaining data
if ((int)data(7) == 3) {
x.resize(3);
rChannel.recvVector(0, commitTag, x);
}
if ((int)data(8) == 3) {
y.resize(3);
rChannel.recvVector(0, commitTag, y);
}
// initialize initial stiffness matrix
kbInit.Zero();
kbInit(0,0) = theMaterials[0]->getInitialTangent();
kbInit(1,1) = ke;
kbInit(2,2) = theMaterials[1]->getInitialTangent();
// initialize other variables
this->revertToStart();
return 0;
}
示例5: dataID
int
MinMaxMaterial::recvSelf(int cTag, Channel &theChannel,
FEM_ObjectBroker &theBroker)
{
int dbTag = this->getDbTag();
static ID dataID(3);
if (theChannel.recvID(dbTag, cTag, dataID) < 0) {
opserr << "MinMaxMaterial::recvSelf() - failed to get the ID\n";
return -1;
}
this->setTag(int(dataID(0)));
// as no way to change material, don't have to check classTag of the material
if (theMaterial == 0) {
int matClassTag = int(dataID(1));
theMaterial = theBroker.getNewUniaxialMaterial(matClassTag);
if (theMaterial == 0) {
opserr << "MinMaxMaterial::recvSelf() - failed to create Material with classTag "
<< dataID(0) << endln;
return -2;
}
}
theMaterial->setDbTag(dataID(2));
static Vector dataVec(3);
if (theChannel.recvVector(dbTag, cTag, dataVec) < 0) {
opserr << "MinMaxMaterial::recvSelf() - failed to get the Vector\n";
return -3;
}
minStrain = dataVec(0);
maxStrain = dataVec(1);
if (dataVec(2) == 1.0)
Cfailed = true;
else
Cfailed = false;
Tfailed = Cfailed;
if (theMaterial->recvSelf(cTag, theChannel, theBroker) < 0) {
opserr << "MinMaxMaterial::recvSelf() - failed to get the Material\n";
return -4;
}
return 0;
}
示例6: idData
int
PlateRebarMaterial::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 << "PlateRebarMaterial::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.getNewUniaxialMaterial(matClassTag);
if (theMat == 0) {
opserr << "PlateRebarMaterial::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 << "PlateRebarMaterial::sendSelf() - failed to receive vector data" << endln;
return res;
}
angle = vecData(0);
double rang = angle * 0.0174532925;
c = cos(rang);
s = sin(rang);
// now receive the materials data
res = theMat->recvSelf(commitTag, theChannel, theBroker);
if (res < 0)
opserr << "PlateRebarMaterial::sendSelf() - failed to receive material1" << endln;
return res;
}
示例7: recvSelf
int RAReinforcedConcretePlateFiber::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(9);
res += theChannel.recvVector(dataTag, commitTag, data);
if (res < 0) {
opserr << "WARNING RAReinforcedConcretePlateFiber::recvSelf() - failed to receive Vector\n";
return res;
}
this->setTag((int)data(0));
rho = data(1);
angle1 = data(2);
angle2 = data(3);
rou1 = data(4);
rou2 = data(5);
fpc = data(6);
fy = data(7);
E0 = data(8);
static ID idData(8);
// now receives the tags of its materials
res += theChannel.recvID(dataTag, commitTag, idData);
if (res < 0) {
opserr << "WARNING RAReinforcedConcretePlateFiber::recvSelf() - " << this->getTag() << " failed to receive ID\n";
return res;
}
if (theMaterial == 0) {
// Allocate new materials
theMaterial = new UniaxialMaterial *[4];
if (theMaterial == 0) {
opserr << "RAReinforcedConcretePlateFiber::recvSelf() - Could not allocate UniaxialMaterial* array\n";
return -1;
}
for (int i = 0; i < 4; i++) {
int matClassTag = idData(i);
int matDbTag = idData(i+4);
// Allocate new material with the sent class tag
theMaterial[i] = theBroker.getNewUniaxialMaterial(matClassTag);
if (theMaterial[i] == 0) {
opserr << "RAReinforcedConcretePlateFiber::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 << "RAReinforcedConcretePlateFiber::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 < 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 (theMaterial[i]->getClassTag() != matClassTag) {
delete theMaterial[i];
theMaterial[i] = theBroker.getNewUniaxialMaterial(matClassTag);
if (theMaterial[i] == 0) {
opserr << "RAReinforcedConcretePlateFiber::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 << "RAReinforcedConcretePlateFiber::recvSelf() - material " << i << "failed to recv itself\n";
return res;
}
}
}
return res;
}
示例8: data
int SingleFPSimple2d::recvSelf(int commitTag, Channel &rChannel,
FEM_ObjectBroker &theBroker)
{
// delete material memory
for (int i=0; i<2; i++)
if (theMaterials[i] != 0)
delete theMaterials[i];
// receive element parameters
static Vector data(11);
rChannel.recvVector(0, commitTag, data);
this->setTag((int)data(0));
R = data(1);
h = data(2);
uy = data(3);
shearDistI = data(4);
addRayleigh = (int)data(5);
mass = data(6);
maxIter = (int)data(7);
tol = data(8);
// receive the two end nodes
rChannel.recvID(0, commitTag, connectedExternalNodes);
// receive the friction model class tag
ID frnClassTag(1);
rChannel.recvID(0, commitTag, frnClassTag);
// receive the friction model
theFrnMdl = theBroker.getNewFrictionModel(frnClassTag(0));
if (theFrnMdl == 0) {
opserr << "SingleFPSimple2d::recvSelf() - "
<< "failed to get blank friction model.\n";
return -1;
}
theFrnMdl->recvSelf(commitTag, rChannel, theBroker);
// receive the material class tags
ID matClassTags(2);
rChannel.recvID(0, commitTag, matClassTags);
// receive the material models
for (int i=0; i<2; i++) {
theMaterials[i] = theBroker.getNewUniaxialMaterial(matClassTags(i));
if (theMaterials[i] == 0) {
opserr << "SingleFPSimple2d::recvSelf() - "
<< "failed to get blank uniaxial material.\n";
return -2;
}
theMaterials[i]->recvSelf(commitTag, rChannel, theBroker);
}
// receive remaining data
if ((int)data(9) == 3) {
x.resize(3);
rChannel.recvVector(0, commitTag, x);
}
if ((int)data(10) == 3) {
y.resize(3);
rChannel.recvVector(0, commitTag, y);
}
// initialize initial stiffness matrix
kbInit.Zero();
kbInit(0,0) = theMaterials[0]->getInitialTangent();
kbInit(1,1) = kbInit(0,0)*DBL_EPSILON;
kbInit(2,2) = theMaterials[1]->getInitialTangent();
// initialize other variables
this->revertToStart();
return 0;
}
示例9: data
int
ParallelMaterial::recvSelf(int cTag, Channel &theChannel,
FEM_ObjectBroker &theBroker)
{
int res = 0;
static ID data(3);
int dbTag = this->getDbTag();
res = theChannel.recvID(dbTag, cTag, data);
if (res < 0) {
opserr << "ParallelMaterial::recvSelf() - failed to receive data\n";
return res;
}
this->setTag(int(data(0)));
int numMaterialsSent = int(data(1));
if (numMaterials != numMaterialsSent) {
numMaterials = numMaterialsSent;
if (theModels != 0) {
for (int i=0; i<numMaterials; i++)
delete theModels[i];
delete [] theModels;
}
theModels = new UniaxialMaterial *[numMaterials];
if (theModels == 0) {
opserr << "FATAL ParallelMaterial::recvSelf() - ran out of memory";
opserr << " for array of size: " << numMaterials << "\n";
return -2;
}
for (int i=0; i<numMaterials; i++)
theModels[i] = 0;
}
if (data(2) == 1) {
theFactors = new Vector(numMaterials);
res = theChannel.recvVector(dbTag, cTag, *theFactors);
if (res < 0) {
opserr << "ParallelMaterial::recvSelf() - failed to receive factors\n";
return res;
}
}
// create and receive an ID for the classTags and dbTags of the local
// MaterialModel objects
ID classTags(numMaterials*2);
res = theChannel.recvID(dbTag, cTag, classTags);
if (res < 0) {
opserr << "ParallelMaterial::recvSelf() - failed to receive classTags\n";
return res;
}
// now for each of the MaterialModel objects, create a new object
// and invoke recvSelf() on it
for (int i=0; i<numMaterials; i++) {
int matClassTag = classTags(i);
if (theModels[i] == 0 || theModels[i]->getClassTag() != matClassTag) {
if (theModels[i] == 0)
delete theModels[i];
UniaxialMaterial *theMaterialModel =
theBroker.getNewUniaxialMaterial(matClassTag);
if (theMaterialModel != 0) {
theModels[i] = theMaterialModel;
theMaterialModel->setDbTag(classTags(i+numMaterials));
}
else {
opserr << "FATAL ParallelMaterial::recvSelf() ";
opserr << " could not get a UniaxialMaterial \n";
exit(-1);
}
}
theModels[i]->recvSelf(cTag, theChannel, theBroker);
}
return 0;
}
示例10: data
int
SectionAggregator::recvSelf(int cTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
{
int res = 0;
// Create an ID and receive tag and section order
static ID data(5);
res += theChannel.recvID(this->getDbTag(), cTag, data);
if (res < 0) {
opserr << "SectionAggregator::recvSelf -- could not receive data ID\n";
return res;
}
this->setTag(data(0));
otherDbTag = data(1);
int order = data(2);
int theSectionOrder = data(3);
numMats = data(4);
if (order > 0) {
if (e == 0 || e->Size() != order) {
if (e != 0) {
delete e;
delete s;
delete ks;
delete fs;
delete theCode;
}
e = new Vector(workArea, order);
s = new Vector(&workArea[maxOrder], order);
ks = new Matrix(&workArea[2*maxOrder], order, order);
fs = new Matrix(&workArea[maxOrder*(maxOrder+2)], order, order);
theCode = new ID(codeArea, order);
}
}
if (numMats > 0) {
if (matCodes == 0 || matCodes->Size() != numMats) {
if (matCodes != 0)
delete matCodes;
matCodes = new ID(numMats);
}
}
// Determine how many classTags there are and allocate ID vector
int numTags = (theSectionOrder == 0) ? numMats : numMats + 1;
ID classTags(numTags*2 + numMats);
// Receive the material class and db tags
res += theChannel.recvID(otherDbTag, cTag, classTags);
if (res < 0) {
opserr << "SectionAggregator::recvSelf -- could not receive classTags ID\n";
return res;
}
// Check if null pointer, allocate if so
if (theAdditions == 0) {
theAdditions = new UniaxialMaterial *[numMats];
if (theAdditions == 0) {
opserr << "SectionAggregator::recvSelf -- could not allocate UniaxialMaterial array\n";
return -1;
}
// Set pointers to null ... will get allocated by theBroker
for (int j = 0; j < numMats; j++)
theAdditions[j] = 0;
}
// Loop over the UniaxialMaterials
int i, classTag;
for (i = 0; i < numMats; i++) {
classTag = classTags(i);
// Check if the UniaxialMaterial is null; if so, get a new one
if (theAdditions[i] == 0)
theAdditions[i] = theBroker.getNewUniaxialMaterial(classTag);
// Check that the UniaxialMaterial is of the right type; if not, delete
// the current one and get a new one of the right type
else if (theAdditions[i]->getClassTag() != classTag) {
delete theAdditions[i];
theAdditions[i] = theBroker.getNewUniaxialMaterial(classTag);
}
// Check if either allocation failed
if (theAdditions[i] == 0) {
opserr << "SectionAggregator::recvSelf -- could not get UniaxialMaterial, i = " << i << endln;
return -1;
}
// Now, receive the UniaxialMaterial
theAdditions[i]->setDbTag(classTags(i+numTags));
res += theAdditions[i]->recvSelf(cTag, theChannel, theBroker);
if (res < 0) {
opserr << "SectionAggregator::recvSelf -- could not receive UniaxialMaterial, i = " << i << endln;
return res;
}
}
// If there is no Section to receive, return
//.........这里部分代码省略.........
示例11: data
int
FiberSection2d::recvSelf(int commitTag, Channel &theChannel,
FEM_ObjectBroker &theBroker)
{
int res = 0;
static ID data(3);
int dbTag = this->getDbTag();
res += theChannel.recvID(dbTag, commitTag, data);
if (res < 0) {
opserr << "FiberSection2d::recvSelf - failed to recv ID data\n";
return res;
}
this->setTag(data(0));
// recv data about materials objects, classTag and dbTag
if (data(1) != 0) {
ID materialData(2*data(1));
res += theChannel.recvID(dbTag, commitTag, materialData);
if (res < 0) {
opserr << "FiberSection2d::recvSelf - failed to recv material data\n";
return res;
}
// if current arrays not of correct size, release old and resize
if (theMaterials == 0 || numFibers != data(1)) {
// delete old stuff if outa date
if (theMaterials != 0) {
for (int i=0; i<numFibers; i++)
delete theMaterials[i];
delete [] theMaterials;
if (matData != 0)
delete [] matData;
matData = 0;
theMaterials = 0;
}
// create memory to hold material pointers and fiber data
numFibers = data(1);
sizeFibers = data(1);
if (numFibers != 0) {
theMaterials = new UniaxialMaterial *[numFibers];
if (theMaterials == 0) {
opserr <<"FiberSection2d::recvSelf -- failed to allocate Material pointers\n";
exit(-1);
}
for (int j=0; j<numFibers; j++)
theMaterials[j] = 0;
matData = new double [numFibers*2];
if (matData == 0) {
opserr <<"FiberSection2d::recvSelf -- failed to allocate double array for material data\n";
exit(-1);
}
}
}
Vector fiberData(matData, 2*numFibers);
res += theChannel.recvVector(dbTag, commitTag, fiberData);
if (res < 0) {
opserr << "FiberSection2d::recvSelf - failed to recv material data\n";
return res;
}
int i;
for (i=0; i<numFibers; i++) {
int classTag = materialData(2*i);
int dbTag = materialData(2*i+1);
// if material pointed to is blank or not of corrcet type,
// release old and create a new one
if (theMaterials[i] == 0)
theMaterials[i] = theBroker.getNewUniaxialMaterial(classTag);
else if (theMaterials[i]->getClassTag() != classTag) {
delete theMaterials[i];
theMaterials[i] = theBroker.getNewUniaxialMaterial(classTag);
}
if (theMaterials[i] == 0) {
opserr <<"FiberSection2d::recvSelf -- failed to allocate double array for material data\n";
exit(-1);
}
theMaterials[i]->setDbTag(dbTag);
res += theMaterials[i]->recvSelf(commitTag, theChannel, theBroker);
}
QzBar = 0.0;
ABar = 0.0;
double yLoc, Area;
// Recompute centroid
for (i = 0; i < numFibers; i++) {
yLoc = matData[2*i];
Area = matData[2*i+1];
ABar += Area;
//.........这里部分代码省略.........
示例12: 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;
//.........这里部分代码省略.........
示例13: data
int
N4BiaxialTruss::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
{
int res;
int dataTag = this->getDbTag();
// N4BiaxialTruss creates a Vector, receives the Vector and then sets the
// internal data with the data in the Vector
static Vector data(11);
res = theChannel.recvVector(dataTag, commitTag, data);
if (res < 0) {
opserr <<"WARNING N4BiaxialTruss::recvSelf() - failed to receive Vector\n";
return -1;
}
this->setTag((int)data(0));
dimension = (int)data(1);
numDOF = (int)data(2);
A = data(3);
rho = data(6);
if (data(7) == 0)
doRayleighDamping = 0;
else
doRayleighDamping = 1;
// N4BiaxialTruss now receives the tags of it's nodes
res = theChannel.recvID(dataTag, commitTag, connectedExternalNodes);
if (res < 0) {
opserr <<"WARNING N4BiaxialTruss::recvSelf() - " << this->getTag() << " failed to receive ID\n";
return -2;
}
// finally N4BiaxialTruss creates a material object of the correct type,
// sets its database tag and asks this new object to recveive itself.
int matClass1 = (int)data(4);
int matDb1 = (int)data(8);
int matClass2 = (int)data(5);
int matDb2 = (int)data(9);
// check if we have a material object already & if we do if of right type
if ((theMaterial_1 == 0) || (theMaterial_1->getClassTag() != matClass1)) {
// if old one .. delete it
if (theMaterial_1 != 0)
delete theMaterial_1;
// create a new material object
theMaterial_1 = theBroker.getNewUniaxialMaterial(matClass1);
if (theMaterial_1 == 0) {
opserr <<"WARNING N4BiaxialTruss::recvSelf() - " << this->getTag()
<< " failed to get a blank Material of type " << matClass1 << endln;
return -3;
}
if (theMaterial_1->getClassTag() == MAT_TAG_ConcretewBeta) {
theBetaMaterial_1 = (ConcretewBeta *) theMaterial_1;
}
}
theMaterial_1->setDbTag(matDb1); // note: we set the dbTag before we receive the material
res = theMaterial_1->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr <<"WARNING N4BiaxialTruss::recvSelf() - "<< this->getTag() << "failed to receive its Material\n";
return -3;
}
// Again with Material_2
if ((theMaterial_2 == 0) || (theMaterial_2->getClassTag() != matClass2)) {
// if old one .. delete it
if (theMaterial_2 != 0)
delete theMaterial_2;
// create a new material object
theMaterial_2 = theBroker.getNewUniaxialMaterial(matClass2);
if (theMaterial_2 == 0) {
opserr <<"WARNING N4BiaxialTruss::recvSelf() - " << this->getTag()
<< " failed to get a blank Material of type " << matClass2 << endln;
return -3;
}
if (theMaterial_2->getClassTag() == MAT_TAG_ConcretewBeta) {
theBetaMaterial_2 = (ConcretewBeta *) theMaterial_2;
}
}
theMaterial_2->setDbTag(matDb2); // note: we set the dbTag before we receive the material
res = theMaterial_2->recvSelf(commitTag, theChannel, theBroker);
if (res < 0) {
opserr <<"WARNING N4BiaxialTruss::recvSelf() - "<< this->getTag() << "failed to receive its Material\n";
return -3;
}
return 0;
}
示例14: recvSelf
int TwoNodeLink::recvSelf(int commitTag, Channel &rChannel,
FEM_ObjectBroker &theBroker)
{
// delete dynamic memory
if (dir != 0)
delete dir;
if (theMaterials != 0) {
for (int i=0; i<numDir; i++)
if (theMaterials[i] != 0)
delete theMaterials[i];
delete [] theMaterials;
}
// receive element parameters
static Vector data(14);
rChannel.recvVector(0, commitTag, data);
this->setTag((int)data(0));
numDIM = (int)data(1);
numDOF = (int)data(2);
numDir = (int)data(3);
addRayleigh = (int)data(8);
mass = data(9);
alphaM = data(10);
betaK = data(11);
betaK0 = data(12);
betaKc = data(13);
// receive the two end nodes
rChannel.recvID(0, commitTag, connectedExternalNodes);
// allocate memory for direction array and receive it
dir = new ID(numDir);
if (dir == 0) {
opserr << "TwoNodeLink::recvSelf() - "
<< "failed to creat direction array\n";
return -1;
}
rChannel.recvID(0, commitTag, *dir);
// receive the material class tags
ID matClassTags(numDir);
rChannel.recvID(0, commitTag, matClassTags);
// allocate memory for the uniaxial materials
theMaterials = new UniaxialMaterial* [numDir];
if (theMaterials == 0) {
opserr << "TwoNodeLink::recvSelf() - "
<< "failed to allocate pointers for uniaxial materials.\n";
return -2;
}
// receive the material models
for (int i=0; i<numDir; i++) {
theMaterials[i] = theBroker.getNewUniaxialMaterial(matClassTags(i));
if (theMaterials[i] == 0) {
opserr << "TwoNodeLink::recvSelf() - "
<< "failed to get blank uniaxial material.\n";
return -3;
}
theMaterials[i]->recvSelf(commitTag, rChannel, theBroker);
}
// receive remaining data
if ((int)data(4) == 3) {
x.resize(3);
rChannel.recvVector(0, commitTag, x);
}
if ((int)data(5) == 3) {
y.resize(3);
rChannel.recvVector(0, commitTag, y);
}
if ((int)data(6) == 4) {
Mratio.resize(4);
rChannel.recvVector(0, commitTag, Mratio);
// check p-delta moment distribution ratios
if (Mratio(0)+Mratio(1) > 1.0) {
opserr << "TwoNodeLink::recvSelf() - "
<< "incorrect p-delta moment ratios:\nrMy1 + rMy2 = "
<< Mratio(0)+Mratio(1) << " > 1.0\n";
return -4;
}
if (Mratio(2)+Mratio(3) > 1.0) {
opserr << "TwoNodeLink::recvSelf() - "
<< "incorrect p-delta moment ratios:\nrMz1 + rMz2 = "
<< Mratio(2)+Mratio(3) << " > 1.0\n";
return -4;
}
}
if ((int)data(7) == 2) {
shearDistI.resize(2);
rChannel.recvVector(0, commitTag, shearDistI);
// check shear distance ratios
if (shearDistI(0) < 0.0 || shearDistI(0) > 1.0) {
opserr << "TwoNodeLink::recvSelf() - "
<< "incorrect shear distance ratio:\n shearDistIy = "
<< shearDistI(0) << " < 0.0 or > 1.0\n";
return -5;
}
if (shearDistI(1) < 0.0 || shearDistI(1) > 1.0) {
opserr << "TwoNodeLink::recvSelf() - "
<< "incorrect shear distance ratio:\n shearDistIz = "
//.........这里部分代码省略.........