The code does the same thing repeatly!

For developers writing C++, Fortran, Java, code who have questions or comments to make.

Moderators: silvia, selimgunay, Moderators

Post Reply
docmao
Posts: 6
Joined: Wed Jan 09, 2008 6:54 pm
Location: China

The code does the same thing repeatly!

Post by docmao »

int
TransformationConstraintHandler::enforceSPs(void)
{
for (int i=1; i<=numConstrainedNodes; i++) {
// upward cast - safe as i put it in this location
TransformationDOF_Group *theDof =
(TransformationDOF_Group *)theDOFs[numDOF-i];
theDof->enforceSPs(1);
}
for (int k=1; k<=numConstrainedNodes; k++) {
// upward cast - safe as i put it in this location
TransformationDOF_Group *theDof =
(TransformationDOF_Group *)theDOFs[numDOF-k];
theDof->enforceSPs(0);
}
.....


Beacause, the "int doMP" has never been reference in the following codes..
int
TransformationDOF_Group::enforceSPs(int doMP)
{
int numDof = myNode->getNumberDOF();

for (int i=0; i<numDof; i++)
if (theSPs[i] != 0) {
double value = theSPs[i]->getValue();
myNode->setTrialDisp(value, i);
}

if (needRetainedData == 0) {

if (theMP != 0) {

const ID &theID = this->getID();

int retainedNode = theMP->getNodeRetained();
Domain *theDomain = myNode->getDomain();
Node *retainedNodePtr = theDomain->getNode(retainedNode);
const Vector &responseR = retainedNodePtr->getTrialDisp();
const ID &retainedDOF = theMP->getRetainedDOFs();

modUnbalance->Zero();
for (int i=numConstrainedNodeRetainedDOF, j=0; i<modNumDOF; i++, j++) {
int loc = theID(i);
if (loc < 0)
(*modUnbalance)(i) = responseR(retainedDOF(j));
}

Matrix *T = this->getT();
if (T != 0) {

// *unbalance = (*T) * (*modUnbalance);
unbalance->addMatrixVector(0.0, *T, *modUnbalance, 1.0);

const ID &constrainedDOF = theMP->getConstrainedDOFs();
for (int i=0; i<constrainedDOF.Size(); i++) {
int cDOF = constrainedDOF(i);
myNode->setTrialDisp((*unbalance)(cDOF), cDOF);
}
}
}
}

return 0;
}
Post Reply