本文整理汇总了C++中AnalysisModel::setNumEqn方法的典型用法代码示例。如果您正苦于以下问题:C++ AnalysisModel::setNumEqn方法的具体用法?C++ AnalysisModel::setNumEqn怎么用?C++ AnalysisModel::setNumEqn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnalysisModel
的用法示例。
在下文中一共展示了AnalysisModel::setNumEqn方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getClassName
//.........这里部分代码省略.........
<< " non-varying assumed\n";
const Matrix &C = mpPtr->getConstraint();
int numRows = C.noRows();
int numCols = C.noCols();
if(numRows != numCols)
std::cerr << getClassName() << "::" << __FUNCTION__
<< " constraint matrix not diagonal,"
<< " ignoring constraint for node "
<< nodeID << std::endl;
else
{
int ok = 0;
for(int i=0; i<numRows; i++)
{
if(C(i,i) != 1.0) ok = 1;
for(int j=0; j<numRows; j++)
if(i != j)
if(C(i,j) != 0.0)
ok = 1;
}
if(ok != 0)
std::cerr << getClassName() << "::" << __FUNCTION__
<< "; constraint matrix not identity,"
<< " ignoring constraint for node "
<< nodeID << std::endl;
else
{
const ID &dofs = mpPtr->getConstrainedDOFs();
const ID &id = dofPtr->getID();
for(int i=0; i<dofs.Size(); i++)
{
int dof = dofs(i);
if(id(dof) == -2)
{
dofPtr->setID(dof,-4);
countDOF--;
}
else
std::cerr << getClassName() << "::" << __FUNCTION__
<< "; constraint at dof " << dof
<< " already specified for constrained node"
<< " in MFreedom_Constraint at node "
<< nodeID << std::endl;
}
}
}
}
}
// loop through the MFreedom_Constraints to see if any of the
// DOFs are constrained, note constraint matrix must be diagonal
// with 1's on the diagonal
MRMFreedom_ConstraintIter &theMRMPs = theDomain->getConstraints().getMRMPs();
MRMFreedom_Constraint *mrmpPtr;
while((mrmpPtr = theMRMPs()) != 0)
{
std::cerr << getClassName() << "::" << __FUNCTION__
<< "; loop through the MRMFreedom_Constraints."
<< std::endl;
}
}
// set the number of eqn in the model
theModel->setNumEqn(countDOF);
// 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
std::cerr << getClassName() << "::" << __FUNCTION__
<< "; boundary sp constraint in subdomain"
<< " this should not be - results suspect \n";
}
}
// initialise the FE_Elements and add to the XC::AnalysisModel.
ElementIter &theEle = theDomain->getElements();
Element *elePtr;
int numFe = 0;
FE_Element *fePtr;
while((elePtr = theEle()) != 0)
{ fePtr= theModel->createFE_Element(numFe++, elePtr); }
return count3;
}
示例2: transformedNode
//.........这里部分代码省略.........
for (i=0; i<numFE; i++) theFEs[i] = 0;
ElementIter &theEle1 = theDomain->getElements();
// int numConstraints = numMPConstraints+numSPConstraints;
int numFeEle = 0;
int numFE = 0;
while ((elePtr = theEle1()) != 0) {
int tag = elePtr->getTag();
if (elePtr->isSubdomain() == true) {
Subdomain *theSub = (Subdomain *)elePtr;
if (theSub->doesIndependentAnalysis() == false) {
if (transformedEle.getLocation(tag) < 0) {
if ((fePtr = new FE_Element(numFeEle, elePtr)) == 0) {
opserr << "WARNING TransformationConstraintHandler::handle()";
opserr << " - ran out of memory";
opserr << " creating FE_Element " << elePtr->getTag() << endln;
if (mps != 0) delete [] mps;
if (sps != 0) delete [] sps;
return -5;
}
} else {
if ((fePtr = new TransformationFE(numFeEle, elePtr)) == 0) {
opserr << "WARNING TransformationConstraintHandler::handle()";
opserr << " - ran out of memory";
opserr << " creating TransformationFE " << elePtr->getTag() << endln;
if (mps != 0) delete [] mps;
if (sps != 0) delete [] sps;
return -6;
}
theFEs[numFE++] = fePtr;
}
numFeEle++;
theModel->addFE_Element(fePtr);
theSub->setFE_ElementPtr(fePtr);
}
} else {
if (transformedEle.getLocation(tag) < 0) {
if ((fePtr = new FE_Element(numFeEle, elePtr)) == 0) {
opserr << "WARNING TransformationConstraintHandler::handle()";
opserr << " - ran out of memory";
opserr << " creating FE_Element " << elePtr->getTag() << endln;
if (mps != 0) delete [] mps;
if (sps != 0) delete [] sps;
return -5;
}
} else {
if ((fePtr = new TransformationFE(numFeEle, elePtr)) == 0) {
opserr << "WARNING TransformationConstraintHandler::handle()";
opserr << " - ran out of memory";
opserr << " creating TransformationFE " << elePtr->getTag() << endln;
if (mps != 0) delete [] mps;
if (sps != 0) delete [] sps;
return -6;
}
theFEs[numFE++] = fePtr;
}
numFeEle++;
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 (i=0; i<nodesLast->Size(); i++) {
int nodeID = (*nodesLast)(i);
Node *nodPtr = theDomain->getNode(nodeID);
if (nodPtr != 0) {
DOF_Group *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 TransformationConstraintHandler::handle() ";
opserr << " - boundary sp constraint in subdomain";
opserr << " this should not be - results suspect \n";
if (mps != 0) delete [] mps;
if (sps != 0) delete [] sps;
}
}
}
}
if (mps != 0) delete [] mps;
if (sps != 0) delete [] sps;
return count3;
}
示例3: 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;
}
示例4: 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;
}