本文整理汇总了C++中DOF_Group类的典型用法代码示例。如果您正苦于以下问题:C++ DOF_Group类的具体用法?C++ DOF_Group怎么用?C++ DOF_Group使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DOF_Group类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
int
IncrementalIntegrator::doMv(const Vector &v, Vector &res) {
int n = v.Size();
if (isDiagonal == true) {
for (int i=0; i<n; i++)
res[i] = diagMass[i]*v[i];
return 0;
}
res.Zero();
// loop over the FE_Elements
FE_Element *elePtr;
FE_EleIter &theEles = theAnalysisModel->getFEs();
while((elePtr = theEles()) != 0) {
const Vector &b = elePtr->getM_Force(v, 1.0);
res.Assemble(b, elePtr->getID(), 1.0);
}
// loop over the DOF_Groups
DOF_Group *dofPtr;
DOF_GrpIter &theDofs = theAnalysisModel->getDOFs();
while ((dofPtr = theDofs()) != 0) {
const Vector &a = dofPtr->getM_Force(v, 1.0);
res.Assemble(a, dofPtr->getID(), 1.0);
}
return 0;
}
示例2: x
void
BandArpackSolver::myMv(int n, double *v, double *result)
{
Vector x(v, n);
Vector y(result,n);
y.Zero();
AnalysisModel *theAnalysisModel = theSOE->theModel;
// loop over the FE_Elements
FE_Element *elePtr;
FE_EleIter &theEles = theAnalysisModel->getFEs();
while((elePtr = theEles()) != 0) {
const Vector &b = elePtr->getM_Force(x, 1.0);
y.Assemble(b, elePtr->getID(), 1.0);
}
// loop over the DOF_Groups
DOF_Group *dofPtr;
DOF_GrpIter &theDofs = theAnalysisModel->getDOFs();
Integrator *theIntegrator = 0;
while ((dofPtr = theDofs()) != 0) {
const Vector &a = dofPtr->getM_Force(x,1.0);
y.Assemble(a,dofPtr->getID(),1.0);
}
}
示例3: myID
// void setID(int index, int value);
// Method to set the correSPonding index of the ID to value.
int
LagrangeSP_FE::setID(void)
{
int result = 0;
// first determine the IDs in myID for those DOFs marked
// as constrained DOFs, this is obtained from the DOF_Group
// associated with the constrained node
DOF_Group *theNodesDOFs = theNode->getDOF_GroupPtr();
if (theNodesDOFs == 0) {
opserr << "WARNING LagrangeSP_FE::setID(void)";
opserr << " - no DOF_Group with Constrained Node\n";
return -1;
}
int restrainedDOF = theSP->getDOF_Number();
const ID &theNodesID = theNodesDOFs->getID();
if (restrainedDOF < 0 || restrainedDOF >= theNodesID.Size()) {
opserr << "WARNING LagrangeSP_FE::setID(void)";
opserr << " - restrained DOF invalid\n";
return -2;
}
myID(0) = theNodesID(restrainedDOF);
myID(1) = (theDofGroup->getID())(0);
return result;
}
示例4: theMP
PenaltyMP_FE::PenaltyMP_FE(int tag, Domain &theDomain,
MP_Constraint &TheMP, double Alpha)
:FE_Element(tag, 2,(TheMP.getConstrainedDOFs()).Size()+
(TheMP.getRetainedDOFs()).Size()),
theMP(&TheMP), theConstrainedNode(0) , theRetainedNode(0),
tang(0), resid(0), C(0), alpha(Alpha)
{
int size;
const ID &id1 = theMP->getConstrainedDOFs();
size = id1.Size();
const ID &id2 = theMP->getRetainedDOFs();
size += id2.Size();
tang = new Matrix(size,size);
resid = new Vector(size);
C = new Matrix(id1.Size(),size);
if (tang == 0 || resid == 0 || C == 0 ||
tang->noCols() != size || C->noCols() != size ||
resid->Size() != size) {
opserr << "FATAL PenaltyMP_FE::PenaltyMP_FE() - out of memory\n";
exit(-1);
}
theRetainedNode = theDomain.getNode(theMP->getNodeRetained());
theConstrainedNode = theDomain.getNode(theMP->getNodeConstrained());
if (theRetainedNode == 0 || theConstrainedNode == 0) {
opserr << "FATAL PenaltyMP_FE::PenaltyMP_FE() - Constrained or Retained";
opserr << " Node does not exist in Domain\n";
opserr << theMP->getNodeRetained() << " " << theMP->getNodeConstrained() << endln;
exit(-1);
}
// set up the dof groups tags
DOF_Group *dofGrpPtr = 0;
dofGrpPtr = theRetainedNode->getDOF_GroupPtr();
if (dofGrpPtr != 0)
myDOF_Groups(0) = dofGrpPtr->getTag();
else
opserr << "WARNING PenaltyMP_FE::PenaltyMP_FE() - node no Group yet?\n";
dofGrpPtr = theConstrainedNode->getDOF_GroupPtr();
if (dofGrpPtr != 0)
myDOF_Groups(1) = dofGrpPtr->getTag();
else
opserr << "WARNING PenaltyMP_FE::PenaltyMP_FE() - node no Group yet?\n";
if (theMP->isTimeVarying() == false) {
this->determineTangent();
// we can free up the space taken by C as it is no longer needed
if (C != 0)
delete C;
C = 0;
}
}
示例5: while
void
AnalysisModel::setVel(const Vector &vel)
{
DOF_GrpIter &theDOFGrps = this->getDOFs();
DOF_Group *dofPtr;
while ((dofPtr = theDOFGrps()) != 0)
dofPtr->setNodeVel(vel);
}
示例6: dUn
int
PFEMIntegrator::saveSensitivity(const Vector & dVNew,int gradNum,int numGrads)
{
// Recover sensitivity results from previous step
int vectorSize = U->Size();
Vector dUn(vectorSize);
dVn.resize(vectorSize); dVn.Zero();
AnalysisModel *myModel = this->getAnalysisModel();
DOF_GrpIter &theDOFs = myModel->getDOFs();
DOF_Group *dofPtr;
while ((dofPtr = theDOFs()) != 0) {
const ID &id = dofPtr->getID();
int idSize = id.Size();
const Vector &dispSens = dofPtr->getDispSensitivity(gradNumber);
for (int i=0; i < idSize; i++) {
int loc = id(i);
if (loc >= 0) {
dUn(loc) = dispSens(i);
}
}
const Vector &velSens = dofPtr->getVelSensitivity(gradNumber);
for (int i=0; i < idSize; i++) {
int loc = id(i);
if (loc >= 0) {
dVn(loc) = velSens(i);
}
}
}
// Compute new acceleration and velocity vectors:
Vector dUNew(vectorSize);
Vector dANew(vectorSize);
// dudotdot = 1/dt*dv{n+1} - 1/dt*dvn
dANew.addVector(0.0, dVNew, c3);
dANew.addVector(1.0, dVn, -c3);
// du = dun + dt*dv{n+1}
dUNew.addVector(0.0, dVNew, c1);
dUNew.addVector(1.0, dUn, 1.0);
// Now we can save vNew, vdotNew and vdotdotNew
DOF_GrpIter &theDOFGrps = myModel->getDOFs();
DOF_Group *dofPtr1;
while ( (dofPtr1 = theDOFGrps() ) != 0) {
dofPtr1->saveSensitivity(dUNew,dVNew,dANew,gradNum,numGrads);
}
return 0;
}
示例7: ID
int XC::Subdomain::buildMap(void) const
{
if(mapBuilt == false)
{
// determine the mapping between local dof and subdomain ana dof
int numDOF = this->getNumDOF();
if(map == nullptr)
map = new ID(numDOF);
if(map->Size() != numDOF)
{
delete map;
map = new ID(numDOF);
}
//int numExt = theAnalysis->getNumExternalEqn();
int numInt = theAnalysis->getNumInternalEqn();
const ID &theExtNodes = this->getExternalNodes();
int numExtNodes = theExtNodes.Size();
int locInMap =0;
for(int i=0; i<numExtNodes; i++)
{
Node *nodePtr= const_cast<Node *>(this->getNode(theExtNodes(i)));
int numNodeDOF = nodePtr->getNumberDOF();
DOF_Group *theDOF = nodePtr->getDOF_GroupPtr();
const ID &theLocalID = theDOF->getID();
for(int j=0; j<numNodeDOF; j++)
{
int locInSubdomainExt = theLocalID(j)-numInt;
(*map)(locInMap)=locInSubdomainExt;
locInMap++;
}
}
mapBuilt = true;
if(mappedVect == nullptr)
mappedVect = new Vector(numDOF);
if(mappedVect->Size() != numDOF)
{
delete mappedVect;
mappedVect = new Vector(numDOF);
}
if(mappedMatrix == nullptr)
mappedMatrix = new Matrix(numDOF,numDOF);
if(mappedMatrix->noRows() != numDOF)
{
delete mappedMatrix;
mappedMatrix = new Matrix(numDOF,numDOF);
}
}
return 0;
}
示例8: while
int
RitzIntegrator::formM()
{
if (theAnalysisModel == 0 || theSOE == 0) {
opserr << "WARNING RitzIntegrator::formM -";
opserr << " no AnalysisModel or EigenSOE has been set\n";
return -1;
}
// the loops to form and add the tangents are broken into two for
// efficiency when performing parallel computations
// loop through the FE_Elements getting them to form the tangent
// FE_EleIter &theEles1 = theAnalysisModel->getFEs();
FE_Element *elePtr;
flagK = 1;
theSOE->zeroM();
// while((elePtr = theEles1()) != 0)
// elePtr->formTangent(this);
// loop through the FE_Elements getting them to add the tangent
int result = 0;
FE_EleIter &theEles2 = theAnalysisModel->getFEs();
while((elePtr = theEles2()) != 0) {
if (theSOE->addM(elePtr->getTangent(this), elePtr->getID()) < 0) {
opserr << "WARNING RitzIntegrator::formM -";
opserr << " failed in addM for ID " << elePtr->getID();
result = -2;
}
}
DOF_Group *dofPtr;
DOF_GrpIter &theDofs = theAnalysisModel->getDOFs();
while((dofPtr = theDofs()) != 0) {
// dofPtr->formTangent(this);
if (theSOE->addM(dofPtr->getTangent(this),dofPtr->getID()) < 0) {
opserr << "WARNING RitzIntegrator::formM -";
opserr << " failed in addM for ID " << dofPtr->getID();
result = -3;
}
}
return result;
}
示例9: dampingForces
int
IncrementalIntegrator::addModalDampingForce(void)
{
int res = 0;
if (modalDampingValues == 0)
return 0;
int numModes = modalDampingValues->Size();
const Vector &eigenvalues = theAnalysisModel->getEigenvalues();
if (eigenvalues.Size() < numModes)
numModes = eigenvalues.Size();
Vector dampingForces(theSOE->getNumEqn());
dampingForces.Zero();
for (int i=0; i<numModes; i++) {
DOF_GrpIter &theDOFs1 = theAnalysisModel->getDOFs();
DOF_Group *dofPtr;
double beta = 0.0;
double eigenvalue = eigenvalues(i); // theEigenSOE->getEigenvalue(i+1);
double wn = 0.;
if (eigenvalue > 0)
wn = sqrt(eigenvalue);
while ((dofPtr = theDOFs1()) != 0) {
beta += dofPtr->getDampingBetaFactor(i, (*modalDampingValues)(i), wn);
}
DOF_GrpIter &theDOFs2 = theAnalysisModel->getDOFs();
while ((dofPtr = theDOFs2()) != 0) {
if (theSOE->addB(dofPtr->getDampingBetaForce(i, beta),dofPtr->getID()) <0) {
opserr << "WARNING IncrementalIntegrator::failed in dofPtr";
res = -1;
}
}
}
return res;
}
示例10: alpha
LagrangeSP_FE::LagrangeSP_FE(int tag, Domain &theDomain, SP_Constraint &TheSP,
DOF_Group &theGroup, double Alpha)
:FE_Element(tag, 2,2),
alpha(Alpha), tang(0), resid(0), theSP(&TheSP), theDofGroup(&theGroup)
{
// create a Matrix and a Vector for the tangent and residual
tang = new Matrix(2,2);
resid = new Vector(2);
if ((tang == 0) || (tang->noCols() == 0) || (resid == 0) ||
(resid->Size() == 0)) {
opserr << "WARNING LagrangeSP_FE::LagrangeSP_FE()";
opserr << "- ran out of memory\n";
exit(-1);
}
// zero the Matrix and Vector
resid->Zero();
tang->Zero();
theNode = theDomain.getNode(theSP->getNodeTag());
if (theNode == 0) {
opserr << "WARNING LagrangeSP_FE::LagrangeSP_FE()";
opserr << "- no asscoiated Node\n";
exit(-1);
}
// set the tangent
(*tang)(0,1) = alpha;
(*tang)(1,0) = alpha;
// set the myDOF_Groups tags indicating the attached id's of the
// DOF_Group objects
DOF_Group *theNodesDOFs = theNode->getDOF_GroupPtr();
if (theNodesDOFs == 0) {
opserr << "WARNING LagrangeSP_FE::LagrangeSP_FE()";
opserr << " - no DOF_Group with Constrained Node\n";
exit(-1);
}
myDOF_Groups(0) = theNodesDOFs->getTag();
myDOF_Groups(1) = theDofGroup->getTag();
}
示例11: while
int
TransientIntegrator::formTangent(int statFlag)
{
int result = 0;
statusFlag = statFlag;
LinearSOE *theLinSOE = this->getLinearSOE();
AnalysisModel *theModel = this->getAnalysisModel();
if (theLinSOE == 0 || theModel == 0) {
opserr << "WARNING TransientIntegrator::formTangent() ";
opserr << "no LinearSOE or AnalysisModel has been set\n";
return -1;
}
// the loops to form and add the tangents are broken into two for
// efficiency when performing parallel computations
theLinSOE->zeroA();
// loop through the DOF_Groups and add the unbalance
DOF_GrpIter &theDOFs = theModel->getDOFs();
DOF_Group *dofPtr;
while ((dofPtr = theDOFs()) != 0) {
if (theLinSOE->addA(dofPtr->getTangent(this),dofPtr->getID()) <0) {
opserr << "TransientIntegrator::formTangent() - failed to addA:dof\n";
result = -1;
}
}
// loop through the FE_Elements getting them to add the tangent
FE_EleIter &theEles2 = theModel->getFEs();
FE_Element *elePtr;
while((elePtr = theEles2()) != 0) {
if (theLinSOE->addA(elePtr->getTangent(this),elePtr->getID()) < 0) {
opserr << "TransientIntegrator::formTangent() - failed to addA:ele\n";
result = -2;
}
}
return result;
}
示例12: while
int
TransformationConstraintHandler::doneNumberingDOF(void)
{
// iterate through the DOF_Groups telling them that their ID has now been set
AnalysisModel *theModel1=this->getAnalysisModelPtr();
DOF_GrpIter &theDOFS = theModel1->getDOFs();
DOF_Group *dofPtr;
while ((dofPtr = theDOFS()) != 0) {
dofPtr->doneID();
}
// iterate through the FE_Element getting them to set their IDs
AnalysisModel *theModel=this->getAnalysisModelPtr();
FE_EleIter &theEle = theModel->getFEs();
FE_Element *elePtr;
while ((elePtr = theEle()) != 0) {
elePtr->setID();
}
return 0;
}
示例13: Vector
int
HHT1::domainChanged()
{
AnalysisModel *myModel = this->getAnalysisModel();
LinearSOE *theLinSOE = this->getLinearSOE();
const Vector &x = theLinSOE->getX();
int size = x.Size();
// if damping factors exist set them in the ele & node of the domain
if (alphaM != 0.0 || betaK != 0.0 || betaKi != 0.0 || betaKc != 0.0)
myModel->setRayleighDampingFactors(alphaM, betaK, betaKi, betaKc);
// create the new Vector objects
if (Ut == 0 || Ut->Size() != size) {
// delete the old
if (Ut != 0)
delete Ut;
if (Utdot != 0)
delete Utdot;
if (Utdotdot != 0)
delete Utdotdot;
if (U != 0)
delete U;
if (Udot != 0)
delete Udot;
if (Udotdot != 0)
delete Udotdot;
if (Ualpha != 0)
delete Ualpha;
if (Udotalpha != 0)
delete Udotalpha;
// create the new
Ut = new Vector(size);
Utdot = new Vector(size);
Utdotdot = new Vector(size);
U = new Vector(size);
Udot = new Vector(size);
Udotdot = new Vector(size);
Ualpha = new Vector(size);
Udotalpha = new Vector(size);
// check we obtained the new
if (Ut == 0 || Ut->Size() != size ||
Utdot == 0 || Utdot->Size() != size ||
Utdotdot == 0 || Utdotdot->Size() != size ||
U == 0 || U->Size() != size ||
Udot == 0 || Udot->Size() != size ||
Udotdot == 0 || Udotdot->Size() != size ||
Ualpha == 0 || Ualpha->Size() != size ||
Udotalpha == 0 || Udotalpha->Size() != size) {
opserr << "HHT1::domainChanged - ran out of memory\n";
// delete the old
if (Ut != 0)
delete Ut;
if (Utdot != 0)
delete Utdot;
if (Utdotdot != 0)
delete Utdotdot;
if (U != 0)
delete U;
if (Udot != 0)
delete Udot;
if (Udotdot != 0)
delete Udotdot;
if (Ualpha != 0)
delete Ualpha;
if (Udotalpha != 0)
delete Udotalpha;
Ut = 0; Utdot = 0; Utdotdot = 0;
U = 0; Udot = 0; Udotdot = 0; Udotalpha=0; Ualpha =0;
return -1;
}
}
// now go through and populate U, Udot and Udotdot by iterating through
// the DOF_Groups and getting the last committed velocity and accel
DOF_GrpIter &theDOFs = myModel->getDOFs();
DOF_Group *dofPtr;
while ((dofPtr = theDOFs()) != 0) {
const ID &id = dofPtr->getID();
int idSize = id.Size();
int i;
const Vector &disp = dofPtr->getCommittedDisp();
for (i=0; i < idSize; i++) {
int loc = id(i);
if (loc >= 0) {
(*U)(loc) = disp(i);
}
}
const Vector &vel = dofPtr->getCommittedVel();
//.........这里部分代码省略.........
示例14: Vector
int CollocationHSIncrReduct::domainChanged()
{
AnalysisModel *theModel = this->getAnalysisModel();
LinearSOE *theLinSOE = this->getLinearSOE();
const Vector &x = theLinSOE->getX();
int size = x.Size();
// create the new Vector objects
if (Ut == 0 || Ut->Size() != size) {
// delete the old
if (Ut != 0)
delete Ut;
if (Utdot != 0)
delete Utdot;
if (Utdotdot != 0)
delete Utdotdot;
if (U != 0)
delete U;
if (Udot != 0)
delete Udot;
if (Udotdot != 0)
delete Udotdot;
if (scaledDeltaU != 0)
delete scaledDeltaU;
// create the new
Ut = new Vector(size);
Utdot = new Vector(size);
Utdotdot = new Vector(size);
U = new Vector(size);
Udot = new Vector(size);
Udotdot = new Vector(size);
scaledDeltaU = new Vector(size);
// check we obtained the new
if (Ut == 0 || Ut->Size() != size ||
Utdot == 0 || Utdot->Size() != size ||
Utdotdot == 0 || Utdotdot->Size() != size ||
U == 0 || U->Size() != size ||
Udot == 0 || Udot->Size() != size ||
Udotdot == 0 || Udotdot->Size() != size ||
scaledDeltaU == 0 || scaledDeltaU->Size() != size) {
opserr << "CollocationHSIncrReduct::domainChanged() - ran out of memory\n";
// delete the old
if (Ut != 0)
delete Ut;
if (Utdot != 0)
delete Utdot;
if (Utdotdot != 0)
delete Utdotdot;
if (U != 0)
delete U;
if (Udot != 0)
delete Udot;
if (Udotdot != 0)
delete Udotdot;
if (scaledDeltaU != 0)
delete scaledDeltaU;
Ut = 0; Utdot = 0; Utdotdot = 0;
U = 0; Udot = 0; Udotdot = 0;
scaledDeltaU = 0;
return -1;
}
}
// now go through and populate U, Udot and Udotdot by iterating through
// the DOF_Groups and getting the last committed velocity and accel
DOF_GrpIter &theDOFs = theModel->getDOFs();
DOF_Group *dofPtr;
while ((dofPtr = theDOFs()) != 0) {
const ID &id = dofPtr->getID();
int idSize = id.Size();
int i;
const Vector &disp = dofPtr->getCommittedDisp();
for (i=0; i < idSize; i++) {
int loc = id(i);
if (loc >= 0) {
(*U)(loc) = disp(i);
}
}
const Vector &vel = dofPtr->getCommittedVel();
for (i=0; i < idSize; i++) {
int loc = id(i);
if (loc >= 0) {
(*Udot)(loc) = vel(i);
}
}
const Vector &accel = dofPtr->getCommittedAccel();
for (i=0; i < idSize; i++) {
int loc = id(i);
if (loc >= 0) {
(*Udotdot)(loc) = accel(i);
//.........这里部分代码省略.........
示例15: constrainedDOFs
// void setID(int index, int value);
// Method to set the correMPonding index of the ID to value.
int
PenaltyMP_FE::setID(void)
{
int result = 0;
// first determine the IDs in myID for those DOFs marked
// as constrained DOFs, this is obtained from the DOF_Group
// associated with the constrained node
DOF_Group *theConstrainedNodesDOFs = theConstrainedNode->getDOF_GroupPtr();
if (theConstrainedNodesDOFs == 0) {
opserr << "WARNING PenaltyMP_FE::setID(void)";
opserr << " - no DOF_Group with Constrained Node\n";
return -2;
}
const ID &constrainedDOFs = theMP->getConstrainedDOFs();
const ID &theConstrainedNodesID = theConstrainedNodesDOFs->getID();
int size1 = constrainedDOFs.Size();
for (int i=0; i<size1; i++) {
int constrained = constrainedDOFs(i);
if (constrained < 0 ||
constrained >= theConstrainedNode->getNumberDOF()) {
opserr << "WARNING PenaltyMP_FE::setID(void) - unknown DOF ";
opserr << constrained << " at Node\n";
myID(i) = -1; // modify so nothing will be added to equations
result = -3;
}
else {
if (constrained >= theConstrainedNodesID.Size()) {
opserr << "WARNING PenaltyMP_FE::setID(void) - ";
opserr << " Nodes DOF_Group too small\n";
myID(i) = -1; // modify so nothing will be added to equations
result = -4;
}
else
myID(i) = theConstrainedNodesID(constrained);
}
}
// now determine the IDs for the retained dof's
DOF_Group *theRetainedNodesDOFs = theRetainedNode->getDOF_GroupPtr();
if (theRetainedNodesDOFs == 0) {
opserr << "WARNING PenaltyMP_FE::setID(void)";
opserr << " - no DOF_Group with Retained Node\n";
return -2;
}
const ID &RetainedDOFs = theMP->getRetainedDOFs();
const ID &theRetainedNodesID = theRetainedNodesDOFs->getID();
int size2 = RetainedDOFs.Size();
for (int j=0; j<size2; j++) {
int retained = RetainedDOFs(j);
if (retained < 0 || retained >= theRetainedNode->getNumberDOF()) {
opserr << "WARNING PenaltyMP_FE::setID(void) - unknown DOF ";
opserr << retained << " at Node\n";
myID(j+size1) = -1; // modify so nothing will be added
result = -3;
}
else {
if (retained >= theRetainedNodesID.Size()) {
opserr << "WARNING PenaltyMP_FE::setID(void) - ";
opserr << " Nodes DOF_Group too small\n";
myID(j+size1) = -1; // modify so nothing will be added
result = -4;
}
else
myID(j+size1) = theRetainedNodesID(retained);
}
}
myDOF_Groups(0) = theConstrainedNodesDOFs->getTag();
myDOF_Groups(1) = theRetainedNodesDOFs->getTag();
return result;
}