本文整理汇总了C++中Domain::getMPs方法的典型用法代码示例。如果您正苦于以下问题:C++ Domain::getMPs方法的具体用法?C++ Domain::getMPs怎么用?C++ Domain::getMPs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Domain
的用法示例。
在下文中一共展示了Domain::getMPs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: transformedNode
int
TransformationConstraintHandler::handle(const ID *nodesLast)
{
// first check links exist to a Domain and an AnalysisModel object
Domain *theDomain = this->getDomainPtr();
AnalysisModel *theModel = this->getAnalysisModelPtr();
Integrator *theIntegrator = this->getIntegratorPtr();
if ((theDomain == 0) || (theModel == 0) || (theIntegrator == 0)) {
opserr << "WARNING TransformationConstraintHandler::handle() - ";
opserr << " setLinks() has not been called\n";
return -1;
}
// get number ofelements and nodes in the domain
// and init the theFEs and theDOFs arrays
int numMPConstraints = theDomain->getNumMPs();
// int numSPConstraints = theDomain->getNumSPs();
int numSPConstraints = 0;
SP_ConstraintIter &theSP1s = theDomain->getDomainAndLoadPatternSPs();
SP_Constraint *theSP1;
while ((theSP1 = theSP1s()) != 0)
numSPConstraints++;
numDOF = 0;
ID transformedNode(0, 64);
int i;
// create an ID of constrained node tags in MP_Constraints
ID constrainedNodesMP(0, numMPConstraints);
MP_Constraint **mps =0;
if (numMPConstraints != 0) {
mps = new MP_Constraint *[numMPConstraints];
if (mps == 0) {
opserr << "WARNING TransformationConstraintHandler::handle() - ";
opserr << "ran out of memory for MP_Constraints";
opserr << " array of size " << numMPConstraints << endln;
return -3;
}
MP_ConstraintIter &theMPs = theDomain->getMPs();
MP_Constraint *theMP;
int index = 0;
while ((theMP = theMPs()) != 0) {
int nodeConstrained = theMP->getNodeConstrained();
if (transformedNode.getLocation(nodeConstrained) < 0)
transformedNode[numDOF++] = nodeConstrained;
constrainedNodesMP[index] = nodeConstrained;
mps[index] = theMP;
index++;
}
}
// create an ID of constrained node tags in SP_Constraints
ID constrainedNodesSP(0, numSPConstraints);;
SP_Constraint **sps =0;
if (numSPConstraints != 0) {
sps = new SP_Constraint *[numSPConstraints];
if (sps == 0) {
opserr << "WARNING TransformationConstraintHandler::handle() - ";
opserr << "ran out of memory for SP_Constraints";
opserr << " array of size " << numSPConstraints << endln;
if (mps != 0) delete [] mps;
if (sps != 0) delete [] sps;
return -3;
}
SP_ConstraintIter &theSPs = theDomain->getDomainAndLoadPatternSPs();
SP_Constraint *theSP;
int index = 0;
while ((theSP = theSPs()) != 0) {
int constrainedNode = theSP->getNodeTag();
if (transformedNode.getLocation(constrainedNode) < 0)
transformedNode[numDOF++] = constrainedNode;
constrainedNodesSP[index] = constrainedNode;
sps[index] = theSP;
index++;
}
}
// create an array for the DOF_Groups and zero it
if ((numDOF != 0) && ((theDOFs = new DOF_Group *[numDOF]) == 0)) {
opserr << "WARNING TransformationConstraintHandler::handle() - ";
opserr << "ran out of memory for DOF_Groups";
opserr << " array of size " << numDOF << endln;
return -3;
}
for (i=0; i<numDOF; i++) theDOFs[i] = 0;
//create a DOF_Group for each Node and add it to the AnalysisModel.
// :must of course set the initial IDs
NodeIter &theNod = theDomain->getNodes();
Node *nodPtr;
int numDofGrp = 0;
int count3 = 0;
int countDOF =0;
numConstrainedNodes = 0;
numDOF = 0;
//.........这里部分代码省略.........
示例2: setLinks
//.........这里部分代码省略.........
} else {
// just a regular element .. create an FE_Element for it & add to AnalysisModel
if ((fePtr = new FE_Element(numFeEle++, elePtr)) == 0) {
opserr << "WARNING PlainHandler::handle() - ran out of memory";
opserr << " creating FE_Element " << elePtr->getTag() << endln;
return -5;
}
theModel->addFE_Element(fePtr);
}
}
// create the LagrangeSP_FE for the SP_Constraints and
// add to the AnalysisModel
SP_ConstraintIter &theSPs = theDomain->getDomainAndLoadPatternSPs();
while ((spPtr = theSPs()) != 0) {
if ((dofPtr = new LagrangeDOF_Group(numDofGrp++, *spPtr)) == 0) {
opserr << "WARNING LagrangeConstraintHandler::handle()";
opserr << " - ran out of memory";
opserr << " creating LagrangeDOFGroup " << endln;
return -5;
}
const ID &id = dofPtr->getID();
for (int j=0; j < id.Size(); j++) {
dofPtr->setID(j,-2);
countDOF++;
}
theModel->addDOF_Group(dofPtr);
if ((fePtr = new LagrangeSP_FE(numFeEle++, *theDomain, *spPtr,
*dofPtr, alphaSP)) == 0) {
opserr << "WARNING LagrangeConstraintHandler::handle()";
opserr << " - ran out of memory";
opserr << " creating LagrangeSP_FE " << endln;
return -5;
}
theModel->addFE_Element(fePtr);
}
// create the LagrangeMP_FE for the MP_Constraints and
// add to the AnalysisModel
MP_ConstraintIter &theMPs = theDomain->getMPs();
while ((mpPtr = theMPs()) != 0) {
if ((dofPtr = new LagrangeDOF_Group(numDofGrp++, *mpPtr)) == 0) {
opserr << "WARNING LagrangeConstraintHandler::handle()";
opserr << " - ran out of memory";
opserr << " creating LagrangeDOFGroup " << endln;
return -5;
}
const ID &id = dofPtr->getID();
for (int j=0; j < id.Size(); j++) {
dofPtr->setID(j,-2);
countDOF++;
}
theModel->addDOF_Group(dofPtr);
if ((fePtr = new LagrangeMP_FE(numFeEle++, *theDomain, *mpPtr,
*dofPtr, alphaMP)) == 0) {
opserr << "WARNING LagrangeConstraintHandler::handle()";
opserr << " - ran out of memory";
opserr << " creating LagrangeMP_FE " << endln;
return -5;
}
theModel->addFE_Element(fePtr);
}
theModel->setNumEqn(countDOF);
// set the number of eqn in the model
// now see if we have to set any of the dof's to -3
// int numLast = 0;
if (nodesLast != 0)
for (int i=0; i<nodesLast->Size(); i++) {
int nodeID = (*nodesLast)(i);
Node *nodPtr = theDomain->getNode(nodeID);
if (nodPtr != 0) {
dofPtr = nodPtr->getDOF_GroupPtr();
const ID &id = dofPtr->getID();
// set all the dof values to -3
for (int j=0; j < id.Size(); j++)
if (id(j) == -2) {
dofPtr->setID(j,-3);
count3++;
} else {
opserr << "WARNING LagrangeConstraintHandler::handle() ";
opserr << " - boundary sp constraint in subdomain";
opserr << " this should not be - results suspect \n";
}
}
}
return count3;
}
示例3: 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;
}