本文整理汇总了C++中DOF_Group::getNodeTag方法的典型用法代码示例。如果您正苦于以下问题:C++ DOF_Group::getNodeTag方法的具体用法?C++ DOF_Group::getNodeTag怎么用?C++ DOF_Group::getNodeTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOF_Group
的用法示例。
在下文中一共展示了DOF_Group::getNodeTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MapOfTaggedObjects
Graph &
AnalysisModel::getDOFGroupGraph(void)
{
if (myGroupGraph == 0) {
int numVertex = this->getNumDOF_Groups();
if (numVertex == 0) {
opserr << "WARNING AnalysisMode::getGroupGraph";
opserr << " - 0 vertices, has the Domain been populated?\n";
exit(-1);
}
// myGroupGraph = new Graph(numVertex);
MapOfTaggedObjects *graphStorage = new MapOfTaggedObjects();
myGroupGraph = new Graph(*graphStorage);
if (numVertex == 0) {
opserr << "WARNING AnalysisMode::getGroupGraph";
opserr << " - out of memory\n";
exit(-1);
}
DOF_Group *dofPtr;
// now create the vertices with a reference equal to the DOF_Group number.
// and a tag which ranges from 0 through numVertex-1
DOF_GrpIter &dofIter2 = this->getDOFs();
int count = START_VERTEX_NUM;
while ((dofPtr = dofIter2()) != 0) {
int DOF_GroupTag = dofPtr->getTag();
int DOF_GroupNodeTag = dofPtr->getNodeTag();
int numDOF = dofPtr->getNumFreeDOF();
Vertex *vertexPtr = new Vertex(DOF_GroupTag, DOF_GroupNodeTag, 0, numDOF);
if (vertexPtr == 0) {
opserr << "WARNING DOF_GroupGraph::DOF_GroupGraph";
opserr << " - Not Enough Memory to create ";
opserr << count << "th Vertex\n";
return *myGroupGraph;
}
myGroupGraph->addVertex(vertexPtr);
}
// now add the edges, by looping over the Elements, getting their
// IDs and adding edges between DOFs for equation numbers >= START_EQN_NUM
FE_Element *elePtr;
FE_EleIter &eleIter = this->getFEs();
while((elePtr = eleIter()) != 0) {
const ID &id = elePtr->getDOFtags();
int size = id.Size();
for (int i=0; i<size; i++) {
int dof1 = id(i);
for (int j=0; j<size; j++)
if (i != j) {
int dof2 = id(j);
myGroupGraph->addEdge(dof1,dof2);
}
}
}
}
return *myGroupGraph;
}
示例2: setLinks
int
PlainNumberer::numberDOF(int lastDOF)
{
int eqnNumber = 0; // start equation number = 0
// get a pointer to the model & check its not null
AnalysisModel *theModel = this->getAnalysisModelPtr();
Domain *theDomain = 0;
if (theModel != 0) theDomain = theModel->getDomainPtr();
if (theModel == 0 || theDomain == 0) {
opserr << "WARNING PlainNumberer::numberDOF(int) -";
opserr << " - no AnalysisModel - has setLinks() been invoked?\n";
return -1;
}
if (lastDOF != -1) {
opserr << "WARNING PlainNumberer::numberDOF(int lastDOF):";
opserr << " does not use the lastDOF as requested\n";
}
// iterate throgh the DOFs first time setting -2 values
DOF_GrpIter &theDOFs = theModel->getDOFs();
DOF_Group *dofPtr;
while ((dofPtr = theDOFs()) != 0) {
const ID &theID = dofPtr->getID();
for (int i=0; i<theID.Size(); i++)
if (theID(i) == -2)
dofPtr->setID(i,eqnNumber++);
}
// iterate throgh the DOFs second time setting -3 values
DOF_GrpIter &moreDOFs = theModel->getDOFs();
while ((dofPtr = moreDOFs()) != 0) {
const ID &theID = dofPtr->getID();
for (int i=0; i<theID.Size(); i++)
if (theID(i) == -3) dofPtr->setID(i,eqnNumber++);
}
// iterate through the DOFs one last time setting any -4 values
DOF_GrpIter &tDOFs = theModel->getDOFs();
while ((dofPtr = tDOFs()) != 0) {
const ID &theID = dofPtr->getID();
int have4s = 0;
for (int i=0; i<theID.Size(); i++)
if (theID(i) == -4) have4s = 1;
if (have4s == 1) {
int nodeID = dofPtr->getNodeTag();
// loop through the MP_Constraints to see if any of the
// DOFs are constrained, note constraint matrix must be diagonal
// with 1's on the diagonal
MP_ConstraintIter &theMPs = theDomain->getMPs();
MP_Constraint *mpPtr;
while ((mpPtr = theMPs()) != 0 ) {
// note keep looping over all in case multiple constraints
// are used to constrain a node -- can't assume intelli user
if (mpPtr->getNodeConstrained() == nodeID) {
int nodeRetained = mpPtr->getNodeRetained();
Node *nodeRetainedPtr = theDomain->getNode(nodeRetained);
DOF_Group *retainedDOF = nodeRetainedPtr->getDOF_GroupPtr();
const ID&retainedDOFIDs = retainedDOF->getID();
const ID&constrainedDOFs = mpPtr->getConstrainedDOFs();
const ID&retainedDOFs = mpPtr->getRetainedDOFs();
for (int i=0; i<constrainedDOFs.Size(); i++) {
int dofC = constrainedDOFs(i);
int dofR = retainedDOFs(i);
int dofID = retainedDOFIDs(dofR);
dofPtr->setID(dofC, dofID);
}
}
}
}
}
eqnNumber--;
int numEqn = eqnNumber - START_EQN_NUMBER +1;
// iterate through the FE_Element getting them to set their IDs
FE_EleIter &theEle = theModel->getFEs();
FE_Element *elePtr;
while ((elePtr = theEle()) != 0)
elePtr->setID();
// set the numOfEquation in the Model
theModel->setNumEqn(numEqn);
return numEqn;
}