本文整理汇总了C++中UniaxialMaterial::setDbTag方法的典型用法代码示例。如果您正苦于以下问题:C++ UniaxialMaterial::setDbTag方法的具体用法?C++ UniaxialMaterial::setDbTag怎么用?C++ UniaxialMaterial::setDbTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UniaxialMaterial
的用法示例。
在下文中一共展示了UniaxialMaterial::setDbTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: data
int
FiberSection2d::sendSelf(int commitTag, Channel &theChannel)
{
int res = 0;
// create an id to send objects tag and numFibers,
// size 3 so no conflict with matData below if just 1 fiber
static ID data(3);
data(0) = this->getTag();
data(1) = numFibers;
int dbTag = this->getDbTag();
res += theChannel.sendID(dbTag, commitTag, data);
if (res < 0) {
opserr << "FiberSection2d::sendSelf - failed to send ID data\n";
return res;
}
if (numFibers != 0) {
// create an id containingg classTag and dbTag for each material & send it
ID materialData(2*numFibers);
for (int i=0; i<numFibers; i++) {
UniaxialMaterial *theMat = theMaterials[i];
materialData(2*i) = theMat->getClassTag();
int matDbTag = theMat->getDbTag();
if (matDbTag == 0) {
matDbTag = theChannel.getDbTag();
if (matDbTag != 0)
theMat->setDbTag(matDbTag);
}
materialData(2*i+1) = matDbTag;
}
res += theChannel.sendID(dbTag, commitTag, materialData);
if (res < 0) {
opserr << "FiberSection2d::sendSelf - failed to send material data\n";
return res;
}
// send the fiber data, i.e. area and loc
Vector fiberData(matData, 2*numFibers);
res += theChannel.sendVector(dbTag, commitTag, fiberData);
if (res < 0) {
opserr << "FiberSection2d::sendSelf - failed to send material data\n";
return res;
}
// now invoke send(0 on all the materials
for (int j=0; j<numFibers; j++)
theMaterials[j]->sendSelf(commitTag, theChannel);
}
return res;
}
示例2: 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;
}